2 * Driver for the media bay on the PowerBook 3400 and 2400.
4 * Copyright (C) 1998 Paul Mackerras.
6 * Various evolutions by Benjamin Herrenschmidt & Henry Worth
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
13 #include <linux/types.h>
14 #include <linux/errno.h>
15 #include <linux/kernel.h>
16 #include <linux/delay.h>
17 #include <linux/sched.h>
18 #include <linux/timer.h>
19 #include <linux/hdreg.h>
20 #include <linux/stddef.h>
21 #include <linux/init.h>
22 #include <linux/ide.h>
23 #include <linux/kthread.h>
25 #include <asm/pgtable.h>
27 #include <asm/machdep.h>
28 #include <asm/pmac_feature.h>
29 #include <asm/mediabay.h>
30 #include <asm/sections.h>
31 #include <asm/ohare.h>
32 #include <asm/heathrow.h>
33 #include <asm/keylargo.h>
34 #include <linux/adb.h>
35 #include <linux/pmu.h>
41 #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg)
43 #define MBDBG(fmt, arg...) do { } while (0)
46 #define MB_FCR32(bay, r) ((bay)->base + ((r) >> 2))
47 #define MB_FCR8(bay, r) (((volatile u8 __iomem *)((bay)->base)) + (r))
49 #define MB_IN32(bay,r) (in_le32(MB_FCR32(bay,r)))
50 #define MB_OUT32(bay,r,v) (out_le32(MB_FCR32(bay,r), (v)))
51 #define MB_BIS(bay,r,v) (MB_OUT32((bay), (r), MB_IN32((bay), r) | (v)))
52 #define MB_BIC(bay,r,v) (MB_OUT32((bay), (r), MB_IN32((bay), r) & ~(v)))
53 #define MB_IN8(bay,r) (in_8(MB_FCR8(bay,r)))
54 #define MB_OUT8(bay,r,v) (out_8(MB_FCR8(bay,r), (v)))
56 struct media_bay_info;
60 void (*init)(struct media_bay_info *bay);
61 u8 (*content)(struct media_bay_info *bay);
62 void (*power)(struct media_bay_info *bay, int on_off);
63 int (*setup_bus)(struct media_bay_info *bay, u8 device_id);
64 void (*un_reset)(struct media_bay_info *bay);
65 void (*un_reset_ide)(struct media_bay_info *bay);
68 struct media_bay_info {
75 struct macio_dev *mdev;
80 struct semaphore lock;
81 #ifdef CONFIG_BLK_DEV_IDE_PMAC
82 void __iomem *cd_base;
86 #if defined(CONFIG_BLK_DEV_IDE_PMAC) || defined(CONFIG_MAC_FLOPPY)
93 static struct media_bay_info media_bays[MAX_BAYS];
94 int media_bay_count = 0;
96 #ifdef CONFIG_BLK_DEV_IDE_PMAC
97 /* check the busy bit in the media-bay ide interface
98 (assumes the media-bay contains an ide device) */
99 #define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
103 * Wait that number of ms between each step in normal polling mode
105 #define MB_POLL_DELAY 25
108 * Consider the media-bay ID value stable if it is the same for
109 * this number of milliseconds
111 #define MB_STABLE_DELAY 100
113 /* Wait after powering up the media bay this delay in ms
114 * timeout bumped for some powerbooks
116 #define MB_POWER_DELAY 200
119 * Hold the media-bay reset signal true for this many ticks
120 * after a device is inserted before releasing it.
122 #define MB_RESET_DELAY 50
125 * Wait this long after the reset signal is released and before doing
126 * further operations. After this delay, the IDE reset signal is released
127 * too for an IDE device
129 #define MB_SETUP_DELAY 100
132 * Wait this many ticks after an IDE device (e.g. CD-ROM) is inserted
133 * (or until the device is ready) before waiting for busy bit to disappear
135 #define MB_IDE_WAIT 1000
138 * Timeout waiting for busy bit of an IDE device to go down
140 #define MB_IDE_TIMEOUT 5000
143 * Max retries of the full power up/down sequence for an IDE device
145 #define MAX_CD_RETRIES 3
148 * States of a media bay
151 mb_empty = 0, /* Idle */
152 mb_powering_up, /* power bit set, waiting MB_POWER_DELAY */
153 mb_enabling_bay, /* enable bits set, waiting MB_RESET_DELAY */
154 mb_resetting, /* reset bit unset, waiting MB_SETUP_DELAY */
155 mb_ide_resetting, /* IDE reset bit unser, waiting MB_IDE_WAIT */
156 mb_ide_waiting, /* Waiting for BUSY bit to go away until MB_IDE_TIMEOUT */
157 mb_up, /* Media bay full */
158 mb_powering_down /* Powering down (avoid too fast down/up) */
161 #define MB_POWER_SOUND 0x08
162 #define MB_POWER_FLOPPY 0x04
163 #define MB_POWER_ATA 0x02
164 #define MB_POWER_PCI 0x01
165 #define MB_POWER_OFF 0x00
168 * Functions for polling content of media bay
172 ohare_mb_content(struct media_bay_info *bay)
174 return (MB_IN32(bay, OHARE_MBCR) >> 12) & 7;
178 heathrow_mb_content(struct media_bay_info *bay)
180 return (MB_IN32(bay, HEATHROW_MBCR) >> 12) & 7;
184 keylargo_mb_content(struct media_bay_info *bay)
188 new_gpio = MB_IN8(bay, KL_GPIO_MEDIABAY_IRQ) & KEYLARGO_GPIO_INPUT_DATA;
190 bay->cached_gpio = new_gpio;
192 } else if (bay->cached_gpio != new_gpio) {
193 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
194 (void)MB_IN32(bay, KEYLARGO_MBCR);
196 MB_BIC(bay, KEYLARGO_MBCR, 0x0000000F);
197 (void)MB_IN32(bay, KEYLARGO_MBCR);
199 bay->cached_gpio = new_gpio;
201 return (MB_IN32(bay, KEYLARGO_MBCR) >> 4) & 7;
205 * Functions for powering up/down the bay, puts the bay device
206 * into reset state as well
210 ohare_mb_power(struct media_bay_info* bay, int on_off)
213 /* Power up device, assert it's reset line */
214 MB_BIC(bay, OHARE_FCR, OH_BAY_RESET_N);
215 MB_BIC(bay, OHARE_FCR, OH_BAY_POWER_N);
217 /* Disable all devices */
218 MB_BIC(bay, OHARE_FCR, OH_BAY_DEV_MASK);
219 MB_BIC(bay, OHARE_FCR, OH_FLOPPY_ENABLE);
220 /* Cut power from bay, release reset line */
221 MB_BIS(bay, OHARE_FCR, OH_BAY_POWER_N);
222 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
223 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
225 MB_BIC(bay, OHARE_MBCR, 0x00000F00);
229 heathrow_mb_power(struct media_bay_info* bay, int on_off)
232 /* Power up device, assert it's reset line */
233 MB_BIC(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
234 MB_BIC(bay, HEATHROW_FCR, HRW_BAY_POWER_N);
236 /* Disable all devices */
237 MB_BIC(bay, HEATHROW_FCR, HRW_BAY_DEV_MASK);
238 MB_BIC(bay, HEATHROW_FCR, HRW_SWIM_ENABLE);
239 /* Cut power from bay, release reset line */
240 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_POWER_N);
241 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
242 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
244 MB_BIC(bay, HEATHROW_MBCR, 0x00000F00);
248 keylargo_mb_power(struct media_bay_info* bay, int on_off)
251 /* Power up device, assert it's reset line */
252 MB_BIC(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
253 MB_BIC(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_POWER);
255 /* Disable all devices */
256 MB_BIC(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_MASK);
257 MB_BIC(bay, KEYLARGO_FCR1, KL1_EIDE0_ENABLE);
258 /* Cut power from bay, release reset line */
259 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_POWER);
260 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
261 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
263 MB_BIC(bay, KEYLARGO_MBCR, 0x0000000F);
267 * Functions for configuring the media bay for a given type of device,
268 * enable the related busses
272 ohare_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
277 MB_BIS(bay, OHARE_FCR, OH_BAY_FLOPPY_ENABLE);
278 MB_BIS(bay, OHARE_FCR, OH_FLOPPY_ENABLE);
281 MB_BIC(bay, OHARE_FCR, OH_IDE1_RESET_N);
282 MB_BIS(bay, OHARE_FCR, OH_BAY_IDE_ENABLE);
285 MB_BIS(bay, OHARE_FCR, OH_BAY_PCI_ENABLE);
292 heathrow_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
297 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_FLOPPY_ENABLE);
298 MB_BIS(bay, HEATHROW_FCR, HRW_SWIM_ENABLE);
301 MB_BIC(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
302 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_IDE_ENABLE);
305 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_PCI_ENABLE);
312 keylargo_mb_setup_bus(struct media_bay_info* bay, u8 device_id)
316 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_IDE_ENABLE);
317 MB_BIC(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
318 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_ENABLE);
321 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_PCI_ENABLE);
324 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_SOUND_ENABLE);
331 * Functions for tweaking resets
335 ohare_mb_un_reset(struct media_bay_info* bay)
337 MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
340 static void keylargo_mb_init(struct media_bay_info *bay)
342 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_ENABLE);
345 static void heathrow_mb_un_reset(struct media_bay_info* bay)
347 MB_BIS(bay, HEATHROW_FCR, HRW_BAY_RESET_N);
350 static void keylargo_mb_un_reset(struct media_bay_info* bay)
352 MB_BIS(bay, KEYLARGO_MBCR, KL_MBCR_MB0_DEV_RESET);
355 static void ohare_mb_un_reset_ide(struct media_bay_info* bay)
357 MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
360 static void heathrow_mb_un_reset_ide(struct media_bay_info* bay)
362 MB_BIS(bay, HEATHROW_FCR, HRW_IDE1_RESET_N);
365 static void keylargo_mb_un_reset_ide(struct media_bay_info* bay)
367 MB_BIS(bay, KEYLARGO_FCR1, KL1_EIDE0_RESET_N);
370 static inline void set_mb_power(struct media_bay_info* bay, int onoff)
372 /* Power up up and assert the bay reset line */
374 bay->ops->power(bay, 1);
375 bay->state = mb_powering_up;
376 MBDBG("mediabay%d: powering up\n", bay->index);
378 /* Make sure everything is powered down & disabled */
379 bay->ops->power(bay, 0);
380 bay->state = mb_powering_down;
381 MBDBG("mediabay%d: powering down\n", bay->index);
383 bay->timer = msecs_to_jiffies(MB_POWER_DELAY);
386 static void poll_media_bay(struct media_bay_info* bay)
388 int id = bay->ops->content(bay);
390 if (id == bay->last_value) {
391 if (id != bay->content_id) {
392 bay->value_count += msecs_to_jiffies(MB_POLL_DELAY);
393 if (bay->value_count >= msecs_to_jiffies(MB_STABLE_DELAY)) {
394 /* If the device type changes without going thru
395 * "MB_NO", we force a pass by "MB_NO" to make sure
396 * things are properly reset
398 if ((id != MB_NO) && (bay->content_id != MB_NO)) {
400 MBDBG("mediabay%d: forcing MB_NO\n", bay->index);
402 MBDBG("mediabay%d: switching to %d\n", bay->index, id);
403 set_mb_power(bay, id != MB_NO);
404 bay->content_id = id;
406 #ifdef CONFIG_BLK_DEV_IDE_PMAC
409 printk(KERN_INFO "media bay %d is empty\n", bay->index);
414 bay->last_value = id;
415 bay->value_count = 0;
419 int check_media_bay(struct device_node *which_bay, int what)
423 for (i=0; i<media_bay_count; i++)
424 if (media_bays[i].mdev && which_bay == media_bays[i].mdev->ofdev.node) {
425 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
427 media_bays[i].cd_index = -1;
432 EXPORT_SYMBOL(check_media_bay);
434 #ifdef CONFIG_BLK_DEV_IDE_PMAC
435 int check_media_bay_by_base(unsigned long base, int what)
439 for (i=0; i<media_bay_count; i++)
440 if (media_bays[i].mdev && base == (unsigned long) media_bays[i].cd_base) {
441 if ((what == media_bays[i].content_id) && media_bays[i].state == mb_up)
443 media_bays[i].cd_index = -1;
450 int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
455 for (i=0; i<media_bay_count; i++) {
456 struct media_bay_info* bay = &media_bays[i];
458 if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
463 bay->cd_base = (void __iomem *) base;
466 if ((MB_CD != bay->content_id) || bay->state != mb_up) {
470 printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
472 if (MB_IDE_READY(i)) {
473 bay->cd_index = index;
479 printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
487 #endif /* CONFIG_BLK_DEV_IDE_PMAC */
489 static void media_bay_step(int i)
491 struct media_bay_info* bay = &media_bays[i];
493 /* We don't poll when powering down */
494 if (bay->state != mb_powering_down)
497 /* If timer expired or polling IDE busy, run state machine */
498 if ((bay->state != mb_ide_waiting) && (bay->timer != 0)) {
499 bay->timer -= msecs_to_jiffies(MB_POLL_DELAY);
507 if (bay->ops->setup_bus(bay, bay->last_value) < 0) {
508 MBDBG("mediabay%d: device not supported (kind:%d)\n", i, bay->content_id);
509 set_mb_power(bay, 0);
512 bay->timer = msecs_to_jiffies(MB_RESET_DELAY);
513 bay->state = mb_enabling_bay;
514 MBDBG("mediabay%d: enabling (kind:%d)\n", i, bay->content_id);
516 case mb_enabling_bay:
517 bay->ops->un_reset(bay);
518 bay->timer = msecs_to_jiffies(MB_SETUP_DELAY);
519 bay->state = mb_resetting;
520 MBDBG("mediabay%d: waiting reset (kind:%d)\n", i, bay->content_id);
523 if (bay->content_id != MB_CD) {
524 MBDBG("mediabay%d: bay is up (kind:%d)\n", i, bay->content_id);
528 #ifdef CONFIG_BLK_DEV_IDE_PMAC
529 MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id);
530 bay->ops->un_reset_ide(bay);
531 bay->timer = msecs_to_jiffies(MB_IDE_WAIT);
532 bay->state = mb_ide_resetting;
534 printk(KERN_DEBUG "media-bay %d is ide (not compiled in kernel)\n", i);
535 set_mb_power(bay, 0);
536 #endif /* CONFIG_BLK_DEV_IDE_PMAC */
538 #ifdef CONFIG_BLK_DEV_IDE_PMAC
539 case mb_ide_resetting:
540 bay->timer = msecs_to_jiffies(MB_IDE_TIMEOUT);
541 bay->state = mb_ide_waiting;
542 MBDBG("mediabay%d: waiting IDE ready (kind:%d)\n", i, bay->content_id);
545 if (bay->cd_base == NULL) {
548 MBDBG("mediabay%d: up before IDE init\n", i);
550 } else if (MB_IDE_READY(i)) {
553 if (bay->cd_index < 0) {
556 printk("mediabay %d, registering IDE...\n", i);
558 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
559 hw.irq = bay->cd_irq;
560 hw.chipset = ide_pmac;
562 ide_register_hw(&hw, NULL, NULL);
565 if (bay->cd_index == -1) {
566 /* We eventually do a retry */
568 printk("IDE register error\n");
569 set_mb_power(bay, 0);
571 printk(KERN_DEBUG "media-bay %d is ide%d\n", i, bay->cd_index);
572 MBDBG("mediabay %d IDE ready\n", i);
575 } else if (bay->timer > 0)
576 bay->timer -= msecs_to_jiffies(MB_POLL_DELAY);
577 if (bay->timer <= 0) {
578 printk("\nIDE Timeout in bay %d !, IDE state is: 0x%02x\n",
579 i, readb(bay->cd_base + 0x70));
580 MBDBG("mediabay%d: nIDE Timeout !\n", i);
581 set_mb_power(bay, 0);
585 #endif /* CONFIG_BLK_DEV_IDE_PMAC */
586 case mb_powering_down:
587 bay->state = mb_empty;
588 #ifdef CONFIG_BLK_DEV_IDE_PMAC
589 if (bay->cd_index >= 0) {
590 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i,
592 ide_unregister(bay->cd_index, 1, 1);
596 if (bay->cd_retry > MAX_CD_RETRIES) {
597 /* Should add an error sound (sort of beep in dmasound) */
598 printk("\nmedia-bay %d, IDE device badly inserted or unrecognised\n", i);
600 /* Force a new power down/up sequence */
601 bay->content_id = MB_NO;
604 #endif /* CONFIG_BLK_DEV_IDE_PMAC */
605 MBDBG("mediabay%d: end of power down\n", i);
611 * This procedure runs as a kernel thread to poll the media bay
612 * once each tick and register and unregister the IDE interface
613 * with the IDE driver. It needs to be a thread because
614 * ide_register can't be called from interrupt context.
616 static int media_bay_task(void *x)
620 while (!kthread_should_stop()) {
621 for (i = 0; i < media_bay_count; ++i) {
622 down(&media_bays[i].lock);
623 if (!media_bays[i].sleeping)
625 up(&media_bays[i].lock);
628 msleep_interruptible(MB_POLL_DELAY);
633 static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match)
635 struct media_bay_info* bay;
636 u32 __iomem *regbase;
637 struct device_node *ofnode;
641 ofnode = mdev->ofdev.node;
643 if (macio_resource_count(mdev) < 1)
645 if (macio_request_resources(mdev, "media-bay"))
647 /* Media bay registers are located at the beginning of the
648 * mac-io chip, for now, we trick and align down the first
651 base = macio_resource_start(mdev, 0) & 0xffff0000u;
652 regbase = (u32 __iomem *)ioremap(base, 0x100);
653 if (regbase == NULL) {
654 macio_release_resources(mdev);
658 i = media_bay_count++;
659 bay = &media_bays[i];
663 bay->ops = match->data;
665 init_MUTEX(&bay->lock);
667 /* Init HW probing */
671 printk(KERN_INFO "mediabay%d: Registered %s media-bay\n", i, bay->ops->name);
673 /* Force an immediate detect */
674 set_mb_power(bay, 0);
675 msleep(MB_POWER_DELAY);
676 bay->content_id = MB_NO;
677 bay->last_value = bay->ops->content(bay);
678 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY);
679 bay->state = mb_empty;
681 msleep(MB_POLL_DELAY);
683 } while((bay->state != mb_empty) &&
684 (bay->state != mb_up));
686 /* Mark us ready by filling our mdev data */
687 macio_set_drvdata(mdev, bay);
689 /* Startup kernel thread */
691 kthread_run(media_bay_task, NULL, "media-bay");
697 static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
699 struct media_bay_info *bay = macio_get_drvdata(mdev);
701 if (state.event != mdev->ofdev.dev.power.power_state.event && state.event == PM_EVENT_SUSPEND) {
704 set_mb_power(bay, 0);
706 msleep(MB_POLL_DELAY);
707 mdev->ofdev.dev.power.power_state = state;
712 static int media_bay_resume(struct macio_dev *mdev)
714 struct media_bay_info *bay = macio_get_drvdata(mdev);
716 if (mdev->ofdev.dev.power.power_state.event != PM_EVENT_ON) {
717 mdev->ofdev.dev.power.power_state = PMSG_ON;
719 /* We re-enable the bay using it's previous content
720 only if it did not change. Note those bozo timings,
721 they seem to help the 3400 get it right.
723 /* Force MB power to 0 */
725 set_mb_power(bay, 0);
726 msleep(MB_POWER_DELAY);
727 if (bay->ops->content(bay) != bay->content_id) {
728 printk("mediabay%d: content changed during sleep...\n", bay->index);
732 set_mb_power(bay, 1);
733 bay->last_value = bay->content_id;
734 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY);
735 bay->timer = msecs_to_jiffies(MB_POWER_DELAY);
736 #ifdef CONFIG_BLK_DEV_IDE_PMAC
740 msleep(MB_POLL_DELAY);
741 media_bay_step(bay->index);
742 } while((bay->state != mb_empty) &&
743 (bay->state != mb_up));
751 /* Definitions of "ops" structures.
753 static struct mb_ops ohare_mb_ops = {
755 .content = ohare_mb_content,
756 .power = ohare_mb_power,
757 .setup_bus = ohare_mb_setup_bus,
758 .un_reset = ohare_mb_un_reset,
759 .un_reset_ide = ohare_mb_un_reset_ide,
762 static struct mb_ops heathrow_mb_ops = {
764 .content = heathrow_mb_content,
765 .power = heathrow_mb_power,
766 .setup_bus = heathrow_mb_setup_bus,
767 .un_reset = heathrow_mb_un_reset,
768 .un_reset_ide = heathrow_mb_un_reset_ide,
771 static struct mb_ops keylargo_mb_ops = {
773 .init = keylargo_mb_init,
774 .content = keylargo_mb_content,
775 .power = keylargo_mb_power,
776 .setup_bus = keylargo_mb_setup_bus,
777 .un_reset = keylargo_mb_un_reset,
778 .un_reset_ide = keylargo_mb_un_reset_ide,
782 * It seems that the bit for the media-bay interrupt in the IRQ_LEVEL
783 * register is always set when there is something in the media bay.
784 * This causes problems for the interrupt code if we attach an interrupt
785 * handler to the media-bay interrupt, because it tends to go into
786 * an infinite loop calling the media bay interrupt handler.
787 * Therefore we do it all by polling the media bay once each tick.
790 static struct of_device_id media_bay_match[] =
794 .compatible = "keylargo-media-bay",
795 .data = &keylargo_mb_ops,
799 .compatible = "heathrow-media-bay",
800 .data = &heathrow_mb_ops,
804 .compatible = "ohare-media-bay",
805 .data = &ohare_mb_ops,
810 static struct macio_driver media_bay_driver =
813 .match_table = media_bay_match,
814 .probe = media_bay_attach,
815 .suspend = media_bay_suspend,
816 .resume = media_bay_resume
819 static int __init media_bay_init(void)
823 for (i=0; i<MAX_BAYS; i++) {
824 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info));
825 media_bays[i].content_id = -1;
826 #ifdef CONFIG_BLK_DEV_IDE_PMAC
827 media_bays[i].cd_index = -1;
830 if (!machine_is(powermac))
833 macio_register_driver(&media_bay_driver);
838 device_initcall(media_bay_init);