ide: use ide_legacy_device_add() for qd65xx (take 2)
* Add 'unsigned long config' argument to ide_legacy_device_add() for setting hwif->config_data. * Use ide_find_port_slot() instead of ide_find_port() in ide_legacy_device_add(). * Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in ide_legacy_device_add(). * Convert qd65xx host driver to use ide_legacy_device_add(). v2: * Update ali14xx, dtc2278, ht6560b and umc8672 host drivers. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>wifi-calibration
parent
3b36f66b81
commit
0bfeee7d41
|
@ -1634,7 +1634,7 @@ void ide_port_scan(ide_hwif_t *hwif)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ide_port_scan);
|
EXPORT_SYMBOL_GPL(ide_port_scan);
|
||||||
|
|
||||||
int ide_legacy_device_add(const struct ide_port_info *d)
|
int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif, *mate;
|
ide_hwif_t *hwif, *mate;
|
||||||
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
||||||
|
@ -1648,15 +1648,24 @@ int ide_legacy_device_add(const struct ide_port_info *d)
|
||||||
ide_std_init_ports(&hw[1], 0x170, 0x376);
|
ide_std_init_ports(&hw[1], 0x170, 0x376);
|
||||||
hw[1].irq = 15;
|
hw[1].irq = 15;
|
||||||
|
|
||||||
hwif = ide_find_port();
|
hwif = ide_find_port_slot(d);
|
||||||
if (hwif) {
|
if (hwif) {
|
||||||
ide_init_port_hw(hwif, &hw[0]);
|
u8 j = (d->host_flags & IDE_HFLAG_QD_2ND_PORT) ? 1 : 0;
|
||||||
idx[0] = hwif->index;
|
|
||||||
|
ide_init_port_hw(hwif, &hw[j]);
|
||||||
|
if (config)
|
||||||
|
hwif->config_data = config;
|
||||||
|
idx[j] = hwif->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
mate = ide_find_port();
|
if (hwif == NULL && (d->host_flags & IDE_HFLAG_SINGLE))
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
|
mate = ide_find_port_slot(d);
|
||||||
if (mate) {
|
if (mate) {
|
||||||
ide_init_port_hw(mate, &hw[1]);
|
ide_init_port_hw(mate, &hw[1]);
|
||||||
|
if (config)
|
||||||
|
mate->config_data = config;
|
||||||
idx[1] = mate->index;
|
idx[1] = mate->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ static int __init ali14xx_probe(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ide_legacy_device_add(&ali14xx_port_info);
|
return ide_legacy_device_add(&ali14xx_port_info, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_ali14xx;
|
int probe_ali14xx;
|
||||||
|
|
|
@ -125,7 +125,7 @@ static int __init dtc2278_probe(void)
|
||||||
#endif
|
#endif
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
|
|
||||||
return ide_legacy_device_add(&dtc2278_port_info);
|
return ide_legacy_device_add(&dtc2278_port_info, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_dtc2278 = 0;
|
int probe_dtc2278 = 0;
|
||||||
|
|
|
@ -360,7 +360,7 @@ static int __init ht6560b_init(void)
|
||||||
goto release_region;
|
goto release_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ide_legacy_device_add(&ht6560b_port_info);
|
return ide_legacy_device_add(&ht6560b_port_info, 0);
|
||||||
|
|
||||||
release_region:
|
release_region:
|
||||||
release_region(HT_CONFIG_PORT, 1);
|
release_region(HT_CONFIG_PORT, 1);
|
||||||
|
|
|
@ -333,10 +333,8 @@ static const struct ide_port_info qd65xx_port_info __initdata = {
|
||||||
|
|
||||||
static int __init qd_probe(int base)
|
static int __init qd_probe(int base)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif;
|
int rc;
|
||||||
u8 config, unit;
|
u8 config, unit;
|
||||||
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
|
||||||
hw_regs_t hw[2];
|
|
||||||
struct ide_port_info d = qd65xx_port_info;
|
struct ide_port_info d = qd65xx_port_info;
|
||||||
|
|
||||||
config = inb(QD_CONFIG_PORT);
|
config = inb(QD_CONFIG_PORT);
|
||||||
|
@ -349,14 +347,6 @@ static int __init qd_probe(int base)
|
||||||
if (unit)
|
if (unit)
|
||||||
d.host_flags |= IDE_HFLAG_QD_2ND_PORT;
|
d.host_flags |= IDE_HFLAG_QD_2ND_PORT;
|
||||||
|
|
||||||
memset(&hw, 0, sizeof(hw));
|
|
||||||
|
|
||||||
ide_std_init_ports(&hw[0], 0x1f0, 0x3f6);
|
|
||||||
hw[0].irq = 14;
|
|
||||||
|
|
||||||
ide_std_init_ports(&hw[1], 0x170, 0x376);
|
|
||||||
hw[1].irq = 15;
|
|
||||||
|
|
||||||
if ((config & 0xf0) == QD_CONFIG_QD6500) {
|
if ((config & 0xf0) == QD_CONFIG_QD6500) {
|
||||||
|
|
||||||
if (qd_testreg(base))
|
if (qd_testreg(base))
|
||||||
|
@ -376,19 +366,9 @@ static int __init qd_probe(int base)
|
||||||
d.port_ops = &qd6500_port_ops;
|
d.port_ops = &qd6500_port_ops;
|
||||||
d.host_flags |= IDE_HFLAG_SINGLE;
|
d.host_flags |= IDE_HFLAG_SINGLE;
|
||||||
|
|
||||||
hwif = ide_find_port_slot(&d);
|
rc = ide_legacy_device_add(&d, (base << 8) | config);
|
||||||
if (hwif == NULL)
|
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
ide_init_port_hw(hwif, &hw[unit]);
|
return (rc == 0) ? 1 : rc;
|
||||||
|
|
||||||
hwif->config_data = (base << 8) | config;
|
|
||||||
|
|
||||||
idx[unit] = hwif->index;
|
|
||||||
|
|
||||||
ide_device_add(idx, &d);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((config & 0xf0) == QD_CONFIG_QD6580_A) ||
|
if (((config & 0xf0) == QD_CONFIG_QD6580_A) ||
|
||||||
|
@ -418,40 +398,16 @@ static int __init qd_probe(int base)
|
||||||
|
|
||||||
d.host_flags |= IDE_HFLAG_SINGLE;
|
d.host_flags |= IDE_HFLAG_SINGLE;
|
||||||
|
|
||||||
hwif = ide_find_port_slot(&d);
|
rc = ide_legacy_device_add(&d, (base << 8) | config);
|
||||||
if (hwif == NULL)
|
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
ide_init_port_hw(hwif, &hw[unit]);
|
return (rc == 0) ? 1 : rc;
|
||||||
|
|
||||||
hwif->config_data = (base << 8) | config;
|
|
||||||
|
|
||||||
idx[unit] = hwif->index;
|
|
||||||
|
|
||||||
ide_device_add(idx, &d);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
} else {
|
} else {
|
||||||
ide_hwif_t *mate;
|
|
||||||
|
|
||||||
/* secondary enabled */
|
/* secondary enabled */
|
||||||
printk(KERN_INFO "qd6580: dual IDE board\n");
|
printk(KERN_INFO "qd6580: dual IDE board\n");
|
||||||
|
|
||||||
hwif = ide_find_port();
|
rc = ide_legacy_device_add(&d, (base << 8) | config);
|
||||||
if (hwif) {
|
|
||||||
ide_init_port_hw(hwif, &hw[0]);
|
|
||||||
idx[0] = hwif->index;
|
|
||||||
}
|
|
||||||
|
|
||||||
mate = ide_find_port();
|
return rc; /* no other qd65xx possible */
|
||||||
if (mate) {
|
|
||||||
ide_init_port_hw(mate, &hw[1]);
|
|
||||||
idx[1] = mate->index;
|
|
||||||
}
|
|
||||||
|
|
||||||
ide_device_add(idx, &d);
|
|
||||||
|
|
||||||
return 0; /* no other qd65xx possible */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* no qd65xx found */
|
/* no qd65xx found */
|
||||||
|
|
|
@ -152,7 +152,7 @@ static int __init umc8672_probe(void)
|
||||||
umc_set_speeds(current_speeds);
|
umc_set_speeds(current_speeds);
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
|
|
||||||
return ide_legacy_device_add(&umc8672_port_info);
|
return ide_legacy_device_add(&umc8672_port_info, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_umc8672;
|
int probe_umc8672;
|
||||||
|
|
|
@ -1213,7 +1213,7 @@ void ide_undecoded_slave(ide_drive_t *);
|
||||||
|
|
||||||
int ide_device_add_all(u8 *idx, const struct ide_port_info *);
|
int ide_device_add_all(u8 *idx, const struct ide_port_info *);
|
||||||
int ide_device_add(u8 idx[4], const struct ide_port_info *);
|
int ide_device_add(u8 idx[4], const struct ide_port_info *);
|
||||||
int ide_legacy_device_add(const struct ide_port_info *);
|
int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
|
||||||
void ide_port_unregister_devices(ide_hwif_t *);
|
void ide_port_unregister_devices(ide_hwif_t *);
|
||||||
void ide_port_scan(ide_hwif_t *);
|
void ide_port_scan(ide_hwif_t *);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue