]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/legacy/q40ide.c
Merge branches 'release', 'acpi_pm_device_sleep_state' and 'battery' into release
[linux-2.6-omap-h63xx.git] / drivers / ide / legacy / q40ide.c
index e628a983ce3395706cdf905c52a37eab15abc9d9..1381b91bc316e3982671bf281b2455ac7ff8c02b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/legacy/q40ide.c -- Q40 I/O port IDE Driver
+ *  Q40 I/O port IDE Driver
  *
  *     (c) Richard Zidlicky
  *
@@ -66,16 +66,12 @@ static int q40ide_default_irq(unsigned long base)
 
 
 /*
- * This is very similar to ide_setup_ports except that addresses
- * are pretranslated for q40 ISA access
+ * Addresses are pretranslated for Q40 ISA access.
  */
 void q40_ide_setup_ports ( hw_regs_t *hw,
                        unsigned long base, int *offsets,
                        unsigned long ctrl, unsigned long intr,
                        ide_ack_intr_t *ack_intr,
-/*
- *                     ide_io_ops_t *iops,
- */
                        int irq)
 {
        int i;
@@ -89,20 +85,16 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
                else
                        hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]);
        }
-       
+
        hw->irq = irq;
-       hw->dma = NO_DMA;
        hw->ack_intr = ack_intr;
-/*
- *     hw->iops = iops;
- */
 }
 
 
 
 /* 
  * the static array is needed to have the name reported in /proc/ioports,
- * hwif->name unfortunately isnยดt available yet
+ * hwif->name unfortunately isn't available yet
  */
 static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
        "ide0", "ide1"
@@ -112,15 +104,17 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
  *  Probe for Q40 IDE interfaces
  */
 
-void q40ide_init(void)
+static int __init q40ide_init(void)
 {
     int i;
     ide_hwif_t *hwif;
-    int index;
     const char *name;
+    u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
     if (!MACH_IS_Q40)
-      return ;
+      return -ENODEV;
+
+    printk(KERN_INFO "ide: Q40 IDE controller\n");
 
     for (i = 0; i < Q40IDE_NUM_HWIFS; i++) {
        hw_regs_t hw;
@@ -142,10 +136,20 @@ void q40ide_init(void)
                        0, NULL,
 //                     m68kide_iops,
                        q40ide_default_irq(pcide_bases[i]));
-       index = ide_register_hw(&hw, 1, &hwif);
-       // **FIXME**
-       if (index != -1)
+
+       hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+       if (hwif) {
+               ide_init_port_data(hwif, hwif->index);
+               ide_init_port_hw(hwif, &hw);
                hwif->mmio = 1;
+
+               idx[i] = hwif->index;
+       }
     }
+
+    ide_device_add(idx, NULL);
+
+    return 0;
 }
 
+module_init(q40ide_init);