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

[SPARC64]: Make auxio a real driver.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4f62d158
...@@ -110,43 +110,82 @@ void auxio_set_lte(int on) ...@@ -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; printk(KERN_INFO "AUXIO: Found device at %s\n",
struct sbus_dev *sdev = NULL; dp->full_name);
}
for_each_sbus(sbus) {
for_each_sbusdev(sdev, sbus) { static struct of_device_id auxio_match[] = {
if(!strcmp(sdev->prom_name, "auxio")) {
goto found_sdev; .name = "auxio",
} },
} {},
};
found_sdev:
if (sdev) { MODULE_DEVICE_TABLE(of, auxio_match);
auxio_devtype = AUXIO_TYPE_SBUS;
auxio_register = sbus_ioremap(&sdev->resource[0], 0, #ifdef CONFIG_SBUS
sdev->reg_addrs[0].reg_size, static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match)
"auxiliaryIO"); {
} 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 #ifdef CONFIG_PCI
else { static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match)
struct linux_ebus *ebus; {
struct linux_ebus_device *edev = NULL; struct linux_ebus_device *edev = to_ebus_device(&dev->dev);
for_each_ebus(ebus) { auxio_devtype = AUXIO_TYPE_EBUS;
for_each_ebusdev(edev, ebus) { auxio_register = ioremap(edev->resource[0].start, sizeof(u32));
if (!strcmp(edev->prom_node->name, "auxio")) if (!auxio_register)
goto ebus_done; return -ENODEV;
}
} auxio_report_dev(dev->node);
ebus_done:
if (edev) {
auxio_devtype = AUXIO_TYPE_EBUS;
auxio_register =
ioremap(edev->resource[0].start, sizeof(u32));
}
}
auxio_set_led(AUXIO_LED_ON); 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 #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);
...@@ -269,10 +269,6 @@ EXPORT_SYMBOL(ebus_dma_enable); ...@@ -269,10 +269,6 @@ EXPORT_SYMBOL(ebus_dma_enable);
struct linux_ebus *ebus_chain = NULL; struct linux_ebus *ebus_chain = NULL;
#ifdef CONFIG_SUN_AUXIO
extern void auxio_probe(void);
#endif
static inline void *ebus_alloc(size_t size) static inline void *ebus_alloc(size_t size)
{ {
void *mem; void *mem;
...@@ -630,8 +626,4 @@ void __init ebus_init(void) ...@@ -630,8 +626,4 @@ void __init ebus_init(void)
++num_ebus; ++num_ebus;
} }
pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */ pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */
#ifdef CONFIG_SUN_AUXIO
auxio_probe();
#endif
} }
...@@ -1269,10 +1269,8 @@ int __init sbus_arch_preinit(void) ...@@ -1269,10 +1269,8 @@ int __init sbus_arch_preinit(void)
void __init sbus_arch_postinit(void) void __init sbus_arch_postinit(void)
{ {
extern void firetruck_init(void); extern void firetruck_init(void);
extern void auxio_probe(void);
extern void clock_probe(void); extern void clock_probe(void);
firetruck_init(); firetruck_init();
auxio_probe();
clock_probe(); clock_probe();
} }
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