X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Fsparc64%2Fkernel%2Fauxio.c;h=dd5c7bf87619b1ef2a3f17fb4adffa1ee7911f26;hb=35437b6192d9a4eb92f095dfd72396b6d2970f0b;hp=2c42894b188fb414d3aa3708a1d8aecc853dbb83;hpb=4854c7b27f0975a2b629f35ea3996d2968eb7c4f;p=linux-2.6-omap-h63xx.git diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c index 2c42894b188..dd5c7bf8761 100644 --- a/arch/sparc64/kernel/auxio.c +++ b/arch/sparc64/kernel/auxio.c @@ -5,19 +5,18 @@ * Refactoring for unified NCR/PCIO support 2002 Eric Brower (ebrower@usa.net) */ -#include +#include #include #include #include +#include -#include +#include #include -#include -#include #include -/* This cannot be static, as it is referenced in irq.c */ void __iomem *auxio_register = NULL; +EXPORT_SYMBOL(auxio_register); enum auxio_type { AUXIO_TYPE_NODEV, @@ -110,12 +109,6 @@ void auxio_set_lte(int on) } } -static void __devinit auxio_report_dev(struct device_node *dp) -{ - printk(KERN_INFO "AUXIO: Found device at %s\n", - dp->full_name); -} - static struct of_device_id auxio_match[] = { { .name = "auxio", @@ -125,67 +118,50 @@ static struct of_device_id auxio_match[] = { 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) +static int __devinit auxio_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) + struct device_node *dp = dev->node; + unsigned long size; + + if (!strcmp(dp->parent->name, "ebus")) { + auxio_devtype = AUXIO_TYPE_EBUS; + size = sizeof(u32); + } else if (!strcmp(dp->parent->name, "sbus")) { + auxio_devtype = AUXIO_TYPE_SBUS; + size = 1; + } else { + printk("auxio: Unknown parent bus type [%s]\n", + dp->parent->name); 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 -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)); + } + auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio"); if (!auxio_register) return -ENODEV; - auxio_report_dev(dev->node); + printk(KERN_INFO "AUXIO: Found device at %s\n", + dp->full_name); - auxio_set_led(AUXIO_LED_ON); + if (auxio_devtype == AUXIO_TYPE_EBUS) + auxio_set_led(AUXIO_LED_ON); return 0; } -static struct of_platform_driver auxio_ebus_driver = { - .name = "auxio", +static struct of_platform_driver auxio_driver = { .match_table = auxio_match, - .probe = auxio_ebus_probe, + .probe = auxio_probe, + .driver = { + .name = "auxio", + }, }; -#endif -static int __init auxio_probe(void) +static int __init auxio_init(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; + return of_register_driver(&auxio_driver, &of_platform_bus_type); } /* 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); +fs_initcall(auxio_init);