diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:42 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 11:36:42 -0400 |
commit | 79472b6ea9e74ee4400ba57ba84cad86426e2d6d (patch) | |
tree | 3a9ccf93280347a4c757c91632428feab56c8282 /drivers/ide/legacy/qd65xx.c | |
parent | d07616f19336b514eef06e6a361988c4073e6ecb (diff) |
qd65xx: use IDE_HFLAG_SINGLE host flag
* Set IDE_HFLAG_SINGLE host flag in qd_probe() for QD6500 and QD6580
with the second port disabled.
* Check for IDE_HFLAG_SINGLE in qd6580_port_init_devs() instead of
using cached value of QD6580 Control register.
* Don't cache QD6580 Control register value in hwif->config_data
(bits 8-15) and remove no longer needed QD_CONTROL() macro.
* Cache QD65xx base address in hwif->config_data (bits 8-15)
instead of hwif->select_data.
* Set hwif->config_data in qd_probe() and remove qd_setup() helper.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy/qd65xx.c')
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index ad4ec2c42a5a..6e820c7c5c6b 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -204,10 +204,11 @@ static void qd6500_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
204 | 204 | ||
205 | static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) | 205 | static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio) |
206 | { | 206 | { |
207 | int base = HWIF(drive)->select_data; | 207 | ide_hwif_t *hwif = drive->hwif; |
208 | unsigned int cycle_time; | 208 | unsigned int cycle_time; |
209 | int active_time = 175; | 209 | int active_time = 175; |
210 | int recovery_time = 415; /* worst case values from the dos driver */ | 210 | int recovery_time = 415; /* worst case values from the dos driver */ |
211 | u8 base = (hwif->config_data & 0xff00) >> 8; | ||
211 | 212 | ||
212 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { | 213 | if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { |
213 | cycle_time = ide_pio_cycle_time(drive, pio); | 214 | cycle_time = ide_pio_cycle_time(drive, pio); |
@@ -278,21 +279,10 @@ static int __init qd_testreg(int port) | |||
278 | return (readreg != QD_TESTVAL); | 279 | return (readreg != QD_TESTVAL); |
279 | } | 280 | } |
280 | 281 | ||
281 | /* | ||
282 | * qd_setup: | ||
283 | * | ||
284 | * called to setup an ata channel : adjusts attributes & links for tuning | ||
285 | */ | ||
286 | |||
287 | static void __init qd_setup(ide_hwif_t *hwif, int base, int config) | ||
288 | { | ||
289 | hwif->select_data = base; | ||
290 | hwif->config_data = config; | ||
291 | } | ||
292 | |||
293 | static void __init qd6500_port_init_devs(ide_hwif_t *hwif) | 282 | static void __init qd6500_port_init_devs(ide_hwif_t *hwif) |
294 | { | 283 | { |
295 | u8 base = hwif->select_data, config = QD_CONFIG(hwif); | 284 | u8 base = (hwif->config_data & 0xff00) >> 8; |
285 | u8 config = QD_CONFIG(hwif); | ||
296 | 286 | ||
297 | hwif->drives[0].drive_data = QD6500_DEF_DATA; | 287 | hwif->drives[0].drive_data = QD6500_DEF_DATA; |
298 | hwif->drives[1].drive_data = QD6500_DEF_DATA; | 288 | hwif->drives[1].drive_data = QD6500_DEF_DATA; |
@@ -301,9 +291,10 @@ static void __init qd6500_port_init_devs(ide_hwif_t *hwif) | |||
301 | static void __init qd6580_port_init_devs(ide_hwif_t *hwif) | 291 | static void __init qd6580_port_init_devs(ide_hwif_t *hwif) |
302 | { | 292 | { |
303 | u16 t1, t2; | 293 | u16 t1, t2; |
304 | u8 base = hwif->select_data, config = QD_CONFIG(hwif); | 294 | u8 base = (hwif->config_data & 0xff00) >> 8; |
295 | u8 config = QD_CONFIG(hwif); | ||
305 | 296 | ||
306 | if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { | 297 | if (hwif->host_flags & IDE_HFLAG_SINGLE) { |
307 | t1 = QD6580_DEF_DATA; | 298 | t1 = QD6580_DEF_DATA; |
308 | t2 = QD6580_DEF_DATA2; | 299 | t2 = QD6580_DEF_DATA2; |
309 | } else | 300 | } else |
@@ -370,13 +361,15 @@ static int __init qd_probe(int base) | |||
370 | printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", | 361 | printk(KERN_DEBUG "qd6500: config=%#x, ID3=%u\n", |
371 | config, QD_ID3); | 362 | config, QD_ID3); |
372 | 363 | ||
364 | d.host_flags |= IDE_HFLAG_SINGLE; | ||
365 | |||
373 | hwif = ide_find_port_slot(&d); | 366 | hwif = ide_find_port_slot(&d); |
374 | if (hwif == NULL) | 367 | if (hwif == NULL) |
375 | return -ENOENT; | 368 | return -ENOENT; |
376 | 369 | ||
377 | ide_init_port_hw(hwif, &hw[unit]); | 370 | ide_init_port_hw(hwif, &hw[unit]); |
378 | 371 | ||
379 | qd_setup(hwif, base, config); | 372 | hwif->config_data = (base << 8) | config; |
380 | 373 | ||
381 | hwif->port_init_devs = qd6500_port_init_devs; | 374 | hwif->port_init_devs = qd6500_port_init_devs; |
382 | hwif->set_pio_mode = qd6500_set_pio_mode; | 375 | hwif->set_pio_mode = qd6500_set_pio_mode; |
@@ -412,13 +405,15 @@ static int __init qd_probe(int base) | |||
412 | 405 | ||
413 | printk(KERN_INFO "qd6580: single IDE board\n"); | 406 | printk(KERN_INFO "qd6580: single IDE board\n"); |
414 | 407 | ||
408 | d.host_flags |= IDE_HFLAG_SINGLE; | ||
409 | |||
415 | hwif = ide_find_port_slot(&d); | 410 | hwif = ide_find_port_slot(&d); |
416 | if (hwif == NULL) | 411 | if (hwif == NULL) |
417 | return -ENOENT; | 412 | return -ENOENT; |
418 | 413 | ||
419 | ide_init_port_hw(hwif, &hw[unit]); | 414 | ide_init_port_hw(hwif, &hw[unit]); |
420 | 415 | ||
421 | qd_setup(hwif, base, config | (control << 8)); | 416 | hwif->config_data = (base << 8) | config; |
422 | 417 | ||
423 | hwif->port_init_devs = qd6580_port_init_devs; | 418 | hwif->port_init_devs = qd6580_port_init_devs; |
424 | hwif->set_pio_mode = qd6580_set_pio_mode; | 419 | hwif->set_pio_mode = qd6580_set_pio_mode; |
@@ -438,7 +433,7 @@ static int __init qd_probe(int base) | |||
438 | hwif = ide_find_port(); | 433 | hwif = ide_find_port(); |
439 | if (hwif) { | 434 | if (hwif) { |
440 | ide_init_port_hw(hwif, &hw[0]); | 435 | ide_init_port_hw(hwif, &hw[0]); |
441 | qd_setup(hwif, base, config | (control << 8)); | 436 | hwif->config_data = (base << 8) | config; |
442 | hwif->port_init_devs = qd6580_port_init_devs; | 437 | hwif->port_init_devs = qd6580_port_init_devs; |
443 | hwif->set_pio_mode = qd6580_set_pio_mode; | 438 | hwif->set_pio_mode = qd6580_set_pio_mode; |
444 | hwif->selectproc = qd65xx_select; | 439 | hwif->selectproc = qd65xx_select; |
@@ -448,7 +443,7 @@ static int __init qd_probe(int base) | |||
448 | mate = ide_find_port(); | 443 | mate = ide_find_port(); |
449 | if (mate) { | 444 | if (mate) { |
450 | ide_init_port_hw(mate, &hw[1]); | 445 | ide_init_port_hw(mate, &hw[1]); |
451 | qd_setup(mate, base, config | (control << 8)); | 446 | mate->config_data = (base << 8) | config; |
452 | mate->port_init_devs = qd6580_port_init_devs; | 447 | mate->port_init_devs = qd6580_port_init_devs; |
453 | mate->set_pio_mode = qd6580_set_pio_mode; | 448 | mate->set_pio_mode = qd6580_set_pio_mode; |
454 | mate->selectproc = qd65xx_select; | 449 | mate->selectproc = qd65xx_select; |