ide: delete filenames/versions from comments
[firefly-linux-kernel-4.4.55.git] / drivers / ide / pci / pdc202xx_old.c
index e09742e2ba592607e31dd3356099fabf8fae5ea8..31a1308414a0f87a57a004831ca1e4fc8ac160ae 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  linux/drivers/ide/pci/pdc202xx_old.c       Version 0.52    Aug 27, 2007
- *
  *  Copyright (C) 1998-2002            Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2006-2007            MontaVista Software, Inc.
  *  Copyright (C) 2007                 Bartlomiej Zolnierkiewicz
@@ -66,7 +64,7 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *);
 static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
-       struct pci_dev *dev     = hwif->pci_dev;
+       struct pci_dev *dev     = to_pci_dev(hwif->dev);
        u8 drive_pci            = 0x60 + (drive->dn << 2);
 
        u8                      AP = 0, BP = 0, CP = 0;
@@ -144,9 +142,10 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
 
 static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
 {
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
        u16 CIS = 0, mask = (hwif->channel) ? (1<<11) : (1<<10);
 
-       pci_read_config_word(hwif->pci_dev, 0x50, &CIS);
+       pci_read_config_word(dev, 0x50, &CIS);
 
        return (CIS & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
 }
@@ -162,7 +161,7 @@ static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
  */
 static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
 {
-       unsigned long clock_reg = hwif->dma_master + 0x11;
+       unsigned long clock_reg = hwif->extra_base + 0x01;
        u8 clock = inb(clock_reg);
 
        outb(clock | (hwif->channel ? 0x08 : 0x02), clock_reg);
@@ -170,20 +169,23 @@ static void pdc_old_enable_66MHz_clock(ide_hwif_t *hwif)
 
 static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
 {
-       unsigned long clock_reg = hwif->dma_master + 0x11;
+       unsigned long clock_reg = hwif->extra_base + 0x01;
        u8 clock = inb(clock_reg);
 
        outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
 }
 
-static int pdc202xx_quirkproc (ide_drive_t *drive)
+static void pdc202xx_quirkproc(ide_drive_t *drive)
 {
        const char **list, *model = drive->id->model;
 
        for (list = pdc_quirk_drives; *list != NULL; list++)
-               if (strstr(model, *list) != NULL)
-                       return 2;
-       return 0;
+               if (strstr(model, *list) != NULL) {
+                       drive->quirk_list = 2;
+                       return;
+               }
+
+       drive->quirk_list = 0;
 }
 
 static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
@@ -193,7 +195,7 @@ static void pdc202xx_old_ide_dma_start(ide_drive_t *drive)
        if (drive->media != ide_disk || drive->addressing == 1) {
                struct request *rq      = HWGROUP(drive)->rq;
                ide_hwif_t *hwif        = HWIF(drive);
-               unsigned long high_16   = hwif->dma_master;
+               unsigned long high_16   = hwif->extra_base - 16;
                unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
                u32 word_count  = 0;
                u8 clock = inb(high_16 + 0x11);
@@ -212,7 +214,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
 {
        if (drive->media != ide_disk || drive->addressing == 1) {
                ide_hwif_t *hwif        = HWIF(drive);
-               unsigned long high_16   = hwif->dma_master;
+               unsigned long high_16   = hwif->extra_base - 16;
                unsigned long atapi_reg = high_16 + (hwif->channel ? 0x24 : 0x20);
                u8 clock                = 0;
 
@@ -228,7 +230,7 @@ static int pdc202xx_old_ide_dma_end(ide_drive_t *drive)
 static int pdc202xx_old_ide_dma_test_irq(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
-       unsigned long high_16   = hwif->dma_master;
+       unsigned long high_16   = hwif->extra_base - 16;
        u8 dma_stat             = inb(hwif->dma_status);
        u8 sc1d                 = inb(high_16 + 0x001d);
 
@@ -271,7 +273,7 @@ static void pdc202xx_dma_timeout(ide_drive_t *drive)
 
 static void pdc202xx_reset_host (ide_hwif_t *hwif)
 {
-       unsigned long high_16   = hwif->dma_master;
+       unsigned long high_16   = hwif->extra_base - 16;
        u8 udma_speed_flag      = inb(high_16 | 0x001f);
 
        outb(udma_speed_flag | 0x10, high_16 | 0x001f);
@@ -302,12 +304,14 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
 
 static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
 {
+       struct pci_dev *dev = to_pci_dev(hwif->dev);
+
        hwif->set_pio_mode = &pdc202xx_set_pio_mode;
        hwif->set_dma_mode = &pdc202xx_set_mode;
 
        hwif->quirkproc = &pdc202xx_quirkproc;
 
-       if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246)
+       if (dev->device != PCI_DEVICE_ID_PROMISE_20246)
                hwif->resetproc = &pdc202xx_reset;
 
        if (hwif->dma_base == 0)
@@ -316,7 +320,7 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
        hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
        hwif->dma_timeout = &pdc202xx_dma_timeout;
 
-       if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) {
+       if (dev->device != PCI_DEVICE_ID_PROMISE_20246) {
                if (hwif->cbl != ATA_CBL_PATA40_SHORT)
                        hwif->cbl = pdc202xx_old_cable_detect(hwif);
 
@@ -331,7 +335,7 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
        u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0;
 
        if (hwif->channel) {
-               ide_setup_dma(hwif, dmabase, 8);
+               ide_setup_dma(hwif, dmabase);
                return;
        }
 
@@ -355,7 +359,7 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
        }
 #endif /* CONFIG_PDC202XX_BURST */
 
-       ide_setup_dma(hwif, dmabase, 8);
+       ide_setup_dma(hwif, dmabase);
 }
 
 static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
@@ -375,6 +379,11 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
        }
 }
 
+#define IDE_HFLAGS_PDC202XX \
+       (IDE_HFLAG_ERROR_STOPS_FIFO | \
+        IDE_HFLAG_ABUSE_SET_DMA_MODE | \
+        IDE_HFLAG_OFF_BOARD)
+
 #define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
        { \
                .name           = name_str, \
@@ -382,9 +391,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
                .init_hwif      = init_hwif_pdc202xx, \
                .init_dma       = init_dma_pdc202xx, \
                .extra          = 48, \
-               .host_flags     = IDE_HFLAG_ERROR_STOPS_FIFO | \
-                                 extra_flags | \
-                                 IDE_HFLAG_OFF_BOARD, \
+               .host_flags     = IDE_HFLAGS_PDC202XX | extra_flags, \
                .pio_mask       = ATA_PIO4, \
                .mwdma_mask     = ATA_MWDMA2, \
                .udma_mask      = udma, \
@@ -397,8 +404,7 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
                .init_hwif      = init_hwif_pdc202xx,
                .init_dma       = init_dma_pdc202xx,
                .extra          = 16,
-               .host_flags     = IDE_HFLAG_ERROR_STOPS_FIFO |
-                                 IDE_HFLAG_OFF_BOARD,
+               .host_flags     = IDE_HFLAGS_PDC202XX,
                .pio_mask       = ATA_PIO4,
                .mwdma_mask     = ATA_MWDMA2,
                .udma_mask      = ATA_UDMA2,