diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 01:46:49 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:16:21 -0400 |
commit | b5ba0740f852f4ad86ba7f21267bc77027d60703 (patch) | |
tree | efdcf4d668dd3b65ca1ef9f2898134ff4122da62 /arch/sparc64/kernel | |
parent | 4f62d158a32d9f470377a7bd6dcb797b42afe5f3 (diff) |
[SPARC64]: Make auxio a real driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/auxio.c | 109 | ||||
-rw-r--r-- | arch/sparc64/kernel/ebus.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 2 |
3 files changed, 74 insertions, 45 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 | ||
113 | void __init auxio_probe(void) | 113 | static 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) { | 119 | static 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 | }; | |
125 | found_sdev: | 125 | |
126 | if (sdev) { | 126 | MODULE_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, | 129 | static 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 | |||
144 | static 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 { | 152 | static 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 | |||
168 | static 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 | |||
175 | static 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 | */ | ||
191 | fs_initcall(auxio_probe); | ||
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c index b390a2f3a15e..98e0a8cbeecd 100644 --- a/arch/sparc64/kernel/ebus.c +++ b/arch/sparc64/kernel/ebus.c | |||
@@ -269,10 +269,6 @@ EXPORT_SYMBOL(ebus_dma_enable); | |||
269 | 269 | ||
270 | struct linux_ebus *ebus_chain = NULL; | 270 | struct linux_ebus *ebus_chain = NULL; |
271 | 271 | ||
272 | #ifdef CONFIG_SUN_AUXIO | ||
273 | extern void auxio_probe(void); | ||
274 | #endif | ||
275 | |||
276 | static inline void *ebus_alloc(size_t size) | 272 | static inline void *ebus_alloc(size_t size) |
277 | { | 273 | { |
278 | void *mem; | 274 | void *mem; |
@@ -630,8 +626,4 @@ void __init ebus_init(void) | |||
630 | ++num_ebus; | 626 | ++num_ebus; |
631 | } | 627 | } |
632 | pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */ | 628 | pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */ |
633 | |||
634 | #ifdef CONFIG_SUN_AUXIO | ||
635 | auxio_probe(); | ||
636 | #endif | ||
637 | } | 629 | } |
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index d3da23cdc264..ac05e0f692ef 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c | |||
@@ -1269,10 +1269,8 @@ int __init sbus_arch_preinit(void) | |||
1269 | void __init sbus_arch_postinit(void) | 1269 | void __init sbus_arch_postinit(void) |
1270 | { | 1270 | { |
1271 | extern void firetruck_init(void); | 1271 | extern void firetruck_init(void); |
1272 | extern void auxio_probe(void); | ||
1273 | extern void clock_probe(void); | 1272 | extern void clock_probe(void); |
1274 | 1273 | ||
1275 | firetruck_init(); | 1274 | firetruck_init(); |
1276 | auxio_probe(); | ||
1277 | clock_probe(); | 1275 | clock_probe(); |
1278 | } | 1276 | } |