aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/auxio.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 01:46:49 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:16:21 -0400
commitb5ba0740f852f4ad86ba7f21267bc77027d60703 (patch)
treeefdcf4d668dd3b65ca1ef9f2898134ff4122da62 /arch/sparc64/kernel/auxio.c
parent4f62d158a32d9f470377a7bd6dcb797b42afe5f3 (diff)
[SPARC64]: Make auxio a real driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/auxio.c')
-rw-r--r--arch/sparc64/kernel/auxio.c109
1 files changed, 74 insertions, 35 deletions
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index db36b66a4e3c..2c42894b188f 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -110,43 +110,82 @@ void auxio_set_lte(int on)
110 } 110 }
111} 111}
112 112
113void __init auxio_probe(void) 113static void __devinit auxio_report_dev(struct device_node *dp)
114{ 114{
115 struct sbus_bus *sbus; 115 printk(KERN_INFO "AUXIO: Found device at %s\n",
116 struct sbus_dev *sdev = NULL; 116 dp->full_name);
117 117}
118 for_each_sbus(sbus) { 118
119 for_each_sbusdev(sdev, sbus) { 119static struct of_device_id auxio_match[] = {
120 if(!strcmp(sdev->prom_name, "auxio")) 120 {
121 goto found_sdev; 121 .name = "auxio",
122 } 122 },
123 } 123 {},
124 124};
125found_sdev: 125
126 if (sdev) { 126MODULE_DEVICE_TABLE(of, auxio_match);
127 auxio_devtype = AUXIO_TYPE_SBUS; 127
128 auxio_register = sbus_ioremap(&sdev->resource[0], 0, 128#ifdef CONFIG_SBUS
129 sdev->reg_addrs[0].reg_size, 129static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match)
130 "auxiliaryIO"); 130{
131 } 131 struct sbus_dev *sdev = to_sbus_device(&dev->dev);
132
133 auxio_devtype = AUXIO_TYPE_SBUS;
134 auxio_register = sbus_ioremap(&sdev->resource[0], 0,
135 sdev->reg_addrs[0].reg_size,
136 "auxiliaryIO");
137 if (!auxio_register)
138 return -ENODEV;
139
140 auxio_report_dev(dev->node);
141 return 0;
142}
143
144static struct of_platform_driver auxio_sbus_driver = {
145 .name = "auxio",
146 .match_table = auxio_match,
147 .probe = auxio_sbus_probe,
148};
149#endif
150
132#ifdef CONFIG_PCI 151#ifdef CONFIG_PCI
133 else { 152static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match)
134 struct linux_ebus *ebus; 153{
135 struct linux_ebus_device *edev = NULL; 154 struct linux_ebus_device *edev = to_ebus_device(&dev->dev);
136 155
137 for_each_ebus(ebus) { 156 auxio_devtype = AUXIO_TYPE_EBUS;
138 for_each_ebusdev(edev, ebus) { 157 auxio_register = ioremap(edev->resource[0].start, sizeof(u32));
139 if (!strcmp(edev->prom_node->name, "auxio")) 158 if (!auxio_register)
140 goto ebus_done; 159 return -ENODEV;
141 } 160
142 } 161 auxio_report_dev(dev->node);
143 ebus_done: 162
144 if (edev) {
145 auxio_devtype = AUXIO_TYPE_EBUS;
146 auxio_register =
147 ioremap(edev->resource[0].start, sizeof(u32));
148 }
149 }
150 auxio_set_led(AUXIO_LED_ON); 163 auxio_set_led(AUXIO_LED_ON);
164
165 return 0;
166}
167
168static struct of_platform_driver auxio_ebus_driver = {
169 .name = "auxio",
170 .match_table = auxio_match,
171 .probe = auxio_ebus_probe,
172};
151#endif 173#endif
174
175static int __init auxio_probe(void)
176{
177#ifdef CONFIG_SBUS
178 of_register_driver(&auxio_sbus_driver, &sbus_bus_type);
179#endif
180#ifdef CONFIG_PCI
181 of_register_driver(&auxio_ebus_driver, &ebus_bus_type);
182#endif
183
184 return 0;
152} 185}
186
187/* Must be after subsys_initcall() so that busses are probed. Must
188 * be before device_initcall() because things like the floppy driver
189 * need to use the AUXIO register.
190 */
191fs_initcall(auxio_probe);