]> err.no Git - linux-2.6/blobdiff - drivers/ide/legacy/macide.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6] / drivers / ide / legacy / macide.c
index 4c0079ad52ac16a9dd95df58e9afdde2a29239bf..782d4c76c0e578f607fdf20635838d8191db7b1d 100644 (file)
@@ -77,24 +77,17 @@ int macide_ack_intr(ide_hwif_t* hwif)
        return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_MAC_MEDIABAY
-static void macide_mediabay_interrupt(int irq, void *dev_id)
-{
-       int state = baboon->mb_status & 0x04;
-
-       printk(KERN_INFO "macide: media bay %s detected\n", state? "removal":"insertion");
-}
-#endif
+static const char *mac_ide_name[] =
+       { "Quadra", "Powerbook", "Powerbook Baboon" };
 
 /*
  * Probe for a Macintosh IDE interface
  */
 
-void macide_init(void)
+static int __init macide_init(void)
 {
        hw_regs_t hw;
        ide_hwif_t *hwif;
-       int index = -1;
 
        switch (macintosh_config->ide_type) {
        case MAC_IDE_QUADRA:
@@ -102,53 +95,50 @@ void macide_init(void)
                                0, 0, macide_ack_intr,
 //                             quadra_ide_iops,
                                IRQ_NUBUS_F);
-               index = ide_register_hw(&hw, &hwif);
                break;
        case MAC_IDE_PB:
                ide_setup_ports(&hw, IDE_BASE, macide_offsets,
                                0, 0, macide_ack_intr,
 //                             macide_pb_iops,
                                IRQ_NUBUS_C);
-               index = ide_register_hw(&hw, &hwif);
                break;
        case MAC_IDE_BABOON:
                ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
                                0, 0, NULL,
 //                             macide_baboon_iops,
                                IRQ_BABOON_1);
-               index = ide_register_hw(&hw, &hwif);
-               if (index == -1) break;
-               if (macintosh_config->ident == MAC_MODEL_PB190) {
+               break;
+       default:
+               return -ENODEV;
+       }
+
+       printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
+                        mac_ide_name[macintosh_config->ide_type - 1]);
+
+       hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+       if (hwif) {
+               u8 index = hwif->index;
+               u8 idx[4] = { index, 0xff, 0xff, 0xff };
 
+               ide_init_port_data(hwif, index);
+               ide_init_port_hw(hwif, &hw);
+
+               if (macintosh_config->ide_type == MAC_IDE_BABOON &&
+                   macintosh_config->ident == MAC_MODEL_PB190) {
                        /* Fix breakage in ide-disk.c: drive capacity   */
                        /* is not initialized for drives without a      */
                        /* hardware ID, and we can't get that without   */
                        /* probing the drive which freezes a 190.       */
-
-                       ide_drive_t *drive = &ide_hwifs[index].drives[0];
+                       ide_drive_t *drive = &hwif->drives[0];
                        drive->capacity64 = drive->cyl*drive->head*drive->sect;
-
-#ifdef CONFIG_BLK_DEV_MAC_MEDIABAY
-                       request_irq(IRQ_BABOON_2, macide_mediabay_interrupt,
-                                       IRQ_FLG_FAST, "mediabay",
-                                       macide_mediabay_interrupt);
-#endif
                }
-               break;
-
-       default:
-           return;
-       }
 
-        if (index != -1) {
                hwif->mmio = 1;
-               if (macintosh_config->ide_type == MAC_IDE_QUADRA)
-                       printk(KERN_INFO "ide%d: Macintosh Quadra IDE interface\n", index);
-               else if (macintosh_config->ide_type == MAC_IDE_PB)
-                       printk(KERN_INFO "ide%d: Macintosh Powerbook IDE interface\n", index);
-               else if (macintosh_config->ide_type == MAC_IDE_BABOON)
-                       printk(KERN_INFO "ide%d: Macintosh Powerbook Baboon IDE interface\n", index);
-               else
-                       printk(KERN_INFO "ide%d: Unknown Macintosh IDE interface\n", index);
+
+               ide_device_add(idx);
        }
+
+       return 0;
 }
+
+module_init(macide_init);