aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/qd65xx.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:40 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:40 -0500
commit1f2cf8b0014fdfa3141449b508aca25e78c078a7 (patch)
tree2bbed83a1c7f5fc037cd64c2af108f081aff4c65 /drivers/ide/legacy/qd65xx.c
parent807b90d0be23b8d088d4369b02539dada70f03f4 (diff)
ide: add ->port_init_devs method to ide_hwif_t
* Add ->port_init_devs method to ide_hwif_t for a host specific initialization of devices on a port. Call the new method from ide_port_init_devices(). * Convert ht6560b, qd65xx and opti621 host drivers to use the new ->port_init_devs method. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r--drivers/ide/legacy/qd65xx.c44
1 files changed, 33 insertions, 11 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 60a6ed1088df..bba29df5f21d 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -305,13 +305,33 @@ static int __init qd_testreg(int port)
305 * called to setup an ata channel : adjusts attributes & links for tuning 305 * called to setup an ata channel : adjusts attributes & links for tuning
306 */ 306 */
307 307
308static void __init qd_setup(ide_hwif_t *hwif, int base, int config, 308static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
309 unsigned int data0, unsigned int data1)
310{ 309{
311 hwif->select_data = base; 310 hwif->select_data = base;
312 hwif->config_data = config; 311 hwif->config_data = config;
313 hwif->drives[0].drive_data = data0; 312}
314 hwif->drives[1].drive_data = data1; 313
314static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
315{
316 u8 base = hwif->select_data, config = QD_CONFIG(hwif);
317
318 hwif->drives[0].drive_data = QD6500_DEF_DATA;
319 hwif->drives[1].drive_data = QD6500_DEF_DATA;
320}
321
322static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
323{
324 u16 t1, t2;
325 u8 base = hwif->select_data, config = QD_CONFIG(hwif);
326
327 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
328 t1 = QD6580_DEF_DATA;
329 t2 = QD6580_DEF_DATA2;
330 } else
331 t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
332
333 hwif->drives[0].drive_data = t1;
334 hwif->drives[1].drive_data = t2;
315} 335}
316 336
317/* 337/*
@@ -396,8 +416,9 @@ static int __init qd_probe(int base)
396 return 1; 416 return 1;
397 } 417 }
398 418
399 qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA); 419 qd_setup(hwif, base, config);
400 420
421 hwif->port_init_devs = qd6500_port_init_devs;
401 hwif->set_pio_mode = &qd6500_set_pio_mode; 422 hwif->set_pio_mode = &qd6500_set_pio_mode;
402 423
403 idx[unit] = unit; 424 idx[unit] = unit;
@@ -429,9 +450,10 @@ static int __init qd_probe(int base)
429 hwif = &ide_hwifs[unit]; 450 hwif = &ide_hwifs[unit];
430 printk(KERN_INFO "%s: qd6580: single IDE board\n", 451 printk(KERN_INFO "%s: qd6580: single IDE board\n",
431 hwif->name); 452 hwif->name);
432 qd_setup(hwif, base, config | (control << 8),
433 QD6580_DEF_DATA, QD6580_DEF_DATA2);
434 453
454 qd_setup(hwif, base, config | (control << 8));
455
456 hwif->port_init_devs = qd6580_port_init_devs;
435 hwif->set_pio_mode = &qd6580_set_pio_mode; 457 hwif->set_pio_mode = &qd6580_set_pio_mode;
436 458
437 idx[unit] = unit; 459 idx[unit] = unit;
@@ -450,14 +472,14 @@ static int __init qd_probe(int base)
450 printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n", 472 printk(KERN_INFO "%s&%s: qd6580: dual IDE board\n",
451 hwif->name, mate->name); 473 hwif->name, mate->name);
452 474
453 qd_setup(hwif, base, config | (control << 8), 475 qd_setup(hwif, base, config | (control << 8));
454 QD6580_DEF_DATA, QD6580_DEF_DATA);
455 476
477 hwif->port_init_devs = qd6580_port_init_devs;
456 hwif->set_pio_mode = &qd6580_set_pio_mode; 478 hwif->set_pio_mode = &qd6580_set_pio_mode;
457 479
458 qd_setup(mate, base, config | (control << 8), 480 qd_setup(mate, base, config | (control << 8));
459 QD6580_DEF_DATA2, QD6580_DEF_DATA2);
460 481
482 mate->port_init_devs = qd6580_port_init_devs;
461 mate->set_pio_mode = &qd6580_set_pio_mode; 483 mate->set_pio_mode = &qd6580_set_pio_mode;
462 484
463 idx[0] = 0; 485 idx[0] = 0;