Commit c9ef59ff01b6bd1c7360a64fcc8556a1193c2ed0
1 parent
6dae44f9a5
Exists in
master
and in
39 other branches
ide: IORDY handling fixes
Add ide_pio_need_iordy() helper and convert host drivers to use it. This fixes it8172, it8213, pdc202xx_old, piix, slc90e66 and siimage host drivers to handle IORDY correctly. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Showing 10 changed files with 22 additions and 16 deletions Side-by-side Diff
drivers/ide/at91_ide.c
... | ... | @@ -185,8 +185,7 @@ |
185 | 185 | timing = ide_timing_find_mode(XFER_PIO_0 + pio); |
186 | 186 | BUG_ON(!timing); |
187 | 187 | |
188 | - if ((pio > 2 || ata_id_has_iordy(drive->id)) && | |
189 | - !(ata_id_is_cfa(drive->id) && pio > 4)) | |
188 | + if (ide_pio_need_iordy(drive, pio)) | |
190 | 189 | use_iordy = 1; |
191 | 190 | |
192 | 191 | apply_timings(chipselect, pio, timing, use_iordy); |
drivers/ide/ide-xfer-mode.c
... | ... | @@ -107,6 +107,12 @@ |
107 | 107 | } |
108 | 108 | EXPORT_SYMBOL_GPL(ide_get_best_pio_mode); |
109 | 109 | |
110 | +int ide_pio_need_iordy(ide_drive_t *drive, const u8 pio) | |
111 | +{ | |
112 | + return ata_id_pio_need_iordy(drive->id, pio); | |
113 | +} | |
114 | +EXPORT_SYMBOL_GPL(ide_pio_need_iordy); | |
115 | + | |
110 | 116 | int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) |
111 | 117 | { |
112 | 118 | ide_hwif_t *hwif = drive->hwif; |
drivers/ide/it8172.c
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | if (drive->media == ide_disk) |
67 | 67 | /* enable prefetch */ |
68 | 68 | drive_enables |= 0x0004 << (drive->dn * 4); |
69 | - if (ata_id_has_iordy(drive->id)) | |
69 | + if (ide_pio_need_iordy(drive, pio)) | |
70 | 70 | /* enable IORDY sample-point */ |
71 | 71 | drive_enables |= 0x0002 << (drive->dn * 4); |
72 | 72 |
drivers/ide/it8213.c
drivers/ide/pdc202xx_old.c
... | ... | @@ -73,7 +73,7 @@ |
73 | 73 | * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A |
74 | 74 | */ |
75 | 75 | AP &= ~0x3f; |
76 | - if (ata_id_iordy_disable(drive->id)) | |
76 | + if (ide_pio_need_iordy(drive, speed - XFER_PIO_0)) | |
77 | 77 | AP |= 0x20; /* set IORDY_EN bit */ |
78 | 78 | if (drive->media == ide_disk) |
79 | 79 | AP |= 0x10; /* set Prefetch_EN bit */ |
drivers/ide/piix.c
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | control |= 1; /* Programmable timing on */ |
99 | 99 | if (drive->media == ide_disk) |
100 | 100 | control |= 4; /* Prefetch, post write */ |
101 | - if (pio > 2) | |
101 | + if (ide_pio_need_iordy(drive, pio)) | |
102 | 102 | control |= 2; /* IORDY */ |
103 | 103 | if (is_slave) { |
104 | 104 | master_data |= 0x4000; |
drivers/ide/siimage.c
... | ... | @@ -32,7 +32,6 @@ |
32 | 32 | * smarter code in libata. |
33 | 33 | * |
34 | 34 | * TODO: |
35 | - * - IORDY fixes | |
36 | 35 | * - VDMA support |
37 | 36 | */ |
38 | 37 | |
... | ... | @@ -234,8 +233,7 @@ |
234 | 233 | * @pio: PIO mode number |
235 | 234 | * |
236 | 235 | * Load the timing settings for this device mode into the |
237 | - * controller. If we are in PIO mode 3 or 4 turn on IORDY | |
238 | - * monitoring (bit 9). The TF timing is bits 31:16 | |
236 | + * controller. | |
239 | 237 | */ |
240 | 238 | |
241 | 239 | static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) |
242 | 240 | |
... | ... | @@ -276,13 +274,16 @@ |
276 | 274 | /* now set up IORDY */ |
277 | 275 | speedp = sil_ioread16(dev, tfaddr - 2); |
278 | 276 | speedp &= ~0x200; |
279 | - if (pio > 2) | |
280 | - speedp |= 0x200; | |
281 | - sil_iowrite16(dev, speedp, tfaddr - 2); | |
282 | 277 | |
283 | 278 | mode = sil_ioread8(dev, base + addr_mask); |
284 | 279 | mode &= ~(unit ? 0x30 : 0x03); |
285 | - mode |= unit ? 0x10 : 0x01; | |
280 | + | |
281 | + if (ide_pio_need_iordy(drive, pio)) { | |
282 | + speedp |= 0x200; | |
283 | + mode |= unit ? 0x10 : 0x01; | |
284 | + } | |
285 | + | |
286 | + sil_iowrite16(dev, speedp, tfaddr - 2); | |
286 | 287 | sil_iowrite8(dev, mode, base + addr_mask); |
287 | 288 | } |
288 | 289 |
drivers/ide/sl82c105.c
drivers/ide/slc90e66.c
include/linux/ide.h
... | ... | @@ -1514,6 +1514,7 @@ |
1514 | 1514 | int ide_scan_pio_blacklist(char *); |
1515 | 1515 | const char *ide_xfer_verbose(u8); |
1516 | 1516 | u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); |
1517 | +int ide_pio_need_iordy(ide_drive_t *, const u8); | |
1517 | 1518 | int ide_set_pio_mode(ide_drive_t *, u8); |
1518 | 1519 | int ide_set_dma_mode(ide_drive_t *, u8); |
1519 | 1520 | void ide_set_pio(ide_drive_t *, u8); |