ide: add IDE_HFLAG_LEGACY_IRQS host flag
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 18 Oct 2007 22:30:11 +0000 (00:30 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 18 Oct 2007 22:30:11 +0000 (00:30 +0200)
Add IDE_HFLAG_LEGACY_IRQS host flag to tell ide_pci_setup_ports() to set
hwif->irq to legacy IRQ 14/15 (iff hwif->irq is not already set) and convert
atiixp, piix, serverworks, sis5513 and slc90e66 host drivers to use it.

While at it:

* In piix.c add IDE_HFLAGS_PIIX define and don't use ->init_hwif for MPIIX.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/pci/atiixp.c
drivers/ide/pci/piix.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/slc90e66.c
drivers/ide/setup-pci.c
include/linux/ide.h

index 18c181bc841b91aa9aff3dce0fe6bf036eed2276..47e95806c07f8df7d5a304002eda309c1edd9664 100644 (file)
@@ -172,9 +172,6 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
        u8 ch = hwif->channel;
        struct pci_dev *pdev = hwif->pci_dev;
 
-       if (!hwif->irq)
-               hwif->irq = ch ? 15 : 14;
-
        hwif->set_pio_mode = &atiixp_set_pio_mode;
        hwif->set_dma_mode = &atiixp_set_dma_mode;
        hwif->drives[0].autotune = 1;
@@ -200,7 +197,7 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
                .name           = "ATIIXP",
                .init_hwif      = init_hwif_atiixp,
                .enablebits     = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
-               .host_flags     = IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -208,7 +205,8 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
                .name           = "SB600_PATA",
                .init_hwif      = init_hwif_atiixp,
                .enablebits     = {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
-               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS |
+                                 IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
index bcdf8c17b90be8c2a2d1b02efe3360d5629534e5..2e29543acff9079d53568e2e9643bddf8803d825 100644 (file)
@@ -341,16 +341,6 @@ static u8 __devinit piix_cable_detect(ide_hwif_t *hwif)
 
 static void __devinit init_hwif_piix(ide_hwif_t *hwif)
 {
-#ifndef CONFIG_IA64
-       if (!hwif->irq)
-               hwif->irq = hwif->channel ? 15 : 14;
-#endif /* CONFIG_IA64 */
-
-       if (hwif->pci_dev->device == PCI_DEVICE_ID_INTEL_82371MX) {
-               /* This is a painful system best to let it self tune for now */
-               return;
-       }
-
        hwif->set_pio_mode = &piix_set_pio_mode;
        hwif->set_dma_mode = &piix_set_dma_mode;
 
@@ -378,12 +368,18 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif)
                hwif->ide_dma_clear_irq = &piix_dma_clear_irq;
 }
 
+#ifndef CONFIG_IA64
+ #define IDE_HFLAGS_PIIX (IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE)
+#else
+ #define IDE_HFLAGS_PIIX IDE_HFLAG_BOOTABLE
+#endif
+
 #define DECLARE_PIIX_DEV(name_str, udma) \
        {                                               \
                .name           = name_str,             \
                .init_hwif      = init_hwif_piix,       \
                .enablebits     = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
-               .host_flags     = IDE_HFLAG_BOOTABLE,   \
+               .host_flags     = IDE_HFLAGS_PIIX,      \
                .pio_mask       = ATA_PIO4,             \
                .swdma_mask     = ATA_SWDMA2_ONLY,      \
                .mwdma_mask     = ATA_MWDMA12_ONLY,     \
@@ -396,7 +392,7 @@ static void __devinit init_hwif_ich(ide_hwif_t *hwif)
                .init_chipset   = init_chipset_ich, \
                .init_hwif      = init_hwif_ich, \
                .enablebits     = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
-               .host_flags     = IDE_HFLAG_BOOTABLE, \
+               .host_flags     = IDE_HFLAGS_PIIX, \
                .pio_mask       = ATA_PIO4, \
                .swdma_mask     = ATA_SWDMA2_ONLY, \
                .mwdma_mask     = ATA_MWDMA12_ONLY, \
@@ -414,11 +410,11 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
                 * of the bit 14 of the IDETIM register at offset 0x6c
                 */
                .name           = "MPIIX",
-               .init_hwif      = init_hwif_piix,
                .enablebits     = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}},
                .host_flags     = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA |
-                                 IDE_HFLAG_BOOTABLE,
+                                 IDE_HFLAGS_PIIX,
                .pio_mask       = ATA_PIO4,
+               /* This is a painful system best to let it self tune for now */
        },
 
        /*  3 */ DECLARE_PIIX_DEV("PIIX3",      0x00),  /* no udma */
index c506b8bc4bcd0dd886eb692387e89a824f18ce05..6f95cd29292797b293c2729b20caba6f95e93ab0 100644 (file)
@@ -360,9 +360,6 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif)
 
 static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
 {
-       if (!hwif->irq)
-               hwif->irq = hwif->channel ? 15 : 14;
-
        hwif->set_pio_mode = &svwks_set_pio_mode;
        hwif->set_dma_mode = &svwks_set_dma_mode;
        hwif->udma_filter = &svwks_udma_filter;
@@ -384,7 +381,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .name           = "SvrWks OSB4",
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .host_flags     = IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = 0x00, /* UDMA is problematic on OSB4 */
@@ -392,7 +389,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .name           = "SvrWks CSB5",
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .host_flags     = IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -400,7 +397,7 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .name           = "SvrWks CSB6",
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .host_flags     = IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -408,7 +405,8 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .name           = "SvrWks CSB6",
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
+                                 IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
@@ -416,7 +414,8 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
                .name           = "SvrWks HT1000",
                .init_chipset   = init_chipset_svwks,
                .init_hwif      = init_hwif_svwks,
-               .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_BOOTABLE,
+               .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
+                                 IDE_HFLAG_BOOTABLE,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA5,
index d38b2039e2aa498166b30e3c510aec4558aeb7e8..674a5bb7955048778d38e7f2222c5ab06c66f39a 100644 (file)
@@ -564,9 +564,6 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
 {
        u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
 
-       if (!hwif->irq)
-               hwif->irq = hwif->channel ? 15 : 14;
-
        hwif->set_pio_mode = &sis_set_pio_mode;
        hwif->set_dma_mode = &sis_set_dma_mode;
 
@@ -590,7 +587,8 @@ static ide_pci_device_t sis5513_chipset __devinitdata = {
        .init_chipset   = init_chipset_sis5513,
        .init_hwif      = init_hwif_sis5513,
        .enablebits     = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
-       .host_flags     = IDE_HFLAG_NO_AUTODMA | IDE_HFLAG_BOOTABLE,
+       .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA |
+                         IDE_HFLAG_BOOTABLE,
        .pio_mask       = ATA_PIO4,
        .mwdma_mask     = ATA_MWDMA2,
 };
index 416fbab2ed36781f1b5d1f434b38ecd539af52e4..d85a48e7deba3ace8d7eebff839f02d80ce81934 100644 (file)
@@ -133,9 +133,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
        u8 reg47 = 0;
        u8 mask = hwif->channel ? 0x01 : 0x02;  /* bit0:Primary */
 
-       if (!hwif->irq)
-               hwif->irq = hwif->channel ? 15 : 14;
-
        hwif->set_pio_mode = &slc90e66_set_pio_mode;
        hwif->set_dma_mode = &slc90e66_set_dma_mode;
 
@@ -156,7 +153,7 @@ static ide_pci_device_t slc90e66_chipset __devinitdata = {
        .name           = "SLC90E66",
        .init_hwif      = init_hwif_slc90e66,
        .enablebits     = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
-       .host_flags     = IDE_HFLAG_BOOTABLE,
+       .host_flags     = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
        .pio_mask       = ATA_PIO4,
        .swdma_mask     = ATA_SWDMA2_ONLY,
        .mwdma_mask     = ATA_MWDMA12_ONLY,
index aae4806f0603888ff561f69c05ec61110a174832..7989f521b801dcc70dd42439b1de52a07f8a7ccb 100644 (file)
@@ -562,6 +562,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
                if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
                        ide_hwif_setup_dma(dev, d, hwif);
 
+               if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0)
+                       hwif->irq = port ? 15 : 14;
+
                hwif->host_flags = d->host_flags;
                hwif->pio_mask = d->pio_mask;
 
index 659b60abc259beb24cd9c06a33f0e581eec9baba..19db0a4ae447dda881fb396cc45a179893a6f89e 100644 (file)
@@ -1259,6 +1259,8 @@ enum {
        IDE_HFLAG_ERROR_STOPS_FIFO      = (1 << 19),
        /* serialize ports */
        IDE_HFLAG_SERIALIZE             = (1 << 20),
+       /* use legacy IRQs */
+       IDE_HFLAG_LEGACY_IRQS           = (1 << 21),
 };
 
 #ifdef CONFIG_BLK_DEV_OFFBOARD