diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-24 14:48:24 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-24 14:48:24 -0700 |
commit | b9d8be7828e974f076717f0da608d052440fe192 (patch) | |
tree | d4bc4d3e13f816a76b1a02bde922ee7ad0dbdbd9 /arch/sparc64/kernel/auxio.c | |
parent | d02f40e81e003be6ddba5c176f2e40ea290c3729 (diff) | |
parent | 1812fd40725c13cf050c29791a6dd35d593eb8d8 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: (40 commits)
[SPARC64]: Update defconfig.
[SPARC64]: Make auxio a real driver.
[PARPORT] sunbpp: Convert to new SBUS device framework.
[Documentation]: Update probing info in sbus_drivers.txt
[SCSI] qlogicpti: Convert to new SBUS device framework.
[SCSI] esp: Fix bug in esp_remove_common.
[NET] sunhme: Kill useless loop over sdevs in quattro_sbus_find().
[NET] myri_sbus: Kill unused next_module struct member.
[NET] myri_sbus: Convert to new SBUS device layer.
[NET] sunqe: Convert to new SBUS driver layer.
[NET] sunbmac: Convert over to new SBUS device framework.
[NET] sunlance: Convert to new SBUS driver framework.
[NET] sunhme: Convert to new SBUS driver framework.
[NET] sunhme: Kill __sparc__ and __sparc_v9__ ifdefs.
[SCSI] sparc: Port esp to new SBUS driver layer.
[SOUND] sparc: Port amd7930 to new SBUS device layer.
[SBUS]: Rewrite and plug into of_device framework.
[SPARC]: Port of_device layer and make ebus use it.
[SPARC]: Port sparc64 in-kernel device tree code to sparc32.
[SPARC64]: Add of_device layer and make ebus/isa use it.
...
Diffstat (limited to 'arch/sparc64/kernel/auxio.c')
-rw-r--r-- | arch/sparc64/kernel/auxio.c | 109 |
1 files changed, 74 insertions, 35 deletions
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c index 8852c20c8d9..2c42894b188 100644 --- a/arch/sparc64/kernel/auxio.c +++ b/arch/sparc64/kernel/auxio.c @@ -110,43 +110,82 @@ void auxio_set_lte(int on) } } -void __init auxio_probe(void) +static void __devinit auxio_report_dev(struct device_node *dp) { - struct sbus_bus *sbus; - struct sbus_dev *sdev = NULL; - - for_each_sbus(sbus) { - for_each_sbusdev(sdev, sbus) { - if(!strcmp(sdev->prom_name, "auxio")) - goto found_sdev; - } - } - -found_sdev: - if (sdev) { - auxio_devtype = AUXIO_TYPE_SBUS; - auxio_register = sbus_ioremap(&sdev->resource[0], 0, - sdev->reg_addrs[0].reg_size, - "auxiliaryIO"); - } + printk(KERN_INFO "AUXIO: Found device at %s\n", + dp->full_name); +} + +static struct of_device_id auxio_match[] = { + { + .name = "auxio", + }, + {}, +}; + +MODULE_DEVICE_TABLE(of, auxio_match); + +#ifdef CONFIG_SBUS +static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match) +{ + struct sbus_dev *sdev = to_sbus_device(&dev->dev); + + auxio_devtype = AUXIO_TYPE_SBUS; + auxio_register = sbus_ioremap(&sdev->resource[0], 0, + sdev->reg_addrs[0].reg_size, + "auxiliaryIO"); + if (!auxio_register) + return -ENODEV; + + auxio_report_dev(dev->node); + return 0; +} + +static struct of_platform_driver auxio_sbus_driver = { + .name = "auxio", + .match_table = auxio_match, + .probe = auxio_sbus_probe, +}; +#endif + #ifdef CONFIG_PCI - else { - struct linux_ebus *ebus; - struct linux_ebus_device *edev = NULL; - - for_each_ebus(ebus) { - for_each_ebusdev(edev, ebus) { - if (!strcmp(edev->prom_name, "auxio")) - goto ebus_done; - } - } - ebus_done: - if (edev) { - auxio_devtype = AUXIO_TYPE_EBUS; - auxio_register = - ioremap(edev->resource[0].start, sizeof(u32)); - } - } +static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match) +{ + struct linux_ebus_device *edev = to_ebus_device(&dev->dev); + + auxio_devtype = AUXIO_TYPE_EBUS; + auxio_register = ioremap(edev->resource[0].start, sizeof(u32)); + if (!auxio_register) + return -ENODEV; + + auxio_report_dev(dev->node); + auxio_set_led(AUXIO_LED_ON); + + return 0; +} + +static struct of_platform_driver auxio_ebus_driver = { + .name = "auxio", + .match_table = auxio_match, + .probe = auxio_ebus_probe, +}; #endif + +static int __init auxio_probe(void) +{ +#ifdef CONFIG_SBUS + of_register_driver(&auxio_sbus_driver, &sbus_bus_type); +#endif +#ifdef CONFIG_PCI + of_register_driver(&auxio_ebus_driver, &ebus_bus_type); +#endif + + return 0; } + +/* Must be after subsys_initcall() so that busses are probed. Must + * be before device_initcall() because things like the floppy driver + * need to use the AUXIO register. + */ +fs_initcall(auxio_probe); |