]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/arm/palm_bk3710.c
ATA/IDE: fix platform driver hotplug/coldplug
[linux-2.6-omap-h63xx.git] / drivers / ide / arm / palm_bk3710.c
index 08029662106f982e34d03422a64bb5f769a25c3e..420fcb78a7cd15215b7b476b7cd57b378c71308f 100644 (file)
@@ -311,6 +311,28 @@ static void __devinit palm_bk3710_chipinit(void __iomem *base)
        palm_bk3710_setpiomode(base, NULL, 0, 600, 0);
        palm_bk3710_setpiomode(base, NULL, 1, 600, 0);
 }
+
+static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif)
+{
+       return ATA_CBL_PATA80;
+}
+
+static void __devinit palm_bk3710_init_hwif(ide_hwif_t *hwif)
+{
+       hwif->set_pio_mode = palm_bk3710_set_pio_mode;
+       hwif->set_dma_mode = palm_bk3710_set_dma_mode;
+
+       hwif->cable_detect = palm_bk3710_cable_detect;
+}
+
+static const struct ide_port_info __devinitdata palm_bk3710_port_info = {
+       .init_hwif              = palm_bk3710_init_hwif,
+       .host_flags             = IDE_HFLAG_NO_DMA, /* hack (no PCI) */
+       .pio_mask               = ATA_PIO4,
+       .udma_mask              = ATA_UDMA4,    /* (input clk 99MHz) */
+       .mwdma_mask             = ATA_MWDMA2,
+};
+
 static int __devinit palm_bk3710_probe(struct platform_device *pdev)
 {
        struct clk *clkp;
@@ -356,49 +378,44 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
        hw.irq = irq->start;
        hw.chipset = ide_palm3710;
 
-       hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+       hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
        if (hwif == NULL)
                goto out;
 
        i = hwif->index;
 
        if (hwif->present)
-               ide_unregister(i, 0, 1);
-       else if (!hwif->hold)
+               ide_unregister(i);
+       else
                ide_init_port_data(hwif, i);
 
        ide_init_port_hw(hwif, &hw);
-       hwif->quirkproc = NULL;
+
+       hwif->mmio = 1;
+       default_hwif_mmiops(hwif);
+
+       ide_setup_dma(hwif, mem->start);
 
        idx[0] = i;
 
-       ide_device_add(idx, NULL);
+       ide_device_add(idx, &palm_bk3710_port_info);
 
        if (!hwif->present)
                goto out;
 
-       hwif->set_pio_mode = &palm_bk3710_set_pio_mode;
-       hwif->set_dma_mode = &palm_bk3710_set_dma_mode;
-       hwif->mmio = 1;
-       default_hwif_mmiops(hwif);
-       hwif->cbl = ATA_CBL_PATA80;
-       hwif->ultra_mask = 0x1f;        /* Ultra DMA Mode 4 Max
-                                               (input clk 99MHz) */
-       hwif->mwdma_mask = 0x7;
-       hwif->drives[0].autotune = 1;
-       hwif->drives[1].autotune = 1;
-
-       ide_setup_dma(hwif, mem->start);
-
        return 0;
 out:
        printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
        return -ENODEV;
 }
 
+/* work with hotplug and coldplug */
+MODULE_ALIAS("platform:palm_bk3710");
+
 static struct platform_driver platform_bk_driver = {
        .driver = {
                .name = "palm_bk3710",
+               .owner = THIS_MODULE,
        },
        .probe = palm_bk3710_probe,
        .remove = NULL,