aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-09-09 04:19:41 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2008-09-09 04:19:41 -0400
commit7e90534a8fde3a528606ada5dedfa244d8e0452d (patch)
tree98d17fafc1c882d80af25258cec14f7bb4b91517 /arch/arm
parent5cf0942123bcacf8af8922eaf3fef70bce6078e6 (diff)
i.MX2: make SoC devices globally available
Make SoC devices globally available to boards rather than using a device specific init function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mx2/devices.h15
-rw-r--r--arch/arm/mach-mx2/mx27ads.c12
-rw-r--r--arch/arm/mach-mx2/pcm038.c8
-rw-r--r--arch/arm/mach-mx2/serial.c51
4 files changed, 34 insertions, 52 deletions
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-mx2/devices.h
new file mode 100644
index 000000000000..c77a4b8f73b4
--- /dev/null
+++ b/arch/arm/mach-mx2/devices.h
@@ -0,0 +1,15 @@
1
2extern struct platform_device mxc_gpt1;
3extern struct platform_device mxc_gpt2;
4extern struct platform_device mxc_gpt3;
5extern struct platform_device mxc_gpt4;
6extern struct platform_device mxc_gpt5;
7extern struct platform_device mxc_wdt;
8extern struct platform_device mxc_irda_device;
9extern struct platform_device mxc_uart_device0;
10extern struct platform_device mxc_uart_device1;
11extern struct platform_device mxc_uart_device2;
12extern struct platform_device mxc_uart_device3;
13extern struct platform_device mxc_uart_device4;
14extern struct platform_device mxc_uart_device5;
15
diff --git a/arch/arm/mach-mx2/mx27ads.c b/arch/arm/mach-mx2/mx27ads.c
index 4ce56ef4d8d3..56e22d3ca075 100644
--- a/arch/arm/mach-mx2/mx27ads.c
+++ b/arch/arm/mach-mx2/mx27ads.c
@@ -34,6 +34,8 @@
34#include <mach/iomux-mx1-mx2.h> 34#include <mach/iomux-mx1-mx2.h>
35#include <mach/board-mx27ads.h> 35#include <mach/board-mx27ads.h>
36 36
37#include "devices.h"
38
37/* ADS's NOR flash */ 39/* ADS's NOR flash */
38static struct physmap_flash_data mx27ads_flash_data = { 40static struct physmap_flash_data mx27ads_flash_data = {
39 .width = 2, 41 .width = 2,
@@ -251,12 +253,14 @@ static struct imxuart_platform_data uart_pdata[] = {
251 253
252static void __init mx27ads_board_init(void) 254static void __init mx27ads_board_init(void)
253{ 255{
254 int i;
255
256 gpio_fec_active(); 256 gpio_fec_active();
257 257
258 for (i = 0; i < 6; i++) 258 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
259 imx_init_uart(i, &uart_pdata[i]); 259 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
260 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
261 mxc_register_device(&mxc_uart_device3, &uart_pdata[3]);
262 mxc_register_device(&mxc_uart_device4, &uart_pdata[4]);
263 mxc_register_device(&mxc_uart_device5, &uart_pdata[5]);
260 264
261 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 265 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
262} 266}
diff --git a/arch/arm/mach-mx2/pcm038.c b/arch/arm/mach-mx2/pcm038.c
index 1028f453cfc8..7f55746e2591 100644
--- a/arch/arm/mach-mx2/pcm038.c
+++ b/arch/arm/mach-mx2/pcm038.c
@@ -28,6 +28,8 @@
28#include <mach/imx-uart.h> 28#include <mach/imx-uart.h>
29#include <mach/board-pcm038.h> 29#include <mach/board-pcm038.h>
30 30
31#include "devices.h"
32
31/* 33/*
32 * Phytec's phyCORE-i.MX27 comes with 32MiB flash, 34 * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
33 * 16 bit width 35 * 16 bit width
@@ -170,11 +172,11 @@ static struct platform_device *platform_devices[] __initdata = {
170 172
171static void __init pcm038_init(void) 173static void __init pcm038_init(void)
172{ 174{
173 int i;
174 gpio_fec_active(); 175 gpio_fec_active();
175 176
176 for (i = 0; i < 3; i++) 177 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
177 imx_init_uart(i, &uart_pdata[i]); 178 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
179 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
178 180
179 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 181 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
180 182
diff --git a/arch/arm/mach-mx2/serial.c b/arch/arm/mach-mx2/serial.c
index e31fd44f7941..16debc296dad 100644
--- a/arch/arm/mach-mx2/serial.c
+++ b/arch/arm/mach-mx2/serial.c
@@ -35,7 +35,7 @@ static struct resource uart0[] = {
35 }, 35 },
36}; 36};
37 37
38static struct platform_device mxc_uart_device0 = { 38struct platform_device mxc_uart_device0 = {
39 .name = "imx-uart", 39 .name = "imx-uart",
40 .id = 0, 40 .id = 0,
41 .resource = uart0, 41 .resource = uart0,
@@ -54,7 +54,7 @@ static struct resource uart1[] = {
54 }, 54 },
55}; 55};
56 56
57static struct platform_device mxc_uart_device1 = { 57struct platform_device mxc_uart_device1 = {
58 .name = "imx-uart", 58 .name = "imx-uart",
59 .id = 1, 59 .id = 1,
60 .resource = uart1, 60 .resource = uart1,
@@ -73,7 +73,7 @@ static struct resource uart2[] = {
73 }, 73 },
74}; 74};
75 75
76static struct platform_device mxc_uart_device2 = { 76struct platform_device mxc_uart_device2 = {
77 .name = "imx-uart", 77 .name = "imx-uart",
78 .id = 2, 78 .id = 2,
79 .resource = uart2, 79 .resource = uart2,
@@ -92,7 +92,7 @@ static struct resource uart3[] = {
92 }, 92 },
93}; 93};
94 94
95static struct platform_device mxc_uart_device3 = { 95struct platform_device mxc_uart_device3 = {
96 .name = "imx-uart", 96 .name = "imx-uart",
97 .id = 3, 97 .id = 3,
98 .resource = uart3, 98 .resource = uart3,
@@ -111,7 +111,7 @@ static struct resource uart4[] = {
111 }, 111 },
112}; 112};
113 113
114static struct platform_device mxc_uart_device4 = { 114struct platform_device mxc_uart_device4 = {
115 .name = "imx-uart", 115 .name = "imx-uart",
116 .id = 4, 116 .id = 4,
117 .resource = uart4, 117 .resource = uart4,
@@ -130,48 +130,9 @@ static struct resource uart5[] = {
130 }, 130 },
131}; 131};
132 132
133static struct platform_device mxc_uart_device5 = { 133struct platform_device mxc_uart_device5 = {
134 .name = "imx-uart", 134 .name = "imx-uart",
135 .id = 5, 135 .id = 5,
136 .resource = uart5, 136 .resource = uart5,
137 .num_resources = ARRAY_SIZE(uart5), 137 .num_resources = ARRAY_SIZE(uart5),
138}; 138};
139
140/*
141 * Register only those UARTs that physically exists
142 */
143int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
144{
145 switch (uart_no) {
146 case 0:
147 mxc_uart_device0.dev.platform_data = pdata;
148 platform_device_register(&mxc_uart_device0);
149 break;
150 case 1:
151 mxc_uart_device1.dev.platform_data = pdata;
152 platform_device_register(&mxc_uart_device1);
153 break;
154#ifndef CONFIG_MXC_IRDA
155 case 2:
156 mxc_uart_device2.dev.platform_data = pdata;
157 platform_device_register(&mxc_uart_device2);
158 break;
159#endif
160 case 3:
161 mxc_uart_device3.dev.platform_data = pdata;
162 platform_device_register(&mxc_uart_device3);
163 break;
164 case 4:
165 mxc_uart_device4.dev.platform_data = pdata;
166 platform_device_register(&mxc_uart_device4);
167 break;
168 case 5:
169 mxc_uart_device5.dev.platform_data = pdata;
170 platform_device_register(&mxc_uart_device5);
171 break;
172 default:
173 return -ENODEV;
174 }
175
176 return 0;
177}