Commit a2cebad6 authored by David S. Miller's avatar David S. Miller

sound/sparc/cs4231.c: Fix probing bugs.

- Only check compatible OBP property if ebus device
name is audio
- Fix ebus device ioremap args
- Accept ID 0x0c as well as 0x0a
- Fix explicit inb, replace with __cs4231_readb
- Do not forget to set CS4231_FLAG_EBUS
parent 9d036904
...@@ -1322,19 +1322,19 @@ static int snd_cs4231_probe(cs4231_t *chip) ...@@ -1322,19 +1322,19 @@ static int snd_cs4231_probe(cs4231_t *chip)
id = 0; id = 0;
for (i = 0; i < 50; i++) { for (i = 0; i < 50; i++) {
mb(); mb();
if (inb(CS4231P(chip, REGSEL)) & CS4231_INIT) if (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT)
udelay(2000); udelay(2000);
else { else {
spin_lock_irqsave(&chip->lock, flags); spin_lock_irqsave(&chip->lock, flags);
snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2); snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2);
id = snd_cs4231_in(chip, CS4231_MISC_INFO) & 0x0f; id = snd_cs4231_in(chip, CS4231_MISC_INFO) & 0x0f;
spin_unlock_irqrestore(&chip->lock, flags); spin_unlock_irqrestore(&chip->lock, flags);
if (id == 0x0a) if (id == 0x0a || id == 0x0c)
break; /* this is valid value */ break; /* this is valid value */
} }
} }
snd_printdd("cs4231: port = 0x%lx, id = 0x%x\n", chip->port, id); snd_printdd("cs4231: port = 0x%lx, id = 0x%x\n", chip->port, id);
if (id != 0x0a) if (id != 0x0a && id != 0x0c)
return -ENODEV; /* no valid device found */ return -ENODEV; /* no valid device found */
spin_lock_irqsave(&chip->lock, flags); spin_lock_irqsave(&chip->lock, flags);
...@@ -2077,14 +2077,15 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card, ...@@ -2077,14 +2077,15 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
init_MUTEX(&chip->mce_mutex); init_MUTEX(&chip->mce_mutex);
init_MUTEX(&chip->open_mutex); init_MUTEX(&chip->open_mutex);
chip->flags |= CS4231_FLAG_EBUS;
chip->card = card; chip->card = card;
chip->dev_u.pdev = edev->bus->self; chip->dev_u.pdev = edev->bus->self;
memcpy(&chip->image, &snd_cs4231_original_image, memcpy(&chip->image, &snd_cs4231_original_image,
sizeof(snd_cs4231_original_image)); sizeof(snd_cs4231_original_image));
chip->port = (unsigned long) ioremap(&edev->resource[0].start, 0x10); chip->port = (unsigned long) ioremap(edev->resource[0].start, 0x10);
chip->eb2p = (unsigned long) ioremap(&edev->resource[1].start, 0x10); chip->eb2p = (unsigned long) ioremap(edev->resource[1].start, 0x10);
chip->eb2c = (unsigned long) ioremap(&edev->resource[2].start, 0x10); chip->eb2c = (unsigned long) ioremap(edev->resource[2].start, 0x10);
if (!chip->port || !chip->eb2p || !chip->eb2c) { if (!chip->port || !chip->eb2p || !chip->eb2c) {
snd_cs4231_ebus_free(chip); snd_cs4231_ebus_free(chip);
snd_printk("cs4231-%d: Unable to map chip registers.\n", dev); snd_printk("cs4231-%d: Unable to map chip registers.\n", dev);
...@@ -2180,7 +2181,7 @@ static int __init cs4231_init(void) ...@@ -2180,7 +2181,7 @@ static int __init cs4231_init(void)
if (!strcmp(edev->prom_name, "SUNW,CS4231")) { if (!strcmp(edev->prom_name, "SUNW,CS4231")) {
match = 1; match = 1;
} else { } else if (!strcmp(edev->prom_name, "audio")) {
char compat[16]; char compat[16];
prom_getstring(edev->prom_node, "compatible", prom_getstring(edev->prom_node, "compatible",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment