diff options
-rw-r--r-- | drivers/ide/legacy/qd65xx.c | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index d8a05b57277b..336ef20407f4 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c | |||
@@ -334,7 +334,7 @@ static const struct ide_port_info qd65xx_port_info __initdata = { | |||
334 | static int __init qd_probe(int base) | 334 | static int __init qd_probe(int base) |
335 | { | 335 | { |
336 | int rc; | 336 | int rc; |
337 | u8 config, unit; | 337 | u8 config, unit, control; |
338 | struct ide_port_info d = qd65xx_port_info; | 338 | struct ide_port_info d = qd65xx_port_info; |
339 | 339 | ||
340 | config = inb(QD_CONFIG_PORT); | 340 | config = inb(QD_CONFIG_PORT); |
@@ -347,13 +347,11 @@ static int __init qd_probe(int base) | |||
347 | if (unit) | 347 | if (unit) |
348 | d.host_flags |= IDE_HFLAG_QD_2ND_PORT; | 348 | d.host_flags |= IDE_HFLAG_QD_2ND_PORT; |
349 | 349 | ||
350 | if ((config & 0xf0) == QD_CONFIG_QD6500) { | 350 | switch (config & 0xf0) { |
351 | 351 | case QD_CONFIG_QD6500: | |
352 | if (qd_testreg(base)) | 352 | if (qd_testreg(base)) |
353 | return -ENODEV; /* bad register */ | 353 | return -ENODEV; /* bad register */ |
354 | 354 | ||
355 | /* qd6500 found */ | ||
356 | |||
357 | if (config & QD_CONFIG_DISABLED) { | 355 | if (config & QD_CONFIG_DISABLED) { |
358 | printk(KERN_WARNING "qd6500 is disabled !\n"); | 356 | printk(KERN_WARNING "qd6500 is disabled !\n"); |
359 | return -ENODEV; | 357 | return -ENODEV; |
@@ -365,22 +363,12 @@ static int __init qd_probe(int base) | |||
365 | 363 | ||
366 | d.port_ops = &qd6500_port_ops; | 364 | d.port_ops = &qd6500_port_ops; |
367 | d.host_flags |= IDE_HFLAG_SINGLE; | 365 | d.host_flags |= IDE_HFLAG_SINGLE; |
368 | 366 | break; | |
369 | rc = ide_legacy_device_add(&d, (base << 8) | config); | 367 | case QD_CONFIG_QD6580_A: |
370 | 368 | case QD_CONFIG_QD6580_B: | |
371 | return (rc == 0) ? 1 : rc; | ||
372 | } | ||
373 | |||
374 | if (((config & 0xf0) == QD_CONFIG_QD6580_A) || | ||
375 | ((config & 0xf0) == QD_CONFIG_QD6580_B)) { | ||
376 | |||
377 | u8 control; | ||
378 | |||
379 | if (qd_testreg(base) || qd_testreg(base + 0x02)) | 369 | if (qd_testreg(base) || qd_testreg(base + 0x02)) |
380 | return -ENODEV; /* bad registers */ | 370 | return -ENODEV; /* bad registers */ |
381 | 371 | ||
382 | /* qd6580 found */ | ||
383 | |||
384 | control = inb(QD_CONTROL_PORT); | 372 | control = inb(QD_CONTROL_PORT); |
385 | 373 | ||
386 | printk(KERN_NOTICE "qd6580 at %#x\n", base); | 374 | printk(KERN_NOTICE "qd6580 at %#x\n", base); |
@@ -390,28 +378,22 @@ static int __init qd_probe(int base) | |||
390 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); | 378 | outb(QD_DEF_CONTR, QD_CONTROL_PORT); |
391 | 379 | ||
392 | d.port_ops = &qd6580_port_ops; | 380 | d.port_ops = &qd6580_port_ops; |
393 | 381 | if (control & QD_CONTR_SEC_DISABLED) | |
394 | if (control & QD_CONTR_SEC_DISABLED) { | ||
395 | /* secondary disabled */ | ||
396 | |||
397 | printk(KERN_INFO "qd6580: single IDE board\n"); | ||
398 | |||
399 | d.host_flags |= IDE_HFLAG_SINGLE; | 382 | d.host_flags |= IDE_HFLAG_SINGLE; |
400 | 383 | ||
401 | rc = ide_legacy_device_add(&d, (base << 8) | config); | 384 | printk(KERN_INFO "qd6580: %s IDE board\n", |
385 | (control & QD_CONTR_SEC_DISABLED) ? "single" : "dual"); | ||
386 | break; | ||
387 | default: | ||
388 | return -ENODEV; | ||
389 | } | ||
402 | 390 | ||
403 | return (rc == 0) ? 1 : rc; | 391 | rc = ide_legacy_device_add(&d, (base << 8) | config); |
404 | } else { | ||
405 | /* secondary enabled */ | ||
406 | printk(KERN_INFO "qd6580: dual IDE board\n"); | ||
407 | 392 | ||
408 | rc = ide_legacy_device_add(&d, (base << 8) | config); | 393 | if (d.host_flags & IDE_HFLAG_SINGLE) |
394 | return (rc == 0) ? 1 : rc; | ||
409 | 395 | ||
410 | return rc; /* no other qd65xx possible */ | 396 | return rc; |
411 | } | ||
412 | } | ||
413 | /* no qd65xx found */ | ||
414 | return -ENODEV; | ||
415 | } | 397 | } |
416 | 398 | ||
417 | int probe_qd65xx = 0; | 399 | int probe_qd65xx = 0; |