aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/at91_ide.c3
-rw-r--r--drivers/ide/ide-xfer-mode.c6
-rw-r--r--drivers/ide/it8172.c2
-rw-r--r--drivers/ide/it8213.c2
-rw-r--r--drivers/ide/pdc202xx_old.c2
-rw-r--r--drivers/ide/piix.c2
-rw-r--r--drivers/ide/siimage.c15
-rw-r--r--drivers/ide/sl82c105.c3
-rw-r--r--drivers/ide/slc90e66.c2
-rw-r--r--include/linux/ide.h1
10 files changed, 22 insertions, 16 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index fc0949a8cfde..dbfeda42b940 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -185,8 +185,7 @@ static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
185 timing = ide_timing_find_mode(XFER_PIO_0 + pio); 185 timing = ide_timing_find_mode(XFER_PIO_0 + pio);
186 BUG_ON(!timing); 186 BUG_ON(!timing);
187 187
188 if ((pio > 2 || ata_id_has_iordy(drive->id)) && 188 if (ide_pio_need_iordy(drive, pio))
189 !(ata_id_is_cfa(drive->id) && pio > 4))
190 use_iordy = 1; 189 use_iordy = 1;
191 190
192 apply_timings(chipselect, pio, timing, use_iordy); 191 apply_timings(chipselect, pio, timing, use_iordy);
diff --git a/drivers/ide/ide-xfer-mode.c b/drivers/ide/ide-xfer-mode.c
index af44be9d546c..0b47ca139079 100644
--- a/drivers/ide/ide-xfer-mode.c
+++ b/drivers/ide/ide-xfer-mode.c
@@ -107,6 +107,12 @@ u8 ide_get_best_pio_mode(ide_drive_t *drive, u8 mode_wanted, u8 max_mode)
107} 107}
108EXPORT_SYMBOL_GPL(ide_get_best_pio_mode); 108EXPORT_SYMBOL_GPL(ide_get_best_pio_mode);
109 109
110int ide_pio_need_iordy(ide_drive_t *drive, const u8 pio)
111{
112 return ata_id_pio_need_iordy(drive->id, pio);
113}
114EXPORT_SYMBOL_GPL(ide_pio_need_iordy);
115
110int ide_set_pio_mode(ide_drive_t *drive, const u8 mode) 116int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
111{ 117{
112 ide_hwif_t *hwif = drive->hwif; 118 ide_hwif_t *hwif = drive->hwif;
diff --git a/drivers/ide/it8172.c b/drivers/ide/it8172.c
index e021078cd06b..0d266a5b524d 100644
--- a/drivers/ide/it8172.c
+++ b/drivers/ide/it8172.c
@@ -66,7 +66,7 @@ static void it8172_set_pio_mode(ide_drive_t *drive, const u8 pio)
66 if (drive->media == ide_disk) 66 if (drive->media == ide_disk)
67 /* enable prefetch */ 67 /* enable prefetch */
68 drive_enables |= 0x0004 << (drive->dn * 4); 68 drive_enables |= 0x0004 << (drive->dn * 4);
69 if (ata_id_has_iordy(drive->id)) 69 if (ide_pio_need_iordy(drive, pio))
70 /* enable IORDY sample-point */ 70 /* enable IORDY sample-point */
71 drive_enables |= 0x0002 << (drive->dn * 4); 71 drive_enables |= 0x0002 << (drive->dn * 4);
72 72
diff --git a/drivers/ide/it8213.c b/drivers/ide/it8213.c
index d7969b6d139e..47976167796a 100644
--- a/drivers/ide/it8213.c
+++ b/drivers/ide/it8213.c
@@ -50,7 +50,7 @@ static void it8213_set_pio_mode(ide_drive_t *drive, const u8 pio)
50 control |= 1; /* Programmable timing on */ 50 control |= 1; /* Programmable timing on */
51 if (drive->media != ide_disk) 51 if (drive->media != ide_disk)
52 control |= 4; /* ATAPI */ 52 control |= 4; /* ATAPI */
53 if (pio > 2) 53 if (ide_pio_need_iordy(drive, pio))
54 control |= 2; /* IORDY */ 54 control |= 2; /* IORDY */
55 if (is_slave) { 55 if (is_slave) {
56 master_data |= 0x4000; 56 master_data |= 0x4000;
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index b6abf7e52cac..4f5b536282af 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 */
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
index 69860dea3820..bf14f39bd3a7 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -98,7 +98,7 @@ static void piix_set_pio_mode(ide_drive_t *drive, const u8 pio)
98 control |= 1; /* Programmable timing on */ 98 control |= 1; /* Programmable timing on */
99 if (drive->media == ide_disk) 99 if (drive->media == ide_disk)
100 control |= 4; /* Prefetch, post write */ 100 control |= 4; /* Prefetch, post write */
101 if (pio > 2) 101 if (ide_pio_need_iordy(drive, pio))
102 control |= 2; /* IORDY */ 102 control |= 2; /* IORDY */
103 if (is_slave) { 103 if (is_slave) {
104 master_data |= 0x4000; 104 master_data |= 0x4000;
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c
index bd82d228608c..6a643fdf0e6e 100644
--- a/drivers/ide/siimage.c
+++ b/drivers/ide/siimage.c
@@ -32,7 +32,6 @@
32 * smarter code in libata. 32 * smarter code in libata.
33 * 33 *
34 * TODO: 34 * TODO:
35 * - IORDY fixes
36 * - VDMA support 35 * - VDMA support
37 */ 36 */
38 37
@@ -234,8 +233,7 @@ static u8 sil_sata_udma_filter(ide_drive_t *drive)
234 * @pio: PIO mode number 233 * @pio: PIO mode number
235 * 234 *
236 * Load the timing settings for this device mode into the 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 236 * controller.
238 * monitoring (bit 9). The TF timing is bits 31:16
239 */ 237 */
240 238
241static void sil_set_pio_mode(ide_drive_t *drive, u8 pio) 239static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
@@ -276,13 +274,16 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
276 /* now set up IORDY */ 274 /* now set up IORDY */
277 speedp = sil_ioread16(dev, tfaddr - 2); 275 speedp = sil_ioread16(dev, tfaddr - 2);
278 speedp &= ~0x200; 276 speedp &= ~0x200;
279 if (pio > 2)
280 speedp |= 0x200;
281 sil_iowrite16(dev, speedp, tfaddr - 2);
282 277
283 mode = sil_ioread8(dev, base + addr_mask); 278 mode = sil_ioread8(dev, base + addr_mask);
284 mode &= ~(unit ? 0x30 : 0x03); 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 sil_iowrite8(dev, mode, base + addr_mask); 287 sil_iowrite8(dev, mode, base + addr_mask);
287} 288}
288 289
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index 0924abff52ff..88ac47085cd9 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -61,8 +61,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio)
61 if (cmd_off == 0) 61 if (cmd_off == 0)
62 cmd_off = 1; 62 cmd_off = 1;
63 63
64 if ((pio > 2 || ata_id_has_iordy(drive->id)) && 64 if (ide_pio_need_iordy(drive, pio))
65 !(pio > 4 && ata_id_is_cfa(drive->id)))
66 iordy = 0x40; 65 iordy = 0x40;
67 66
68 return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; 67 return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy;
diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
index f55d7d6313e8..9aec78d3bcff 100644
--- a/drivers/ide/slc90e66.c
+++ b/drivers/ide/slc90e66.c
@@ -44,7 +44,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
44 control |= 1; /* Programmable timing on */ 44 control |= 1; /* Programmable timing on */
45 if (drive->media == ide_disk) 45 if (drive->media == ide_disk)
46 control |= 4; /* Prefetch, post write */ 46 control |= 4; /* Prefetch, post write */
47 if (pio > 2) 47 if (ide_pio_need_iordy(drive, pio))
48 control |= 2; /* IORDY */ 48 control |= 2; /* IORDY */
49 if (is_slave) { 49 if (is_slave) {
50 master_data |= 0x4000; 50 master_data |= 0x4000;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index cdb29b6c195f..8c7f5e50e912 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1514,6 +1514,7 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1514int ide_scan_pio_blacklist(char *); 1514int ide_scan_pio_blacklist(char *);
1515const char *ide_xfer_verbose(u8); 1515const char *ide_xfer_verbose(u8);
1516u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1516u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1517int ide_pio_need_iordy(ide_drive_t *, const u8);
1517int ide_set_pio_mode(ide_drive_t *, u8); 1518int ide_set_pio_mode(ide_drive_t *, u8);
1518int ide_set_dma_mode(ide_drive_t *, u8); 1519int ide_set_dma_mode(ide_drive_t *, u8);
1519void ide_set_pio(ide_drive_t *, u8); 1520void ide_set_pio(ide_drive_t *, u8);