diff options
Diffstat (limited to 'drivers/ide')
31 files changed, 58 insertions, 121 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 28f910b5aa5d..99a27f2dc03a 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -248,15 +248,10 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq) | |||
248 | * MW1 80 50 50 150 C | 248 | * MW1 80 50 50 150 C |
249 | * MW2 70 25 25 120 C | 249 | * MW2 70 25 25 120 C |
250 | */ | 250 | */ |
251 | static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode) | 251 | static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode) |
252 | { | 252 | { |
253 | int on = 0, cycle_time = 0, use_dma_info = 0; | 253 | int on = 0, cycle_time = 0, use_dma_info = 0; |
254 | 254 | ||
255 | /* | ||
256 | * Limit the transfer speed to MW_DMA_2. | ||
257 | */ | ||
258 | xfer_mode = ide_rate_filter(drive, xfer_mode); | ||
259 | |||
260 | switch (xfer_mode) { | 255 | switch (xfer_mode) { |
261 | case XFER_MW_DMA_2: | 256 | case XFER_MW_DMA_2: |
262 | cycle_time = 250; | 257 | cycle_time = 250; |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index e08782ac88e0..67cec8916fcd 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -722,12 +722,10 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio) | |||
722 | (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); | 722 | (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
723 | } | 723 | } |
724 | 724 | ||
725 | static int speed_cris_ide(ide_drive_t *drive, u8 speed) | 725 | static int speed_cris_ide(ide_drive_t *drive, const u8 speed) |
726 | { | 726 | { |
727 | int cyc = 0, dvs = 0, strobe = 0, hold = 0; | 727 | int cyc = 0, dvs = 0, strobe = 0, hold = 0; |
728 | 728 | ||
729 | speed = ide_rate_filter(drive, speed); | ||
730 | |||
731 | if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { | 729 | if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { |
732 | tune_cris_ide(drive, speed - XFER_PIO_0); | 730 | tune_cris_ide(drive, speed - XFER_PIO_0); |
733 | return ide_config_drive_speed(drive, speed); | 731 | return ide_config_drive_speed(drive, speed); |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 41a128f52112..957618849540 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -79,7 +79,7 @@ EXPORT_SYMBOL(ide_xfer_verbose); | |||
79 | * TODO: check device PIO capabilities | 79 | * TODO: check device PIO capabilities |
80 | */ | 80 | */ |
81 | 81 | ||
82 | u8 ide_rate_filter(ide_drive_t *drive, u8 speed) | 82 | static u8 ide_rate_filter(ide_drive_t *drive, u8 speed) |
83 | { | 83 | { |
84 | ide_hwif_t *hwif = drive->hwif; | 84 | ide_hwif_t *hwif = drive->hwif; |
85 | u8 mode = ide_find_dma_mode(drive, speed); | 85 | u8 mode = ide_find_dma_mode(drive, speed); |
@@ -96,8 +96,6 @@ u8 ide_rate_filter(ide_drive_t *drive, u8 speed) | |||
96 | return min(speed, mode); | 96 | return min(speed, mode); |
97 | } | 97 | } |
98 | 98 | ||
99 | EXPORT_SYMBOL(ide_rate_filter); | ||
100 | |||
101 | int ide_use_fast_pio(ide_drive_t *drive) | 99 | int ide_use_fast_pio(ide_drive_t *drive) |
102 | { | 100 | { |
103 | struct hd_driveid *id = drive->id; | 101 | struct hd_driveid *id = drive->id; |
@@ -364,13 +362,14 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) | |||
364 | 362 | ||
365 | int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) | 363 | int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) |
366 | { | 364 | { |
367 | #ifndef CONFIG_BLK_DEV_IDEDMA | 365 | ide_hwif_t *hwif = drive->hwif; |
368 | rate = min(rate, (u8) XFER_PIO_4); | 366 | |
369 | #endif | 367 | if (hwif->speedproc == NULL) |
370 | if(HWIF(drive)->speedproc) | ||
371 | return HWIF(drive)->speedproc(drive, rate); | ||
372 | else | ||
373 | return -1; | 368 | return -1; |
369 | |||
370 | rate = ide_rate_filter(drive, rate); | ||
371 | |||
372 | return hwif->speedproc(drive, rate); | ||
374 | } | 373 | } |
375 | 374 | ||
376 | static void ide_dump_opcode(ide_drive_t *drive) | 375 | static void ide_dump_opcode(ide_drive_t *drive) |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index 0d5e4c67fa54..b04db9ff1938 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
@@ -175,13 +175,11 @@ static void auide_tune_drive(ide_drive_t *drive, byte pio) | |||
175 | ide_config_drive_speed(drive, speed); | 175 | ide_config_drive_speed(drive, speed); |
176 | } | 176 | } |
177 | 177 | ||
178 | static int auide_tune_chipset (ide_drive_t *drive, u8 speed) | 178 | static int auide_tune_chipset(ide_drive_t *drive, const u8 speed) |
179 | { | 179 | { |
180 | int mem_sttime; | 180 | int mem_sttime; |
181 | int mem_stcfg; | 181 | int mem_stcfg; |
182 | 182 | ||
183 | speed = ide_rate_filter(drive, speed); | ||
184 | |||
185 | mem_sttime = 0; | 183 | mem_sttime = 0; |
186 | mem_stcfg = au_readl(MEM_STCFG2); | 184 | mem_stcfg = au_readl(MEM_STCFG2); |
187 | 185 | ||
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 74432830abf7..a827ea2ab989 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -87,12 +87,11 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr | |||
87 | return chipset_table->ultra_settings; | 87 | return chipset_table->ultra_settings; |
88 | } | 88 | } |
89 | 89 | ||
90 | static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 90 | static int aec6210_tune_chipset(ide_drive_t *drive, const u8 speed) |
91 | { | 91 | { |
92 | ide_hwif_t *hwif = HWIF(drive); | 92 | ide_hwif_t *hwif = HWIF(drive); |
93 | struct pci_dev *dev = hwif->pci_dev; | 93 | struct pci_dev *dev = hwif->pci_dev; |
94 | u16 d_conf = 0; | 94 | u16 d_conf = 0; |
95 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
96 | u8 ultra = 0, ultra_conf = 0; | 95 | u8 ultra = 0, ultra_conf = 0; |
97 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 96 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
98 | unsigned long flags; | 97 | unsigned long flags; |
@@ -115,11 +114,10 @@ static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
115 | return(ide_config_drive_speed(drive, speed)); | 114 | return(ide_config_drive_speed(drive, speed)); |
116 | } | 115 | } |
117 | 116 | ||
118 | static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 117 | static int aec6260_tune_chipset(ide_drive_t *drive, const u8 speed) |
119 | { | 118 | { |
120 | ide_hwif_t *hwif = HWIF(drive); | 119 | ide_hwif_t *hwif = HWIF(drive); |
121 | struct pci_dev *dev = hwif->pci_dev; | 120 | struct pci_dev *dev = hwif->pci_dev; |
122 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
123 | u8 unit = (drive->select.b.unit & 0x01); | 121 | u8 unit = (drive->select.b.unit & 0x01); |
124 | u8 tmp1 = 0, tmp2 = 0; | 122 | u8 tmp1 = 0, tmp2 = 0; |
125 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 123 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 11ecb618007c..37ecd726aa40 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -409,17 +409,16 @@ static u8 ali_udma_filter(ide_drive_t *drive) | |||
409 | /** | 409 | /** |
410 | * ali15x3_tune_chipset - set up chipset/drive for new speed | 410 | * ali15x3_tune_chipset - set up chipset/drive for new speed |
411 | * @drive: drive to configure for | 411 | * @drive: drive to configure for |
412 | * @xferspeed: desired speed | 412 | * @speed: desired speed |
413 | * | 413 | * |
414 | * Configure the hardware for the desired IDE transfer mode. | 414 | * Configure the hardware for the desired IDE transfer mode. |
415 | * We also do the needed drive configuration through helpers | 415 | * We also do the needed drive configuration through helpers |
416 | */ | 416 | */ |
417 | 417 | ||
418 | static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 418 | static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed) |
419 | { | 419 | { |
420 | ide_hwif_t *hwif = HWIF(drive); | 420 | ide_hwif_t *hwif = HWIF(drive); |
421 | struct pci_dev *dev = hwif->pci_dev; | 421 | struct pci_dev *dev = hwif->pci_dev; |
422 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
423 | u8 speed1 = speed; | 422 | u8 speed1 = speed; |
424 | u8 unit = (drive->select.b.unit & 0x01); | 423 | u8 unit = (drive->select.b.unit & 0x01); |
425 | u8 tmpbyte = 0x00; | 424 | u8 tmpbyte = 0x00; |
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 3c0bb1e79514..9abbde3c7984 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -234,14 +234,12 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timi | |||
234 | * by upper layers. | 234 | * by upper layers. |
235 | */ | 235 | */ |
236 | 236 | ||
237 | static int amd_set_drive(ide_drive_t *drive, u8 speed) | 237 | static int amd_set_drive(ide_drive_t *drive, const u8 speed) |
238 | { | 238 | { |
239 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 239 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); |
240 | struct ide_timing t, p; | 240 | struct ide_timing t, p; |
241 | int T, UT; | 241 | int T, UT; |
242 | 242 | ||
243 | speed = ide_rate_filter(drive, speed); | ||
244 | |||
245 | if (speed != XFER_PIO_SLOW) | 243 | if (speed != XFER_PIO_SLOW) |
246 | ide_config_drive_speed(drive, speed); | 244 | ide_config_drive_speed(drive, speed); |
247 | 245 | ||
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 679eb92b8920..e05e88298500 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c | |||
@@ -163,23 +163,21 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) | |||
163 | /** | 163 | /** |
164 | * atiixp_tune_chipset - tune a ATIIXP interface | 164 | * atiixp_tune_chipset - tune a ATIIXP interface |
165 | * @drive: IDE drive to tune | 165 | * @drive: IDE drive to tune |
166 | * @xferspeed: speed to configure | 166 | * @speed: speed to configure |
167 | * | 167 | * |
168 | * Set a ATIIXP interface channel to the desired speeds. This involves | 168 | * Set a ATIIXP interface channel to the desired speeds. This involves |
169 | * requires the right timing data into the ATIIXP configuration space | 169 | * requires the right timing data into the ATIIXP configuration space |
170 | * then setting the drive parameters appropriately | 170 | * then setting the drive parameters appropriately |
171 | */ | 171 | */ |
172 | 172 | ||
173 | static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed) | 173 | static int atiixp_speedproc(ide_drive_t *drive, const u8 speed) |
174 | { | 174 | { |
175 | struct pci_dev *dev = drive->hwif->pci_dev; | 175 | struct pci_dev *dev = drive->hwif->pci_dev; |
176 | unsigned long flags; | 176 | unsigned long flags; |
177 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 177 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; |
178 | u32 tmp32; | 178 | u32 tmp32; |
179 | u16 tmp16; | 179 | u16 tmp16; |
180 | u8 speed, pio; | 180 | u8 pio; |
181 | |||
182 | speed = ide_rate_filter(drive, xferspeed); | ||
183 | 181 | ||
184 | if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { | 182 | if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { |
185 | atiixp_tune_pio(drive, speed - XFER_PIO_0); | 183 | atiixp_tune_pio(drive, speed - XFER_PIO_0); |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 0e3b5de26e69..5fe50a234ce1 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -288,15 +288,13 @@ static void cmd64x_tune_drive (ide_drive_t *drive, u8 pio) | |||
288 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | 288 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
289 | } | 289 | } |
290 | 290 | ||
291 | static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed) | 291 | static int cmd64x_tune_chipset(ide_drive_t *drive, const u8 speed) |
292 | { | 292 | { |
293 | ide_hwif_t *hwif = HWIF(drive); | 293 | ide_hwif_t *hwif = HWIF(drive); |
294 | struct pci_dev *dev = hwif->pci_dev; | 294 | struct pci_dev *dev = hwif->pci_dev; |
295 | u8 unit = drive->dn & 0x01; | 295 | u8 unit = drive->dn & 0x01; |
296 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; | 296 | u8 regU = 0, pciU = hwif->channel ? UDIDETCR1 : UDIDETCR0; |
297 | 297 | ||
298 | speed = ide_rate_filter(drive, speed); | ||
299 | |||
300 | if (speed >= XFER_SW_DMA_0) { | 298 | if (speed >= XFER_SW_DMA_0) { |
301 | (void) pci_read_config_byte(dev, pciU, ®U); | 299 | (void) pci_read_config_byte(dev, pciU, ®U); |
302 | regU &= ~(unit ? 0xCA : 0x35); | 300 | regU &= ~(unit ? 0xCA : 0x35); |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 507981042c82..af67438328a8 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -66,16 +66,15 @@ static struct pio_clocks cs5520_pio_clocks[]={ | |||
66 | {1, 2, 1} | 66 | {1, 2, 1} |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static int cs5520_tune_chipset(ide_drive_t *drive, u8 xferspeed) | 69 | static int cs5520_tune_chipset(ide_drive_t *drive, const u8 speed) |
70 | { | 70 | { |
71 | ide_hwif_t *hwif = HWIF(drive); | 71 | ide_hwif_t *hwif = HWIF(drive); |
72 | struct pci_dev *pdev = hwif->pci_dev; | 72 | struct pci_dev *pdev = hwif->pci_dev; |
73 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
74 | int pio = speed; | 73 | int pio = speed; |
75 | u8 reg; | 74 | u8 reg; |
76 | int controller = drive->dn > 1 ? 1 : 0; | 75 | int controller = drive->dn > 1 ? 1 : 0; |
77 | int error; | 76 | int error; |
78 | 77 | ||
79 | switch(speed) | 78 | switch(speed) |
80 | { | 79 | { |
81 | case XFER_PIO_4: | 80 | case XFER_PIO_4: |
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index e5949b1d3fb0..518f430c1529 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c | |||
@@ -143,13 +143,11 @@ static int cs5530_config_dma(ide_drive_t *drive) | |||
143 | return 1; | 143 | return 1; |
144 | } | 144 | } |
145 | 145 | ||
146 | static int cs5530_tune_chipset(ide_drive_t *drive, u8 mode) | 146 | static int cs5530_tune_chipset(ide_drive_t *drive, const u8 mode) |
147 | { | 147 | { |
148 | unsigned long basereg; | 148 | unsigned long basereg; |
149 | unsigned int reg, timings = 0; | 149 | unsigned int reg, timings = 0; |
150 | 150 | ||
151 | mode = ide_rate_filter(drive, mode); | ||
152 | |||
153 | /* | 151 | /* |
154 | * Tell the drive to switch to the new mode; abort on failure. | 152 | * Tell the drive to switch to the new mode; abort on failure. |
155 | */ | 153 | */ |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 082ca7da2cbc..bc00e7b62151 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -75,7 +75,7 @@ static unsigned int cs5535_udma_timings[5] = | |||
75 | * | 75 | * |
76 | * cs5535_set_speed() configures the chipset to a new speed. | 76 | * cs5535_set_speed() configures the chipset to a new speed. |
77 | */ | 77 | */ |
78 | static void cs5535_set_speed(ide_drive_t *drive, u8 speed) | 78 | static void cs5535_set_speed(ide_drive_t *drive, const u8 speed) |
79 | { | 79 | { |
80 | 80 | ||
81 | u32 reg = 0, dummy; | 81 | u32 reg = 0, dummy; |
@@ -141,7 +141,6 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed) | |||
141 | */ | 141 | */ |
142 | static int cs5535_set_drive(ide_drive_t *drive, u8 speed) | 142 | static int cs5535_set_drive(ide_drive_t *drive, u8 speed) |
143 | { | 143 | { |
144 | speed = ide_rate_filter(drive, speed); | ||
145 | ide_config_drive_speed(drive, speed); | 144 | ide_config_drive_speed(drive, speed); |
146 | cs5535_set_speed(drive, speed); | 145 | cs5535_set_speed(drive, speed); |
147 | 146 | ||
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index cb8fe5643d3b..ba982d66ff73 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -43,10 +43,9 @@ | |||
43 | 43 | ||
44 | #define HPT343_DEBUG_DRIVE_INFO 0 | 44 | #define HPT343_DEBUG_DRIVE_INFO 0 |
45 | 45 | ||
46 | static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 46 | static int hpt34x_tune_chipset(ide_drive_t *drive, const u8 speed) |
47 | { | 47 | { |
48 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 48 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
49 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
50 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; | 49 | u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0; |
51 | u8 hi_speed, lo_speed; | 50 | u8 hi_speed, lo_speed; |
52 | 51 | ||
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 18c8ad091eb3..67127ac3a14a 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -600,12 +600,11 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
600 | return (*info->settings)[i]; | 600 | return (*info->settings)[i]; |
601 | } | 601 | } |
602 | 602 | ||
603 | static int hpt36x_tune_chipset(ide_drive_t *drive, u8 xferspeed) | 603 | static int hpt36x_tune_chipset(ide_drive_t *drive, const u8 speed) |
604 | { | 604 | { |
605 | ide_hwif_t *hwif = HWIF(drive); | 605 | ide_hwif_t *hwif = HWIF(drive); |
606 | struct pci_dev *dev = hwif->pci_dev; | 606 | struct pci_dev *dev = hwif->pci_dev; |
607 | struct hpt_info *info = pci_get_drvdata(dev); | 607 | struct hpt_info *info = pci_get_drvdata(dev); |
608 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
609 | u8 itr_addr = drive->dn ? 0x44 : 0x40; | 608 | u8 itr_addr = drive->dn ? 0x44 : 0x40; |
610 | u32 old_itr = 0; | 609 | u32 old_itr = 0; |
611 | u32 itr_mask, new_itr; | 610 | u32 itr_mask, new_itr; |
@@ -628,12 +627,11 @@ static int hpt36x_tune_chipset(ide_drive_t *drive, u8 xferspeed) | |||
628 | return ide_config_drive_speed(drive, speed); | 627 | return ide_config_drive_speed(drive, speed); |
629 | } | 628 | } |
630 | 629 | ||
631 | static int hpt37x_tune_chipset(ide_drive_t *drive, u8 xferspeed) | 630 | static int hpt37x_tune_chipset(ide_drive_t *drive, const u8 speed) |
632 | { | 631 | { |
633 | ide_hwif_t *hwif = HWIF(drive); | 632 | ide_hwif_t *hwif = HWIF(drive); |
634 | struct pci_dev *dev = hwif->pci_dev; | 633 | struct pci_dev *dev = hwif->pci_dev; |
635 | struct hpt_info *info = pci_get_drvdata(dev); | 634 | struct hpt_info *info = pci_get_drvdata(dev); |
636 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
637 | u8 itr_addr = 0x40 + (drive->dn * 4); | 635 | u8 itr_addr = 0x40 + (drive->dn * 4); |
638 | u32 old_itr = 0; | 636 | u32 old_itr = 0; |
639 | u32 itr_mask, new_itr; | 637 | u32 itr_mask, new_itr; |
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c index 70b3245dbf62..6fa955749aec 100644 --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c | |||
@@ -115,20 +115,16 @@ static void it8213_tuneproc(ide_drive_t *drive, u8 pio) | |||
115 | /** | 115 | /** |
116 | * it8213_tune_chipset - set controller timings | 116 | * it8213_tune_chipset - set controller timings |
117 | * @drive: Drive to set up | 117 | * @drive: Drive to set up |
118 | * @xferspeed: speed we want to achieve | 118 | * @speed: speed we want to achieve |
119 | * | 119 | * |
120 | * Tune the ITE chipset for the desired mode. If we can't achieve | 120 | * Tune the ITE chipset for the desired mode. |
121 | * the desired mode then tune for a lower one, but ultimately | ||
122 | * make the thing work. | ||
123 | */ | 121 | */ |
124 | 122 | ||
125 | static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 123 | static int it8213_tune_chipset(ide_drive_t *drive, const u8 speed) |
126 | { | 124 | { |
127 | |||
128 | ide_hwif_t *hwif = HWIF(drive); | 125 | ide_hwif_t *hwif = HWIF(drive); |
129 | struct pci_dev *dev = hwif->pci_dev; | 126 | struct pci_dev *dev = hwif->pci_dev; |
130 | u8 maslave = 0x40; | 127 | u8 maslave = 0x40; |
131 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
132 | int a_speed = 3 << (drive->dn * 4); | 128 | int a_speed = 3 << (drive->dn * 4); |
133 | int u_flag = 1 << drive->dn; | 129 | int u_flag = 1 << drive->dn; |
134 | int v_flag = 0x01 << drive->dn; | 130 | int v_flag = 0x01 << drive->dn; |
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 9286c99e2ff0..a756e61bcb32 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c | |||
@@ -405,23 +405,19 @@ static int it821x_dma_end(ide_drive_t *drive) | |||
405 | return ret; | 405 | return ret; |
406 | } | 406 | } |
407 | 407 | ||
408 | |||
409 | /** | 408 | /** |
410 | * it821x_tune_chipset - set controller timings | 409 | * it821x_tune_chipset - set controller timings |
411 | * @drive: Drive to set up | 410 | * @drive: Drive to set up |
412 | * @xferspeed: speed we want to achieve | 411 | * @speed: speed we want to achieve |
413 | * | 412 | * |
414 | * Tune the ITE chipset for the desired mode. If we can't achieve | 413 | * Tune the ITE chipset for the desired mode. |
415 | * the desired mode then tune for a lower one, but ultimately | ||
416 | * make the thing work. | ||
417 | */ | 414 | */ |
418 | 415 | ||
419 | static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) | 416 | static int it821x_tune_chipset(ide_drive_t *drive, const u8 speed) |
420 | { | 417 | { |
421 | 418 | ||
422 | ide_hwif_t *hwif = drive->hwif; | 419 | ide_hwif_t *hwif = drive->hwif; |
423 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); | 420 | struct it821x_dev *itdev = ide_get_hwifdata(hwif); |
424 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
425 | 421 | ||
426 | switch (speed) { | 422 | switch (speed) { |
427 | case XFER_PIO_4: | 423 | case XFER_PIO_4: |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 17490d255758..7bac87fb481a 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
@@ -92,17 +92,14 @@ static void jmicron_tuneproc(ide_drive_t *drive, u8 pio) | |||
92 | /** | 92 | /** |
93 | * jmicron_tune_chipset - set controller timings | 93 | * jmicron_tune_chipset - set controller timings |
94 | * @drive: Drive to set up | 94 | * @drive: Drive to set up |
95 | * @xferspeed: speed we want to achieve | 95 | * @speed: speed we want to achieve |
96 | * | 96 | * |
97 | * As the JMicron snoops for timings all we actually need to do is | 97 | * As the JMicron snoops for timings all we actually need to do is |
98 | * make sure we don't set an invalid mode. We do need to honour | 98 | * set the transfer mode on the device. |
99 | * the cable detect here. | ||
100 | */ | 99 | */ |
101 | 100 | ||
102 | static int jmicron_tune_chipset (ide_drive_t *drive, byte xferspeed) | 101 | static int jmicron_tune_chipset(ide_drive_t *drive, const u8 speed) |
103 | { | 102 | { |
104 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
105 | |||
106 | return ide_config_drive_speed(drive, speed); | 103 | return ide_config_drive_speed(drive, speed); |
107 | } | 104 | } |
108 | 105 | ||
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 7c5544d10b9a..3787194a2249 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -146,14 +146,12 @@ static struct udma_timing { | |||
146 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ | 146 | { 0x1a, 0x01, 0xcb }, /* UDMA mode 6 */ |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed) | 149 | static int pdcnew_tune_chipset(ide_drive_t *drive, const u8 speed) |
150 | { | 150 | { |
151 | ide_hwif_t *hwif = HWIF(drive); | 151 | ide_hwif_t *hwif = HWIF(drive); |
152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; | 152 | u8 adj = (drive->dn & 1) ? 0x08 : 0x00; |
153 | int err; | 153 | int err; |
154 | 154 | ||
155 | speed = ide_rate_filter(drive, speed); | ||
156 | |||
157 | /* | 155 | /* |
158 | * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will | 156 | * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will |
159 | * automatically set the timing registers based on 100 MHz PLL output. | 157 | * automatically set the timing registers based on 100 MHz PLL output. |
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index e19a891171cb..e7a5e3014c09 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c | |||
@@ -63,12 +63,11 @@ static const char *pdc_quirk_drives[] = { | |||
63 | 63 | ||
64 | static void pdc_old_disable_66MHz_clock(ide_hwif_t *); | 64 | static void pdc_old_disable_66MHz_clock(ide_hwif_t *); |
65 | 65 | ||
66 | static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 66 | static int pdc202xx_tune_chipset(ide_drive_t *drive, const u8 speed) |
67 | { | 67 | { |
68 | ide_hwif_t *hwif = HWIF(drive); | 68 | ide_hwif_t *hwif = HWIF(drive); |
69 | struct pci_dev *dev = hwif->pci_dev; | 69 | struct pci_dev *dev = hwif->pci_dev; |
70 | u8 drive_pci = 0x60 + (drive->dn << 2); | 70 | u8 drive_pci = 0x60 + (drive->dn << 2); |
71 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
72 | 71 | ||
73 | u8 AP = 0, BP = 0, CP = 0; | 72 | u8 AP = 0, BP = 0, CP = 0; |
74 | u8 TA = 0, TB = 0, TC = 0; | 73 | u8 TA = 0, TB = 0, TC = 0; |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 5cfa9378bbb8..b66f9d1411b3 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -221,19 +221,18 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio) | |||
221 | /** | 221 | /** |
222 | * piix_tune_chipset - tune a PIIX interface | 222 | * piix_tune_chipset - tune a PIIX interface |
223 | * @drive: IDE drive to tune | 223 | * @drive: IDE drive to tune |
224 | * @xferspeed: speed to configure | 224 | * @speed: speed to configure |
225 | * | 225 | * |
226 | * Set a PIIX interface channel to the desired speeds. This involves | 226 | * Set a PIIX interface channel to the desired speeds. This involves |
227 | * requires the right timing data into the PIIX configuration space | 227 | * requires the right timing data into the PIIX configuration space |
228 | * then setting the drive parameters appropriately | 228 | * then setting the drive parameters appropriately |
229 | */ | 229 | */ |
230 | 230 | ||
231 | static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 231 | static int piix_tune_chipset(ide_drive_t *drive, const u8 speed) |
232 | { | 232 | { |
233 | ide_hwif_t *hwif = HWIF(drive); | 233 | ide_hwif_t *hwif = HWIF(drive); |
234 | struct pci_dev *dev = hwif->pci_dev; | 234 | struct pci_dev *dev = hwif->pci_dev; |
235 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 235 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
236 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
237 | int a_speed = 3 << (drive->dn * 4); | 236 | int a_speed = 3 << (drive->dn * 4); |
238 | int u_flag = 1 << drive->dn; | 237 | int u_flag = 1 << drive->dn; |
239 | int v_flag = 0x01 << drive->dn; | 238 | int v_flag = 0x01 << drive->dn; |
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 9bdc9694d50d..059071cd2d49 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -138,7 +138,7 @@ out: | |||
138 | return mask; | 138 | return mask; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode) | 141 | static int sc1200_tune_chipset(ide_drive_t *drive, const u8 mode) |
142 | { | 142 | { |
143 | ide_hwif_t *hwif = HWIF(drive); | 143 | ide_hwif_t *hwif = HWIF(drive); |
144 | int unit = drive->select.b.unit; | 144 | int unit = drive->select.b.unit; |
@@ -146,8 +146,6 @@ static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode) | |||
146 | unsigned short pci_clock; | 146 | unsigned short pci_clock; |
147 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; | 147 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; |
148 | 148 | ||
149 | mode = ide_rate_filter(drive, mode); | ||
150 | |||
151 | /* | 149 | /* |
152 | * Tell the drive to switch to the new mode; abort on failure. | 150 | * Tell the drive to switch to the new mode; abort on failure. |
153 | */ | 151 | */ |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index eeb0a6d434aa..a19687caf65a 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -231,16 +231,15 @@ static void scc_tuneproc(ide_drive_t *drive, u8 pio) | |||
231 | /** | 231 | /** |
232 | * scc_tune_chipset - tune a drive DMA mode | 232 | * scc_tune_chipset - tune a drive DMA mode |
233 | * @drive: Drive to set up | 233 | * @drive: Drive to set up |
234 | * @xferspeed: speed we want to achieve | 234 | * @speed: speed we want to achieve |
235 | * | 235 | * |
236 | * Load the timing settings for this device mode into the | 236 | * Load the timing settings for this device mode into the |
237 | * controller. | 237 | * controller. |
238 | */ | 238 | */ |
239 | 239 | ||
240 | static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed) | 240 | static int scc_tune_chipset(ide_drive_t *drive, const u8 speed) |
241 | { | 241 | { |
242 | ide_hwif_t *hwif = HWIF(drive); | 242 | ide_hwif_t *hwif = HWIF(drive); |
243 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
244 | struct scc_ports *ports = ide_get_hwifdata(hwif); | 243 | struct scc_ports *ports = ide_get_hwifdata(hwif); |
245 | unsigned long ctl_base = ports->ctl; | 244 | unsigned long ctl_base = ports->ctl; |
246 | unsigned long cckctrl_port = ctl_base + 0xff0; | 245 | unsigned long cckctrl_port = ctl_base + 0xff0; |
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 9fead2e7d4c8..b51133bb58af 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c | |||
@@ -145,7 +145,7 @@ static void svwks_tune_pio(ide_drive_t *drive, const u8 pio) | |||
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 148 | static int svwks_tune_chipset(ide_drive_t *drive, const u8 speed) |
149 | { | 149 | { |
150 | static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; | 150 | static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; |
151 | static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; | 151 | static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; |
@@ -153,7 +153,6 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
153 | 153 | ||
154 | ide_hwif_t *hwif = HWIF(drive); | 154 | ide_hwif_t *hwif = HWIF(drive); |
155 | struct pci_dev *dev = hwif->pci_dev; | 155 | struct pci_dev *dev = hwif->pci_dev; |
156 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
157 | u8 unit = (drive->select.b.unit & 0x01); | 156 | u8 unit = (drive->select.b.unit & 0x01); |
158 | 157 | ||
159 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; | 158 | u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 50f6d172ef77..4c1f3bc7e179 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -229,14 +229,12 @@ static void sil_tuneproc(ide_drive_t *drive, u8 pio) | |||
229 | /** | 229 | /** |
230 | * siimage_tune_chipset - set controller timings | 230 | * siimage_tune_chipset - set controller timings |
231 | * @drive: Drive to set up | 231 | * @drive: Drive to set up |
232 | * @xferspeed: speed we want to achieve | 232 | * @speed: speed we want to achieve |
233 | * | 233 | * |
234 | * Tune the SII chipset for the desired mode. If we can't achieve | 234 | * Tune the SII chipset for the desired mode. |
235 | * the desired mode then tune for a lower one, but ultimately | ||
236 | * make the thing work. | ||
237 | */ | 235 | */ |
238 | 236 | ||
239 | static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed) | 237 | static int siimage_tune_chipset(ide_drive_t *drive, const u8 speed) |
240 | { | 238 | { |
241 | u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; | 239 | u8 ultra6[] = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 }; |
242 | u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; | 240 | u8 ultra5[] = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 }; |
@@ -245,7 +243,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed) | |||
245 | ide_hwif_t *hwif = HWIF(drive); | 243 | ide_hwif_t *hwif = HWIF(drive); |
246 | u16 ultra = 0, multi = 0; | 244 | u16 ultra = 0, multi = 0; |
247 | u8 mode = 0, unit = drive->select.b.unit; | 245 | u8 mode = 0, unit = drive->select.b.unit; |
248 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
249 | unsigned long base = (unsigned long)hwif->hwif_data; | 246 | unsigned long base = (unsigned long)hwif->hwif_data; |
250 | u8 scsc = 0, addr_mask = ((hwif->channel) ? | 247 | u8 scsc = 0, addr_mask = ((hwif->channel) ? |
251 | ((hwif->mmio) ? 0xF4 : 0x84) : | 248 | ((hwif->mmio) ? 0xF4 : 0x84) : |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 1da037f1394e..fed582b4b32f 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -531,15 +531,12 @@ static void sis5513_tuneproc(ide_drive_t *drive, u8 pio) | |||
531 | (void)sis5513_tune_drive(drive, pio); | 531 | (void)sis5513_tune_drive(drive, pio); |
532 | } | 532 | } |
533 | 533 | ||
534 | static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 534 | static int sis5513_tune_chipset(ide_drive_t *drive, const u8 speed) |
535 | { | 535 | { |
536 | ide_hwif_t *hwif = HWIF(drive); | 536 | ide_hwif_t *hwif = HWIF(drive); |
537 | struct pci_dev *dev = hwif->pci_dev; | 537 | struct pci_dev *dev = hwif->pci_dev; |
538 | |||
539 | u8 drive_pci, reg, speed; | ||
540 | u32 regdw; | 538 | u32 regdw; |
541 | 539 | u8 drive_pci, reg; | |
542 | speed = ide_rate_filter(drive, xferspeed); | ||
543 | 540 | ||
544 | /* See config_art_rwp_pio for drive pci config registers */ | 541 | /* See config_art_rwp_pio for drive pci config registers */ |
545 | drive_pci = 0x40; | 542 | drive_pci = 0x40; |
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 0947cab00595..9f425b0b5721 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c | |||
@@ -113,7 +113,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio) | |||
113 | /* | 113 | /* |
114 | * Configure the drive and chipset for a new transfer speed. | 114 | * Configure the drive and chipset for a new transfer speed. |
115 | */ | 115 | */ |
116 | static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed) | 116 | static int sl82c105_tune_chipset(ide_drive_t *drive, const u8 speed) |
117 | { | 117 | { |
118 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; | 118 | static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200}; |
119 | u16 drv_ctrl; | 119 | u16 drv_ctrl; |
@@ -121,8 +121,6 @@ static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed) | |||
121 | DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", | 121 | DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n", |
122 | drive->name, ide_xfer_verbose(speed))); | 122 | drive->name, ide_xfer_verbose(speed))); |
123 | 123 | ||
124 | speed = ide_rate_filter(drive, speed); | ||
125 | |||
126 | switch (speed) { | 124 | switch (speed) { |
127 | case XFER_MW_DMA_2: | 125 | case XFER_MW_DMA_2: |
128 | case XFER_MW_DMA_1: | 126 | case XFER_MW_DMA_1: |
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 628b0664f576..cc9353565070 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -102,12 +102,11 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) | |||
102 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); | 102 | (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 105 | static int slc90e66_tune_chipset(ide_drive_t *drive, const u8 speed) |
106 | { | 106 | { |
107 | ide_hwif_t *hwif = HWIF(drive); | 107 | ide_hwif_t *hwif = HWIF(drive); |
108 | struct pci_dev *dev = hwif->pci_dev; | 108 | struct pci_dev *dev = hwif->pci_dev; |
109 | u8 maslave = hwif->channel ? 0x42 : 0x40; | 109 | u8 maslave = hwif->channel ? 0x42 : 0x40; |
110 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
111 | int sitre = 0, a_speed = 7 << (drive->dn * 4); | 110 | int sitre = 0, a_speed = 7 << (drive->dn * 4); |
112 | int u_speed = 0, u_flag = 1 << drive->dn; | 111 | int u_speed = 0, u_flag = 1 << drive->dn; |
113 | u16 reg4042, reg44, reg48, reg4a; | 112 | u16 reg4042, reg44, reg48, reg4a; |
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c index ec79bacc30c2..e5425772622f 100644 --- a/drivers/ide/pci/tc86c001.c +++ b/drivers/ide/pci/tc86c001.c | |||
@@ -13,14 +13,12 @@ | |||
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/ide.h> | 14 | #include <linux/ide.h> |
15 | 15 | ||
16 | static int tc86c001_tune_chipset(ide_drive_t *drive, u8 speed) | 16 | static int tc86c001_tune_chipset(ide_drive_t *drive, const u8 speed) |
17 | { | 17 | { |
18 | ide_hwif_t *hwif = HWIF(drive); | 18 | ide_hwif_t *hwif = HWIF(drive); |
19 | unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00); | 19 | unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00); |
20 | u16 mode, scr = hwif->INW(scr_port); | 20 | u16 mode, scr = hwif->INW(scr_port); |
21 | 21 | ||
22 | speed = ide_rate_filter(drive, speed); | ||
23 | |||
24 | switch (speed) { | 22 | switch (speed) { |
25 | case XFER_UDMA_4: mode = 0x00c0; break; | 23 | case XFER_UDMA_4: mode = 0x00c0; break; |
26 | case XFER_UDMA_3: mode = 0x00b0; break; | 24 | case XFER_UDMA_3: mode = 0x00b0; break; |
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index 098692a6d615..47cf89be4dfc 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/ide.h> | 40 | #include <linux/ide.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | 42 | ||
43 | static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed) | 43 | static int triflex_tune_chipset(ide_drive_t *drive, const u8 speed) |
44 | { | 44 | { |
45 | ide_hwif_t *hwif = HWIF(drive); | 45 | ide_hwif_t *hwif = HWIF(drive); |
46 | struct pci_dev *dev = hwif->pci_dev; | 46 | struct pci_dev *dev = hwif->pci_dev; |
@@ -48,7 +48,6 @@ static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed) | |||
48 | u16 timing = 0; | 48 | u16 timing = 0; |
49 | u32 triflex_timings = 0; | 49 | u32 triflex_timings = 0; |
50 | u8 unit = (drive->select.b.unit & 0x01); | 50 | u8 unit = (drive->select.b.unit & 0x01); |
51 | u8 speed = ide_rate_filter(drive, xferspeed); | ||
52 | 51 | ||
53 | pci_read_config_dword(dev, channel_offset, &triflex_timings); | 52 | pci_read_config_dword(dev, channel_offset, &triflex_timings); |
54 | 53 | ||
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index ec9ad6e0e1f6..e3bf90736332 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -158,15 +158,13 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) | |||
158 | * by upper layers. | 158 | * by upper layers. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | static int via_set_drive(ide_drive_t *drive, u8 speed) | 161 | static int via_set_drive(ide_drive_t *drive, const u8 speed) |
162 | { | 162 | { |
163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); |
164 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); | 164 | struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev); |
165 | struct ide_timing t, p; | 165 | struct ide_timing t, p; |
166 | unsigned int T, UT; | 166 | unsigned int T, UT; |
167 | 167 | ||
168 | speed = ide_rate_filter(drive, speed); | ||
169 | |||
170 | if (speed != XFER_PIO_SLOW) | 168 | if (speed != XFER_PIO_SLOW) |
171 | ide_config_drive_speed(drive, speed); | 169 | ide_config_drive_speed(drive, speed); |
172 | 170 | ||
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 222adcb54823..284bb7c39b87 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -411,7 +411,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time) | |||
411 | 411 | ||
412 | static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); | 412 | static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif); |
413 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); | 413 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); |
414 | static int pmac_ide_tune_chipset(ide_drive_t *drive, u8 speed); | ||
415 | static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio); | 414 | static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio); |
416 | static void pmac_ide_selectproc(ide_drive_t *drive); | 415 | static void pmac_ide_selectproc(ide_drive_t *drive); |
417 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | 416 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); |
@@ -920,16 +919,13 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, | |||
920 | * our dedicated function is more precise as it uses the drive provided | 919 | * our dedicated function is more precise as it uses the drive provided |
921 | * cycle time value. We should probably fix this one to deal with that too... | 920 | * cycle time value. We should probably fix this one to deal with that too... |
922 | */ | 921 | */ |
923 | static int | 922 | static int pmac_ide_tune_chipset(ide_drive_t *drive, const u8 speed) |
924 | pmac_ide_tune_chipset (ide_drive_t *drive, byte speed) | ||
925 | { | 923 | { |
926 | int unit = (drive->select.b.unit & 0x01); | 924 | int unit = (drive->select.b.unit & 0x01); |
927 | int ret = 0; | 925 | int ret = 0; |
928 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; | 926 | pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; |
929 | u32 *timings, *timings2; | 927 | u32 *timings, *timings2; |
930 | 928 | ||
931 | speed = ide_rate_filter(drive, speed); | ||
932 | |||
933 | if (pmif == NULL) | 929 | if (pmif == NULL) |
934 | return 1; | 930 | return 1; |
935 | 931 | ||