aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/opti621.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/opti621.c')
-rw-r--r--drivers/ide/opti621.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ide/opti621.c b/drivers/ide/opti621.c
index 6048eda3cd61..f1d70d6630fe 100644
--- a/drivers/ide/opti621.c
+++ b/drivers/ide/opti621.c
@@ -138,6 +138,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
138 ide_hwif_t *hwif = drive->hwif; 138 ide_hwif_t *hwif = drive->hwif;
139 ide_drive_t *pair = ide_get_pair_dev(drive); 139 ide_drive_t *pair = ide_get_pair_dev(drive);
140 unsigned long flags; 140 unsigned long flags;
141 unsigned long mode = XFER_PIO_0 + pio, pair_mode;
141 u8 tim, misc, addr_pio = pio, clk; 142 u8 tim, misc, addr_pio = pio, clk;
142 143
143 /* DRDY is default 2 (by OPTi Databook) */ 144 /* DRDY is default 2 (by OPTi Databook) */
@@ -150,11 +151,12 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
150 { 0x48, 0x34, 0x21, 0x10, 0x10 } /* 25 MHz */ 151 { 0x48, 0x34, 0x21, 0x10, 0x10 } /* 25 MHz */
151 }; 152 };
152 153
153 drive->drive_data = XFER_PIO_0 + pio; 154 ide_set_drivedata(drive, (void *)mode);
154 155
155 if (pair) { 156 if (pair) {
156 if (pair->drive_data && pair->drive_data < drive->drive_data) 157 pair_mode = (unsigned long)ide_get_drivedata(pair);
157 addr_pio = pair->drive_data - XFER_PIO_0; 158 if (pair_mode && pair_mode < mode)
159 addr_pio = pair_mode - XFER_PIO_0;
158 } 160 }
159 161
160 spin_lock_irqsave(&opti621_lock, flags); 162 spin_lock_irqsave(&opti621_lock, flags);