aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/it821x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/it821x.c')
-rw-r--r--drivers/ide/it821x.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 51aa745246dc..b2709c733485 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -228,18 +228,18 @@ static void it821x_clock_strategy(ide_drive_t *drive)
228 228
229/** 229/**
230 * it821x_set_pio_mode - set host controller for PIO mode 230 * it821x_set_pio_mode - set host controller for PIO mode
231 * @hwif: port
231 * @drive: drive 232 * @drive: drive
232 * @pio: PIO mode number
233 * 233 *
234 * Tune the host to the desired PIO mode taking into the consideration 234 * Tune the host to the desired PIO mode taking into the consideration
235 * the maximum PIO mode supported by the other device on the cable. 235 * the maximum PIO mode supported by the other device on the cable.
236 */ 236 */
237 237
238static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio) 238static void it821x_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
239{ 239{
240 ide_hwif_t *hwif = drive->hwif;
241 struct it821x_dev *itdev = ide_get_hwifdata(hwif); 240 struct it821x_dev *itdev = ide_get_hwifdata(hwif);
242 ide_drive_t *pair = ide_get_pair_dev(drive); 241 ide_drive_t *pair = ide_get_pair_dev(drive);
242 const u8 pio = drive->pio_mode - XFER_PIO_0;
243 u8 unit = drive->dn & 1, set_pio = pio; 243 u8 unit = drive->dn & 1, set_pio = pio;
244 244
245 /* Spec says 89 ref driver uses 88 */ 245 /* Spec says 89 ref driver uses 88 */
@@ -252,7 +252,7 @@ static void it821x_set_pio_mode(ide_drive_t *drive, const u8 pio)
252 * on the cable. 252 * on the cable.
253 */ 253 */
254 if (pair) { 254 if (pair) {
255 u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 255 u8 pair_pio = pair->pio_mode - XFER_PIO_0;
256 /* trim PIO to the slowest of the master/slave */ 256 /* trim PIO to the slowest of the master/slave */
257 if (pair_pio < set_pio) 257 if (pair_pio < set_pio)
258 set_pio = pair_pio; 258 set_pio = pair_pio;
@@ -393,14 +393,16 @@ static int it821x_dma_end(ide_drive_t *drive)
393 393
394/** 394/**
395 * it821x_set_dma_mode - set host controller for DMA mode 395 * it821x_set_dma_mode - set host controller for DMA mode
396 * @hwif: port
396 * @drive: drive 397 * @drive: drive
397 * @speed: DMA mode
398 * 398 *
399 * Tune the ITE chipset for the desired DMA mode. 399 * Tune the ITE chipset for the desired DMA mode.
400 */ 400 */
401 401
402static void it821x_set_dma_mode(ide_drive_t *drive, const u8 speed) 402static void it821x_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
403{ 403{
404 const u8 speed = drive->dma_mode;
405
404 /* 406 /*
405 * MWDMA tuning is really hard because our MWDMA and PIO 407 * MWDMA tuning is really hard because our MWDMA and PIO
406 * timings are kept in the same place. We can switch in the 408 * timings are kept in the same place. We can switch in the