diff options
Diffstat (limited to 'drivers/ide/pdc202xx_old.c')
-rw-r--r-- | drivers/ide/pdc202xx_old.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c index 35161dd840a0..c5f3841af360 100644 --- a/drivers/ide/pdc202xx_old.c +++ b/drivers/ide/pdc202xx_old.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> | 2 | * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> |
3 | * Copyright (C) 2006-2007, 2009 MontaVista Software, Inc. | 3 | * Copyright (C) 2006-2007, 2009 MontaVista Software, Inc. |
4 | * Copyright (C) 2007 Bartlomiej Zolnierkiewicz | 4 | * Copyright (C) 2007-2010 Bartlomiej Zolnierkiewicz |
5 | * | 5 | * |
6 | * Portions Copyright (C) 1999 Promise Technology, Inc. | 6 | * Portions Copyright (C) 1999 Promise Technology, Inc. |
7 | * Author: Frank Tiernan (frankt@promise.com) | 7 | * Author: Frank Tiernan (frankt@promise.com) |
@@ -21,23 +21,15 @@ | |||
21 | 21 | ||
22 | #define DRV_NAME "pdc202xx_old" | 22 | #define DRV_NAME "pdc202xx_old" |
23 | 23 | ||
24 | static void pdc_old_disable_66MHz_clock(ide_hwif_t *); | 24 | static void pdc202xx_set_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
25 | |||
26 | static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | ||
27 | { | 25 | { |
28 | ide_hwif_t *hwif = drive->hwif; | ||
29 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 26 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
30 | u8 drive_pci = 0x60 + (drive->dn << 2); | 27 | u8 drive_pci = 0x60 + (drive->dn << 2); |
28 | const u8 speed = drive->dma_mode; | ||
31 | 29 | ||
32 | u8 AP = 0, BP = 0, CP = 0; | 30 | u8 AP = 0, BP = 0, CP = 0; |
33 | u8 TA = 0, TB = 0, TC = 0; | 31 | u8 TA = 0, TB = 0, TC = 0; |
34 | 32 | ||
35 | /* | ||
36 | * TODO: do this once per channel | ||
37 | */ | ||
38 | if (dev->device != PCI_DEVICE_ID_PROMISE_20246) | ||
39 | pdc_old_disable_66MHz_clock(hwif); | ||
40 | |||
41 | pci_read_config_byte(dev, drive_pci, &AP); | 33 | pci_read_config_byte(dev, drive_pci, &AP); |
42 | pci_read_config_byte(dev, drive_pci + 1, &BP); | 34 | pci_read_config_byte(dev, drive_pci + 1, &BP); |
43 | pci_read_config_byte(dev, drive_pci + 2, &CP); | 35 | pci_read_config_byte(dev, drive_pci + 2, &CP); |
@@ -84,9 +76,10 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) | |||
84 | } | 76 | } |
85 | } | 77 | } |
86 | 78 | ||
87 | static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | 79 | static void pdc202xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
88 | { | 80 | { |
89 | pdc202xx_set_mode(drive, XFER_PIO_0 + pio); | 81 | drive->dma_mode = drive->pio_mode; |
82 | pdc202xx_set_mode(hwif, drive); | ||
90 | } | 83 | } |
91 | 84 | ||
92 | static int pdc202xx_test_irq(ide_hwif_t *hwif) | 85 | static int pdc202xx_test_irq(ide_hwif_t *hwif) |
@@ -100,13 +93,13 @@ static int pdc202xx_test_irq(ide_hwif_t *hwif) | |||
100 | * bit 7: error, bit 6: interrupting, | 93 | * bit 7: error, bit 6: interrupting, |
101 | * bit 5: FIFO full, bit 4: FIFO empty | 94 | * bit 5: FIFO full, bit 4: FIFO empty |
102 | */ | 95 | */ |
103 | return ((sc1d & 0x50) == 0x40) ? 1 : 0; | 96 | return ((sc1d & 0x50) == 0x50) ? 1 : 0; |
104 | } else { | 97 | } else { |
105 | /* | 98 | /* |
106 | * bit 3: error, bit 2: interrupting, | 99 | * bit 3: error, bit 2: interrupting, |
107 | * bit 1: FIFO full, bit 0: FIFO empty | 100 | * bit 1: FIFO full, bit 0: FIFO empty |
108 | */ | 101 | */ |
109 | return ((sc1d & 0x05) == 0x04) ? 1 : 0; | 102 | return ((sc1d & 0x05) == 0x05) ? 1 : 0; |
110 | } | 103 | } |
111 | } | 104 | } |
112 | 105 | ||
@@ -145,6 +138,11 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif) | |||
145 | outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); | 138 | outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); |
146 | } | 139 | } |
147 | 140 | ||
141 | static void pdc2026x_init_hwif(ide_hwif_t *hwif) | ||
142 | { | ||
143 | pdc_old_disable_66MHz_clock(hwif); | ||
144 | } | ||
145 | |||
148 | static void pdc202xx_dma_start(ide_drive_t *drive) | 146 | static void pdc202xx_dma_start(ide_drive_t *drive) |
149 | { | 147 | { |
150 | if (drive->current_speed > XFER_UDMA_2) | 148 | if (drive->current_speed > XFER_UDMA_2) |
@@ -261,6 +259,7 @@ static const struct ide_dma_ops pdc2026x_dma_ops = { | |||
261 | { \ | 259 | { \ |
262 | .name = DRV_NAME, \ | 260 | .name = DRV_NAME, \ |
263 | .init_chipset = init_chipset_pdc202xx, \ | 261 | .init_chipset = init_chipset_pdc202xx, \ |
262 | .init_hwif = pdc2026x_init_hwif, \ | ||
264 | .port_ops = &pdc2026x_port_ops, \ | 263 | .port_ops = &pdc2026x_port_ops, \ |
265 | .dma_ops = &pdc2026x_dma_ops, \ | 264 | .dma_ops = &pdc2026x_dma_ops, \ |
266 | .host_flags = IDE_HFLAGS_PDC202XX, \ | 265 | .host_flags = IDE_HFLAGS_PDC202XX, \ |
@@ -356,6 +355,6 @@ static void __exit pdc202xx_ide_exit(void) | |||
356 | module_init(pdc202xx_ide_init); | 355 | module_init(pdc202xx_ide_init); |
357 | module_exit(pdc202xx_ide_exit); | 356 | module_exit(pdc202xx_ide_exit); |
358 | 357 | ||
359 | MODULE_AUTHOR("Andre Hedrick, Frank Tiernan"); | 358 | MODULE_AUTHOR("Andre Hedrick, Frank Tiernan, Bartlomiej Zolnierkiewicz"); |
360 | MODULE_DESCRIPTION("PCI driver module for older Promise IDE"); | 359 | MODULE_DESCRIPTION("PCI driver module for older Promise IDE"); |
361 | MODULE_LICENSE("GPL"); | 360 | MODULE_LICENSE("GPL"); |