aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc64/kernel/auxio.c73
1 files changed, 24 insertions, 49 deletions
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index c2c69c167d18..287d066f7d01 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -111,12 +111,6 @@ void auxio_set_lte(int on)
111 } 111 }
112} 112}
113 113
114static void __devinit auxio_report_dev(struct device_node *dp)
115{
116 printk(KERN_INFO "AUXIO: Found device at %s\n",
117 dp->full_name);
118}
119
120static struct of_device_id auxio_match[] = { 114static struct of_device_id auxio_match[] = {
121 { 115 {
122 .name = "auxio", 116 .name = "auxio",
@@ -126,67 +120,48 @@ static struct of_device_id auxio_match[] = {
126 120
127MODULE_DEVICE_TABLE(of, auxio_match); 121MODULE_DEVICE_TABLE(of, auxio_match);
128 122
129#ifdef CONFIG_SBUS 123static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match)
130static int __devinit auxio_sbus_probe(struct of_device *dev, const struct of_device_id *match)
131{ 124{
132 struct sbus_dev *sdev = to_sbus_device(&dev->dev); 125 struct device_node *dp = dev->node;
133 126 unsigned long size;
134 auxio_devtype = AUXIO_TYPE_SBUS; 127
135 auxio_register = sbus_ioremap(&sdev->resource[0], 0, 128 if (!strcmp(dp->parent->name, "ebus")) {
136 sdev->reg_addrs[0].reg_size, 129 auxio_devtype = AUXIO_TYPE_EBUS;
137 "auxiliaryIO"); 130 size = sizeof(u32);
138 if (!auxio_register) 131 } else if (!strcmp(dp->parent->name, "sbus")) {
132 auxio_devtype = AUXIO_TYPE_SBUS;
133 size = 1;
134 } else {
135 printk("auxio: Unknown parent bus type [%s]\n",
136 dp->parent->name);
139 return -ENODEV; 137 return -ENODEV;
140 138 }
141 auxio_report_dev(dev->node); 139 auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio");
142 return 0;
143}
144
145static struct of_platform_driver auxio_sbus_driver = {
146 .name = "auxio",
147 .match_table = auxio_match,
148 .probe = auxio_sbus_probe,
149};
150#endif
151
152#ifdef CONFIG_PCI
153static int __devinit auxio_ebus_probe(struct of_device *dev, const struct of_device_id *match)
154{
155 struct linux_ebus_device *edev = to_ebus_device(&dev->dev);
156
157 auxio_devtype = AUXIO_TYPE_EBUS;
158 auxio_register = ioremap(edev->resource[0].start, sizeof(u32));
159 if (!auxio_register) 140 if (!auxio_register)
160 return -ENODEV; 141 return -ENODEV;
161 142
162 auxio_report_dev(dev->node); 143 printk(KERN_INFO "AUXIO: Found device at %s\n",
144 dp->full_name);
163 145
164 auxio_set_led(AUXIO_LED_ON); 146 if (auxio_devtype == AUXIO_TYPE_EBUS)
147 auxio_set_led(AUXIO_LED_ON);
165 148
166 return 0; 149 return 0;
167} 150}
168 151
169static struct of_platform_driver auxio_ebus_driver = { 152static struct of_platform_driver auxio_driver = {
170 .name = "auxio", 153 .name = "auxio",
171 .match_table = auxio_match, 154 .match_table = auxio_match,
172 .probe = auxio_ebus_probe, 155 .probe = auxio_probe,
173}; 156};
174#endif
175 157
176static int __init auxio_probe(void) 158static int __init auxio_init(void)
177{ 159{
178#ifdef CONFIG_SBUS 160 return of_register_driver(&auxio_driver, &of_bus_type);
179 of_register_driver(&auxio_sbus_driver, &sbus_bus_type);
180#endif
181#ifdef CONFIG_PCI
182 of_register_driver(&auxio_ebus_driver, &ebus_bus_type);
183#endif
184
185 return 0;
186} 161}
187 162
188/* Must be after subsys_initcall() so that busses are probed. Must 163/* Must be after subsys_initcall() so that busses are probed. Must
189 * be before device_initcall() because things like the floppy driver 164 * be before device_initcall() because things like the floppy driver
190 * need to use the AUXIO register. 165 * need to use the AUXIO register.
191 */ 166 */
192fs_initcall(auxio_probe); 167fs_initcall(auxio_init);