aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2007-05-15 05:39:49 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-07-12 09:28:21 -0400
commit34f3231f435dfb8e6c83271c63461fdd2901dc97 (patch)
treedd9d3f4fffcc07c68a4cf5ef00c28a954e89f751 /arch
parent4adb70fc1b9b545ce6221f0cc35a8fa0eab13461 (diff)
[ARM] pxa: move device registration into CPU-specific file
This allows individual CPU support to determine which platform devices should be registered. Also fix a copy-n-paste bug in the I2C power platform device entry. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/generic.c90
-rw-r--r--arch/arm/mach-pxa/generic.h11
-rw-r--r--arch/arm/mach-pxa/pxa25x.c22
-rw-r--r--arch/arm/mach-pxa/pxa27x.c36
4 files changed, 83 insertions, 76 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 147b7c40d9f9..a496e498ef57 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -242,7 +242,7 @@ static struct resource pxamci_resources[] = {
242 242
243static u64 pxamci_dmamask = 0xffffffffUL; 243static u64 pxamci_dmamask = 0xffffffffUL;
244 244
245static struct platform_device pxamci_device = { 245struct platform_device pxamci_device = {
246 .name = "pxa2xx-mci", 246 .name = "pxa2xx-mci",
247 .id = -1, 247 .id = -1,
248 .dev = { 248 .dev = {
@@ -281,7 +281,7 @@ static struct resource pxa2xx_udc_resources[] = {
281 281
282static u64 udc_dma_mask = ~(u32)0; 282static u64 udc_dma_mask = ~(u32)0;
283 283
284static struct platform_device udc_device = { 284struct platform_device pxaudc_device = {
285 .name = "pxa2xx-udc", 285 .name = "pxa2xx-udc",
286 .id = -1, 286 .id = -1,
287 .resource = pxa2xx_udc_resources, 287 .resource = pxa2xx_udc_resources,
@@ -307,7 +307,7 @@ static struct resource pxafb_resources[] = {
307 307
308static u64 fb_dma_mask = ~(u64)0; 308static u64 fb_dma_mask = ~(u64)0;
309 309
310static struct platform_device pxafb_device = { 310struct platform_device pxafb_device = {
311 .name = "pxa2xx-fb", 311 .name = "pxa2xx-fb",
312 .id = -1, 312 .id = -1,
313 .dev = { 313 .dev = {
@@ -328,24 +328,24 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
328 pxafb_device.dev.parent = parent_dev; 328 pxafb_device.dev.parent = parent_dev;
329} 329}
330 330
331static struct platform_device ffuart_device = { 331struct platform_device ffuart_device = {
332 .name = "pxa2xx-uart", 332 .name = "pxa2xx-uart",
333 .id = 0, 333 .id = 0,
334}; 334};
335static struct platform_device btuart_device = { 335struct platform_device btuart_device = {
336 .name = "pxa2xx-uart", 336 .name = "pxa2xx-uart",
337 .id = 1, 337 .id = 1,
338}; 338};
339static struct platform_device stuart_device = { 339struct platform_device stuart_device = {
340 .name = "pxa2xx-uart", 340 .name = "pxa2xx-uart",
341 .id = 2, 341 .id = 2,
342}; 342};
343static struct platform_device hwuart_device = { 343struct platform_device hwuart_device = {
344 .name = "pxa2xx-uart", 344 .name = "pxa2xx-uart",
345 .id = 3, 345 .id = 3,
346}; 346};
347 347
348static struct resource i2c_resources[] = { 348static struct resource pxai2c_resources[] = {
349 { 349 {
350 .start = 0x40301680, 350 .start = 0x40301680,
351 .end = 0x403016a3, 351 .end = 0x403016a3,
@@ -357,40 +357,19 @@ static struct resource i2c_resources[] = {
357 }, 357 },
358}; 358};
359 359
360static struct platform_device i2c_device = { 360struct platform_device pxai2c_device = {
361 .name = "pxa2xx-i2c", 361 .name = "pxa2xx-i2c",
362 .id = 0, 362 .id = 0,
363 .resource = i2c_resources, 363 .resource = pxai2c_resources,
364 .num_resources = ARRAY_SIZE(i2c_resources), 364 .num_resources = ARRAY_SIZE(pxai2c_resources),
365}; 365};
366 366
367#ifdef CONFIG_PXA27x
368static struct resource i2c_power_resources[] = {
369 {
370 .start = 0x40f00180,
371 .end = 0x40f001a3,
372 .flags = IORESOURCE_MEM,
373 }, {
374 .start = IRQ_PWRI2C,
375 .end = IRQ_PWRI2C,
376 .flags = IORESOURCE_IRQ,
377 },
378};
379
380static struct platform_device i2c_power_device = {
381 .name = "pxa2xx-i2c",
382 .id = 1,
383 .resource = i2c_power_resources,
384 .num_resources = ARRAY_SIZE(i2c_resources),
385};
386#endif
387
388void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 367void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
389{ 368{
390 i2c_device.dev.platform_data = info; 369 pxai2c_device.dev.platform_data = info;
391} 370}
392 371
393static struct resource i2s_resources[] = { 372static struct resource pxai2s_resources[] = {
394 { 373 {
395 .start = 0x40400000, 374 .start = 0x40400000,
396 .end = 0x40400083, 375 .end = 0x40400083,
@@ -402,16 +381,16 @@ static struct resource i2s_resources[] = {
402 }, 381 },
403}; 382};
404 383
405static struct platform_device i2s_device = { 384struct platform_device pxai2s_device = {
406 .name = "pxa2xx-i2s", 385 .name = "pxa2xx-i2s",
407 .id = -1, 386 .id = -1,
408 .resource = i2s_resources, 387 .resource = pxai2s_resources,
409 .num_resources = ARRAY_SIZE(i2s_resources), 388 .num_resources = ARRAY_SIZE(pxai2s_resources),
410}; 389};
411 390
412static u64 pxaficp_dmamask = ~(u32)0; 391static u64 pxaficp_dmamask = ~(u32)0;
413 392
414static struct platform_device pxaficp_device = { 393struct platform_device pxaficp_device = {
415 .name = "pxa2xx-ir", 394 .name = "pxa2xx-ir",
416 .id = -1, 395 .id = -1,
417 .dev = { 396 .dev = {
@@ -425,40 +404,7 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
425 pxaficp_device.dev.platform_data = info; 404 pxaficp_device.dev.platform_data = info;
426} 405}
427 406
428static struct platform_device pxartc_device = { 407struct platform_device pxartc_device = {
429 .name = "sa1100-rtc", 408 .name = "sa1100-rtc",
430 .id = -1, 409 .id = -1,
431}; 410};
432
433static struct platform_device *devices[] __initdata = {
434 &pxamci_device,
435 &udc_device,
436 &pxafb_device,
437 &ffuart_device,
438 &btuart_device,
439 &stuart_device,
440 &pxaficp_device,
441 &i2c_device,
442#ifdef CONFIG_PXA27x
443 &i2c_power_device,
444#endif
445 &i2s_device,
446 &pxartc_device,
447};
448
449static int __init pxa_init(void)
450{
451 int ret;
452
453 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
454 if (ret)
455 return ret;
456
457 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
458 if (cpu_is_pxa25x())
459 ret = platform_device_register(&hwuart_device);
460
461 return ret;
462}
463
464subsys_initcall(pxa_init);
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 91ab2ad8b34b..b9b96ec4b9bc 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -26,3 +26,14 @@ extern unsigned int get_clk_frequency_khz(int info);
26 mi->bank[__nr].size = (__size), \ 26 mi->bank[__nr].size = (__size), \
27 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) 27 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
28 28
29extern struct platform_device pxamci_device;
30extern struct platform_device pxaudc_device;
31extern struct platform_device pxafb_device;
32extern struct platform_device ffuart_device;
33extern struct platform_device btuart_device;
34extern struct platform_device stuart_device;
35extern struct platform_device hwuart_device;
36extern struct platform_device pxai2c_device;
37extern struct platform_device pxai2s_device;
38extern struct platform_device pxaficp_device;
39extern struct platform_device pxartc_device;
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 13437582342d..72b949bdf658 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -19,6 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h>
22#include <linux/pm.h> 23#include <linux/pm.h>
23 24
24#include <asm/hardware.h> 25#include <asm/hardware.h>
@@ -136,6 +137,19 @@ void __init pxa25x_init_irq(void)
136 pxa_init_irq_gpio(85); 137 pxa_init_irq_gpio(85);
137} 138}
138 139
140static struct platform_device *pxa25x_devices[] __initdata = {
141 &pxamci_device,
142 &pxaudc_device,
143 &pxafb_device,
144 &ffuart_device,
145 &btuart_device,
146 &stuart_device,
147 &pxai2c_device,
148 &pxai2s_device,
149 &pxaficp_device,
150 &pxartc_device,
151};
152
139static int __init pxa25x_init(void) 153static int __init pxa25x_init(void)
140{ 154{
141 int ret = 0; 155 int ret = 0;
@@ -146,8 +160,14 @@ static int __init pxa25x_init(void)
146#ifdef CONFIG_PM 160#ifdef CONFIG_PM
147 pm_set_ops(&pxa25x_pm_ops); 161 pm_set_ops(&pxa25x_pm_ops);
148#endif 162#endif
163 ret = platform_add_devices(pxa25x_devices,
164 ARRAY_SIZE(pxa25x_devices));
149 } 165 }
150 return 0; 166 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
167 if (cpu_is_pxa25x())
168 ret = platform_device_register(&hwuart_device);
169
170 return ret;
151} 171}
152 172
153subsys_initcall(pxa25x_init); 173subsys_initcall(pxa25x_init);
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 5b819e2c5563..27fd2fa56eaf 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -184,7 +184,7 @@ static struct resource pxa27x_ohci_resources[] = {
184 }, 184 },
185}; 185};
186 186
187static struct platform_device ohci_device = { 187static struct platform_device pxaohci_device = {
188 .name = "pxa27x-ohci", 188 .name = "pxa27x-ohci",
189 .id = -1, 189 .id = -1,
190 .dev = { 190 .dev = {
@@ -197,11 +197,41 @@ static struct platform_device ohci_device = {
197 197
198void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) 198void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
199{ 199{
200 ohci_device.dev.platform_data = info; 200 pxaohci_device.dev.platform_data = info;
201} 201}
202 202
203static struct resource i2c_power_resources[] = {
204 {
205 .start = 0x40f00180,
206 .end = 0x40f001a3,
207 .flags = IORESOURCE_MEM,
208 }, {
209 .start = IRQ_PWRI2C,
210 .end = IRQ_PWRI2C,
211 .flags = IORESOURCE_IRQ,
212 },
213};
214
215static struct platform_device pxai2c_power_device = {
216 .name = "pxa2xx-i2c",
217 .id = 1,
218 .resource = i2c_power_resources,
219 .num_resources = ARRAY_SIZE(i2c_power_resources),
220};
221
203static struct platform_device *devices[] __initdata = { 222static struct platform_device *devices[] __initdata = {
204 &ohci_device, 223 &pxamci_device,
224 &pxaudc_device,
225 &pxafb_device,
226 &ffuart_device,
227 &btuart_device,
228 &stuart_device,
229 &pxai2c_device,
230 &pxai2c_power_device,
231 &pxai2s_device,
232 &pxaficp_device,
233 &pxartc_device,
234 &pxaohci_device,
205}; 235};
206 236
207void __init pxa27x_init_irq(void) 237void __init pxa27x_init_irq(void)