]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/pci/tc86c001.c
x86: remove conflicting nx6325 and nx6125 quirks
[linux-2.6-omap-h63xx.git] / drivers / ide / pci / tc86c001.c
index e1faf6c2fe1678ba442fbfae9516144e4cbfeb1e..9b4b27a4c71121c30298052a30c653f5ccffee05 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * drivers/ide/pci/tc86c001.c  Version 1.01    Sep 5, 2007
- *
  * Copyright (C) 2002 Toshiba Corporation
  * Copyright (C) 2005-2006 MontaVista Software, Inc. <source@mvista.com>
  *
@@ -20,20 +18,20 @@ static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed)
        u16 mode, scr           = inw(scr_port);
 
        switch (speed) {
-               case XFER_UDMA_4:       mode = 0x00c0; break;
-               case XFER_UDMA_3:       mode = 0x00b0; break;
-               case XFER_UDMA_2:       mode = 0x00a0; break;
-               case XFER_UDMA_1:       mode = 0x0090; break;
-               case XFER_UDMA_0:       mode = 0x0080; break;
-               case XFER_MW_DMA_2:     mode = 0x0070; break;
-               case XFER_MW_DMA_1:     mode = 0x0060; break;
-               case XFER_MW_DMA_0:     mode = 0x0050; break;
-               case XFER_PIO_4:        mode = 0x0400; break;
-               case XFER_PIO_3:        mode = 0x0300; break;
-               case XFER_PIO_2:        mode = 0x0200; break;
-               case XFER_PIO_1:        mode = 0x0100; break;
-               case XFER_PIO_0:
-               default:                mode = 0x0000; break;
+       case XFER_UDMA_4:       mode = 0x00c0; break;
+       case XFER_UDMA_3:       mode = 0x00b0; break;
+       case XFER_UDMA_2:       mode = 0x00a0; break;
+       case XFER_UDMA_1:       mode = 0x0090; break;
+       case XFER_UDMA_0:       mode = 0x0080; break;
+       case XFER_MW_DMA_2:     mode = 0x0070; break;
+       case XFER_MW_DMA_1:     mode = 0x0060; break;
+       case XFER_MW_DMA_0:     mode = 0x0050; break;
+       case XFER_PIO_4:        mode = 0x0400; break;
+       case XFER_PIO_3:        mode = 0x0300; break;
+       case XFER_PIO_2:        mode = 0x0200; break;
+       case XFER_PIO_1:        mode = 0x0100; break;
+       case XFER_PIO_0:
+       default:                mode = 0x0000; break;
        }
 
        scr &= (speed < XFER_MW_DMA_0) ? 0xf8ff : 0xff0f;
@@ -128,43 +126,23 @@ static void tc86c001_dma_start(ide_drive_t *drive)
        ide_dma_start(drive);
 }
 
-static int tc86c001_busproc(ide_drive_t *drive, int state)
+static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-       unsigned long sc_base   = hwif->config_data;
-       u16 scr1;
-
-       /* System Control 1 Register bit 11 (ATA Hard Reset) read */
-       scr1 = inw(sc_base + 0x00);
-
-       switch (state) {
-               case BUSSTATE_ON:
-                       if (!(scr1 & 0x0800))
-                               return 0;
-                       scr1 &= ~0x0800;
-
-                       hwif->drives[0].failures = hwif->drives[1].failures = 0;
-                       break;
-               case BUSSTATE_OFF:
-                       if (scr1 & 0x0800)
-                               return 0;
-                       scr1 |= 0x0800;
-
-                       hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
-                       hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
-                       break;
-               default:
-                       return -EINVAL;
-       }
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
+       unsigned long sc_base = pci_resource_start(dev, 5);
+       u16 scr1 = inw(sc_base + 0x00);
 
-       /* System Control 1 Register bit 11 (ATA Hard Reset) write */
-       outw(scr1, sc_base + 0x00);
-       return 0;
+       /*
+        * System Control  1 Register bit 13 (PDIAGN):
+        * 0=80-pin cable, 1=40-pin cable
+        */
+       return (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
 }
 
 static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
 {
-       unsigned long sc_base   = pci_resource_start(hwif->pci_dev, 5);
+       struct pci_dev *dev     = to_pci_dev(hwif->dev);
+       unsigned long sc_base   = pci_resource_start(dev, 5);
        u16 scr1                = inw(sc_base + 0x00);
 
        /* System Control 1 Register bit 15 (Soft Reset) set */
@@ -179,11 +157,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
        /* Store the system control register base for convenience... */
        hwif->config_data = sc_base;
 
-       hwif->set_pio_mode = &tc86c001_set_pio_mode;
-       hwif->set_dma_mode = &tc86c001_set_mode;
-
-       hwif->busproc   = &tc86c001_busproc;
-
        if (!hwif->dma_base)
                return;
 
@@ -195,17 +168,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
 
        /* Sector Count Register limit */
        hwif->rqsize     = 0xffff;
-
-       hwif->dma_start         = &tc86c001_dma_start;
-
-       if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
-               /*
-                * System Control  1 Register bit 13 (PDIAGN):
-                * 0=80-pin cable, 1=40-pin cable
-                */
-               scr1 = inw(sc_base + 0x00);
-               hwif->cbl = (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
-       }
 }
 
 static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
@@ -218,10 +180,29 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
        return err;
 }
 
+static const struct ide_port_ops tc86c001_port_ops = {
+       .set_pio_mode           = tc86c001_set_pio_mode,
+       .set_dma_mode           = tc86c001_set_mode,
+       .cable_detect           = tc86c001_cable_detect,
+};
+
+static const struct ide_dma_ops tc86c001_dma_ops = {
+       .dma_host_set           = ide_dma_host_set,
+       .dma_setup              = ide_dma_setup,
+       .dma_exec_cmd           = ide_dma_exec_cmd,
+       .dma_start              = tc86c001_dma_start,
+       .dma_end                = __ide_dma_end,
+       .dma_test_irq           = ide_dma_test_irq,
+       .dma_lost_irq           = ide_dma_lost_irq,
+       .dma_timeout            = ide_dma_timeout,
+};
+
 static const struct ide_port_info tc86c001_chipset __devinitdata = {
        .name           = "TC86C001",
        .init_chipset   = init_chipset_tc86c001,
        .init_hwif      = init_hwif_tc86c001,
+       .port_ops       = &tc86c001_port_ops,
+       .dma_ops        = &tc86c001_dma_ops,
        .host_flags     = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD |
                          IDE_HFLAG_ABUSE_SET_DMA_MODE,
        .pio_mask       = ATA_PIO4,