diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2009-06-15 12:52:59 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-06-15 12:52:59 -0400 |
commit | e0321fbe6d34b4bb514fb6daff9e0859e5d76001 (patch) | |
tree | 1d4f5e7db555c26d5112e9b46e2689d0aebc4b8e /drivers/ide/pdc202xx_old.c | |
parent | 628df2f33d99dace08838779d8a02bf1deaff100 (diff) |
pdc202xx_old: implement test_irq() method (take 2)
Implement test_irq() method based on the driver's former dma_test_irq() method.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pdc202xx_old.c')
-rw-r--r-- | drivers/ide/pdc202xx_old.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c index 4f5b536282af..cb812f3700e8 100644 --- a/drivers/ide/pdc202xx_old.c +++ b/drivers/ide/pdc202xx_old.c | |||
@@ -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 | ||
107 | static 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 | |||
107 | static u8 pdc2026x_cable_detect(ide_hwif_t *hwif) | 128 | static 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, | |||
231 | static const struct ide_port_ops pdc20246_port_ops = { | 252 | static 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 | ||
236 | static const struct ide_port_ops pdc2026x_port_ops = { | 258 | static const struct ide_port_ops pdc2026x_port_ops = { |