]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/legacy/macide.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[linux-2.6-omap-h63xx.git] / drivers / ide / legacy / macide.c
index 12cd26d0aa20aec8d5acabbb1c9288b9767749b9..26546d0afc7f4cae440a15298b09659ed34d3952 100644 (file)
  * These match MkLinux so they should be correct.
  */
 
-#define IDE_DATA       0x00
-#define IDE_ERROR      0x04    /* see err-bits */
-#define IDE_NSECTOR    0x08    /* nr of sectors to read/write */
-#define IDE_SECTOR     0x0c    /* starting sector */
-#define IDE_LCYL       0x10    /* starting cylinder */
-#define IDE_HCYL       0x14    /* high byte of starting cyl */
-#define IDE_SELECT     0x18    /* 101dhhhh , d=drive, hhhh=head */
-#define IDE_STATUS     0x1c    /* see status-bits */
 #define IDE_CONTROL    0x38    /* control/altstatus */
 
 /*
 
 volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
 
-static int macide_offsets[IDE_NR_PORTS] = {
-    IDE_DATA, IDE_ERROR,  IDE_NSECTOR, IDE_SECTOR, IDE_LCYL,
-    IDE_HCYL, IDE_SELECT, IDE_STATUS,  IDE_CONTROL
-};
-
 int macide_ack_intr(ide_hwif_t* hwif)
 {
        if (*ide_ifr & 0x20) {
@@ -77,6 +64,22 @@ int macide_ack_intr(ide_hwif_t* hwif)
        return 0;
 }
 
+static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
+                                     int irq, ide_ack_intr_t *ack_intr)
+{
+       int i;
+
+       memset(hw, 0, sizeof(*hw));
+
+       for (i = 0; i < 8; i++)
+               hw->io_ports[i] = base + i * 4;
+
+       hw->io_ports[IDE_CONTROL_OFFSET] = base + IDE_CONTROL;
+
+       hw->irq = irq;
+       hw->ack_intr = ack_intr;
+}
+
 static const char *mac_ide_name[] =
        { "Quadra", "Powerbook", "Powerbook Baboon" };
 
@@ -86,27 +89,27 @@ static const char *mac_ide_name[] =
 
 static int __init macide_init(void)
 {
-       hw_regs_t hw;
        ide_hwif_t *hwif;
+       ide_ack_intr_t *ack_intr;
+       unsigned long base;
+       int irq;
+       hw_regs_t hw;
 
        switch (macintosh_config->ide_type) {
        case MAC_IDE_QUADRA:
-               ide_setup_ports(&hw, IDE_BASE, macide_offsets,
-                               0, 0, macide_ack_intr,
-//                             quadra_ide_iops,
-                               IRQ_NUBUS_F);
+               base = IDE_BASE;
+               ack_intr = macide_ack_intr;
+               irq = IRQ_NUBUS_F;
                break;
        case MAC_IDE_PB:
-               ide_setup_ports(&hw, IDE_BASE, macide_offsets,
-                               0, 0, macide_ack_intr,
-//                             macide_pb_iops,
-                               IRQ_NUBUS_C);
+               base = IDE_BASE;
+               ack_intr = macide_ack_intr;
+               irq = IRQ_NUBUS_C;
                break;
        case MAC_IDE_BABOON:
-               ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
-                               0, 0, NULL,
-//                             macide_baboon_iops,
-                               IRQ_BABOON_1);
+               base = BABOON_BASE;
+               ack_intr = NULL;
+               irq = IRQ_BABOON_1;
                break;
        default:
                return -ENODEV;
@@ -115,7 +118,9 @@ static int __init macide_init(void)
        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]);
+       macide_setup_ports(&hw, base, irq, ack_intr);
+
+       hwif = ide_find_port();
        if (hwif) {
                u8 index = hwif->index;
                u8 idx[4] = { index, 0xff, 0xff, 0xff };
@@ -123,12 +128,12 @@ static int __init macide_init(void)
                ide_init_port_data(hwif, index);
                ide_init_port_hw(hwif, &hw);
 
-               hwif->mmio = 1;
-
-               ide_device_add(idx);
+               ide_device_add(idx, NULL);
        }
 
        return 0;
 }
 
 module_init(macide_init);
+
+MODULE_LICENSE("GPL");