diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-09-09 04:19:41 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-09-09 04:19:41 -0400 |
commit | 5cf0942123bcacf8af8922eaf3fef70bce6078e6 (patch) | |
tree | dab835e2c2417e4e02071e141dd5c6776ef29e25 /arch/arm | |
parent | 282b13d066927aeba7137ce3c03d2ee69b8d4940 (diff) |
i.MX3: 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-mx3/devices.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-mx3/pcm037.c | 6 |
3 files changed, 15 insertions, 40 deletions
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c index e08c6a8ac56b..a6bdcc07f3c9 100644 --- a/arch/arm/mach-mx3/devices.c +++ b/arch/arm/mach-mx3/devices.c | |||
@@ -36,7 +36,7 @@ static struct resource uart0[] = { | |||
36 | }, | 36 | }, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static struct platform_device mxc_uart_device0 = { | 39 | struct platform_device mxc_uart_device0 = { |
40 | .name = "imx-uart", | 40 | .name = "imx-uart", |
41 | .id = 0, | 41 | .id = 0, |
42 | .resource = uart0, | 42 | .resource = uart0, |
@@ -55,7 +55,7 @@ static struct resource uart1[] = { | |||
55 | }, | 55 | }, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static struct platform_device mxc_uart_device1 = { | 58 | struct platform_device mxc_uart_device1 = { |
59 | .name = "imx-uart", | 59 | .name = "imx-uart", |
60 | .id = 1, | 60 | .id = 1, |
61 | .resource = uart1, | 61 | .resource = uart1, |
@@ -74,7 +74,7 @@ static struct resource uart2[] = { | |||
74 | }, | 74 | }, |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static struct platform_device mxc_uart_device2 = { | 77 | struct platform_device mxc_uart_device2 = { |
78 | .name = "imx-uart", | 78 | .name = "imx-uart", |
79 | .id = 2, | 79 | .id = 2, |
80 | .resource = uart2, | 80 | .resource = uart2, |
@@ -93,7 +93,7 @@ static struct resource uart3[] = { | |||
93 | }, | 93 | }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static struct platform_device mxc_uart_device3 = { | 96 | struct platform_device mxc_uart_device3 = { |
97 | .name = "imx-uart", | 97 | .name = "imx-uart", |
98 | .id = 3, | 98 | .id = 3, |
99 | .resource = uart3, | 99 | .resource = uart3, |
@@ -112,46 +112,13 @@ static struct resource uart4[] = { | |||
112 | }, | 112 | }, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static struct platform_device mxc_uart_device4 = { | 115 | struct platform_device mxc_uart_device4 = { |
116 | .name = "imx-uart", | 116 | .name = "imx-uart", |
117 | .id = 4, | 117 | .id = 4, |
118 | .resource = uart4, | 118 | .resource = uart4, |
119 | .num_resources = ARRAY_SIZE(uart4), | 119 | .num_resources = ARRAY_SIZE(uart4), |
120 | }; | 120 | }; |
121 | 121 | ||
122 | /* | ||
123 | * Register only those UARTs that physically exist | ||
124 | */ | ||
125 | int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata) | ||
126 | { | ||
127 | switch (uart_no) { | ||
128 | case 0: | ||
129 | mxc_uart_device0.dev.platform_data = pdata; | ||
130 | platform_device_register(&mxc_uart_device0); | ||
131 | break; | ||
132 | case 1: | ||
133 | mxc_uart_device1.dev.platform_data = pdata; | ||
134 | platform_device_register(&mxc_uart_device1); | ||
135 | break; | ||
136 | case 2: | ||
137 | mxc_uart_device2.dev.platform_data = pdata; | ||
138 | platform_device_register(&mxc_uart_device2); | ||
139 | break; | ||
140 | case 3: | ||
141 | mxc_uart_device3.dev.platform_data = pdata; | ||
142 | platform_device_register(&mxc_uart_device3); | ||
143 | break; | ||
144 | case 4: | ||
145 | mxc_uart_device4.dev.platform_data = pdata; | ||
146 | platform_device_register(&mxc_uart_device4); | ||
147 | break; | ||
148 | default: | ||
149 | return -ENODEV; | ||
150 | } | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | /* GPIO port description */ | 122 | /* GPIO port description */ |
156 | static struct mxc_gpio_port imx_gpio_ports[] = { | 123 | static struct mxc_gpio_port imx_gpio_ports[] = { |
157 | [0] = { | 124 | [0] = { |
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h new file mode 100644 index 000000000000..4dc03f9e6001 --- /dev/null +++ b/arch/arm/mach-mx3/devices.h | |||
@@ -0,0 +1,6 @@ | |||
1 | |||
2 | extern struct platform_device mxc_uart_device0; | ||
3 | extern struct platform_device mxc_uart_device1; | ||
4 | extern struct platform_device mxc_uart_device2; | ||
5 | extern struct platform_device mxc_uart_device3; | ||
6 | extern struct platform_device mxc_uart_device4; | ||
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c index 0a152ed15a85..03374f9e0000 100644 --- a/arch/arm/mach-mx3/pcm037.c +++ b/arch/arm/mach-mx3/pcm037.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <mach/iomux-mx3.h> | 33 | #include <mach/iomux-mx3.h> |
34 | #include <mach/board-pcm037.h> | 34 | #include <mach/board-pcm037.h> |
35 | 35 | ||
36 | #include "devices.h" | ||
37 | |||
36 | static struct physmap_flash_data pcm037_flash_data = { | 38 | static struct physmap_flash_data pcm037_flash_data = { |
37 | .width = 2, | 39 | .width = 2, |
38 | }; | 40 | }; |
@@ -73,12 +75,12 @@ static void __init mxc_board_init(void) | |||
73 | mxc_iomux_mode(MX31_PIN_TXD1__TXD1); | 75 | mxc_iomux_mode(MX31_PIN_TXD1__TXD1); |
74 | mxc_iomux_mode(MX31_PIN_RXD1__RXD1); | 76 | mxc_iomux_mode(MX31_PIN_RXD1__RXD1); |
75 | 77 | ||
76 | imx_init_uart(0, &uart_pdata); | 78 | mxc_register_device(&mxc_uart_device0, &uart_pdata); |
77 | 79 | ||
78 | mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3); | 80 | mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3); |
79 | mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3); | 81 | mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3); |
80 | 82 | ||
81 | imx_init_uart(2, &uart_pdata); | 83 | mxc_register_device(&mxc_uart_device2, &uart_pdata); |
82 | } | 84 | } |
83 | 85 | ||
84 | /* | 86 | /* |