aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pdc202xx_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pdc202xx_old.c')
-rw-r--r--drivers/ide/pdc202xx_old.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index b6abf7e52cac..cb812f3700e8 100644
--- a/drivers/ide/pdc202xx_old.c
+++ b/drivers/ide/pdc202xx_old.c
@@ -73,7 +73,7 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
73 * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A 73 * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A
74 */ 74 */
75 AP &= ~0x3f; 75 AP &= ~0x3f;
76 if (ata_id_iordy_disable(drive->id)) 76 if (ide_pio_need_iordy(drive, speed - XFER_PIO_0))
77 AP |= 0x20; /* set IORDY_EN bit */ 77 AP |= 0x20; /* set IORDY_EN bit */
78 if (drive->media == ide_disk) 78 if (drive->media == ide_disk)
79 AP |= 0x10; /* set Prefetch_EN bit */ 79 AP |= 0x10; /* set Prefetch_EN bit */
@@ -104,6 +104,27 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
104 pdc202xx_set_mode(drive, XFER_PIO_0 + pio); 104 pdc202xx_set_mode(drive, XFER_PIO_0 + pio);
105} 105}
106 106
107static int pdc202xx_test_irq(ide_hwif_t *hwif)
108{
109 struct pci_dev *dev = to_pci_dev(hwif->dev);
110 unsigned long high_16 = pci_resource_start(dev, 4);
111 u8 sc1d = inb(high_16 + 0x1d);
112
113 if (hwif->channel) {
114 /*
115 * bit 7: error, bit 6: interrupting,
116 * bit 5: FIFO full, bit 4: FIFO empty
117 */
118 return ((sc1d & 0x50) == 0x40) ? 1 : 0;
119 } else {
120 /*
121 * bit 3: error, bit 2: interrupting,
122 * bit 1: FIFO full, bit 0: FIFO empty
123 */
124 return ((sc1d & 0x05) == 0x04) ? 1 : 0;
125 }
126}
127
107static u8 pdc2026x_cable_detect(ide_hwif_t *hwif) 128static u8 pdc2026x_cable_detect(ide_hwif_t *hwif)
108{ 129{
109 struct pci_dev *dev = to_pci_dev(hwif->dev); 130 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -231,6 +252,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
231static const struct ide_port_ops pdc20246_port_ops = { 252static const struct ide_port_ops pdc20246_port_ops = {
232 .set_pio_mode = pdc202xx_set_pio_mode, 253 .set_pio_mode = pdc202xx_set_pio_mode,
233 .set_dma_mode = pdc202xx_set_mode, 254 .set_dma_mode = pdc202xx_set_mode,
255 .test_irq = pdc202xx_test_irq,
234}; 256};
235 257
236static const struct ide_port_ops pdc2026x_port_ops = { 258static const struct ide_port_ops pdc2026x_port_ops = {