aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/qd65xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r--drivers/ide/legacy/qd65xx.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 51dba82f8812..2338f344ea24 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -207,6 +207,7 @@ static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio)
207static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) 207static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
208{ 208{
209 ide_hwif_t *hwif = drive->hwif; 209 ide_hwif_t *hwif = drive->hwif;
210 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);
210 unsigned int cycle_time; 211 unsigned int cycle_time;
211 int active_time = 175; 212 int active_time = 175;
212 int recovery_time = 415; /* worst case values from the dos driver */ 213 int recovery_time = 415; /* worst case values from the dos driver */
@@ -236,7 +237,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
236 active_time = 110; 237 active_time = 110;
237 recovery_time = cycle_time - 120; 238 recovery_time = cycle_time - 120;
238 } else { 239 } else {
239 active_time = ide_pio_timings[pio].active_time; 240 active_time = t->active;
240 recovery_time = cycle_time - active_time; 241 recovery_time = cycle_time - active_time;
241 } 242 }
242 } 243 }
@@ -281,17 +282,18 @@ static int __init qd_testreg(int port)
281 return (readreg != QD_TESTVAL); 282 return (readreg != QD_TESTVAL);
282} 283}
283 284
284static void __init qd6500_port_init_devs(ide_hwif_t *hwif) 285static void __init qd6500_init_dev(ide_drive_t *drive)
285{ 286{
287 ide_hwif_t *hwif = drive->hwif;
286 u8 base = (hwif->config_data & 0xff00) >> 8; 288 u8 base = (hwif->config_data & 0xff00) >> 8;
287 u8 config = QD_CONFIG(hwif); 289 u8 config = QD_CONFIG(hwif);
288 290
289 hwif->drives[0].drive_data = QD6500_DEF_DATA; 291 drive->drive_data = QD6500_DEF_DATA;
290 hwif->drives[1].drive_data = QD6500_DEF_DATA;
291} 292}
292 293
293static void __init qd6580_port_init_devs(ide_hwif_t *hwif) 294static void __init qd6580_init_dev(ide_drive_t *drive)
294{ 295{
296 ide_hwif_t *hwif = drive->hwif;
295 u16 t1, t2; 297 u16 t1, t2;
296 u8 base = (hwif->config_data & 0xff00) >> 8; 298 u8 base = (hwif->config_data & 0xff00) >> 8;
297 u8 config = QD_CONFIG(hwif); 299 u8 config = QD_CONFIG(hwif);
@@ -302,18 +304,17 @@ static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
302 } else 304 } else
303 t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA; 305 t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
304 306
305 hwif->drives[0].drive_data = t1; 307 drive->drive_data = drive->select.b.unit ? t2 : t1;
306 hwif->drives[1].drive_data = t2;
307} 308}
308 309
309static const struct ide_port_ops qd6500_port_ops = { 310static const struct ide_port_ops qd6500_port_ops = {
310 .port_init_devs = qd6500_port_init_devs, 311 .init_dev = qd6500_init_dev,
311 .set_pio_mode = qd6500_set_pio_mode, 312 .set_pio_mode = qd6500_set_pio_mode,
312 .selectproc = qd65xx_select, 313 .selectproc = qd65xx_select,
313}; 314};
314 315
315static const struct ide_port_ops qd6580_port_ops = { 316static const struct ide_port_ops qd6580_port_ops = {
316 .port_init_devs = qd6580_port_init_devs, 317 .init_dev = qd6580_init_dev,
317 .set_pio_mode = qd6580_set_pio_mode, 318 .set_pio_mode = qd6580_set_pio_mode,
318 .selectproc = qd65xx_select, 319 .selectproc = qd65xx_select,
319}; 320};