aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-08-11 16:23:06 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-01 03:32:55 -0400
commit04b73b1571c26d491c62c42cb06b96bf482fa7a2 (patch)
tree1854fdcae02f4bb0b38af0e8630c826a705f615f
parent2b82e64d787f9d1a5d304da137c2b1bdbe3b2d9d (diff)
ARM: mx51: dynamically register imx-uart devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mx5/Kconfig3
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c6
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c9
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c10
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h4
-rw-r--r--arch/arm/mach-mx5/devices.c57
-rw-r--r--arch/arm/mach-mx5/devices.h3
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c7
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c10
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h6
10 files changed, 36 insertions, 79 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 2735314a78e0..65bf34e1a4f6 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -11,6 +11,7 @@ comment "MX5 platforms:"
11config MACH_MX51_BABBAGE 11config MACH_MX51_BABBAGE
12 bool "Support MX51 BABBAGE platforms" 12 bool "Support MX51 BABBAGE platforms"
13 select IMX_HAVE_PLATFORM_IMX_I2C 13 select IMX_HAVE_PLATFORM_IMX_I2C
14 select IMX_HAVE_PLATFORM_IMX_UART
14 help 15 help
15 Include support for MX51 Babbage platform, also known as MX51EVK in 16 Include support for MX51 Babbage platform, also known as MX51EVK in
16 u-boot. This includes specific configurations for the board and its 17 u-boot. This includes specific configurations for the board and its
@@ -18,6 +19,7 @@ config MACH_MX51_BABBAGE
18 19
19config MACH_MX51_3DS 20config MACH_MX51_3DS
20 bool "Support MX51PDK (3DS)" 21 bool "Support MX51PDK (3DS)"
22 select IMX_HAVE_PLATFORM_IMX_UART
21 select IMX_HAVE_PLATFORM_SPI_IMX 23 select IMX_HAVE_PLATFORM_SPI_IMX
22 select MXC_DEBUG_BOARD 24 select MXC_DEBUG_BOARD
23 help 25 help
@@ -27,6 +29,7 @@ config MACH_MX51_3DS
27config MACH_EUKREA_CPUIMX51 29config MACH_EUKREA_CPUIMX51
28 bool "Support Eukrea CPUIMX51 module" 30 bool "Support Eukrea CPUIMX51 module"
29 select IMX_HAVE_PLATFORM_IMX_I2C 31 select IMX_HAVE_PLATFORM_IMX_I2C
32 select IMX_HAVE_PLATFORM_IMX_UART
30 help 33 help
31 Include support for Eukrea CPUIMX51 platform. This includes 34 Include support for Eukrea CPUIMX51 platform. This includes
32 specific configurations for the module and its peripherals. 35 specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index d52f2527f6bf..a6c09c7ff728 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -28,7 +28,6 @@
28#include <mach/eukrea-baseboards.h> 28#include <mach/eukrea-baseboards.h>
29#include <mach/common.h> 29#include <mach/common.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/imx-uart.h>
32#include <mach/iomux-mx51.h> 31#include <mach/iomux-mx51.h>
33#include <mach/mxc_ehci.h> 32#include <mach/mxc_ehci.h>
34 33
@@ -38,6 +37,7 @@
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
39#include <asm/mach/time.h> 38#include <asm/mach/time.h>
40 39
40#include "devices-imx51.h"
41#include "devices.h" 41#include "devices.h"
42 42
43#define CPUIMX51_USBH1_STP (0*32 + 27) 43#define CPUIMX51_USBH1_STP (0*32 + 27)
@@ -147,7 +147,7 @@ static struct pad_desc eukrea_cpuimx51_pads[] = {
147 MX51_PAD_USBH1_STP__USBH1_STP, 147 MX51_PAD_USBH1_STP__USBH1_STP,
148}; 148};
149 149
150static struct imxuart_platform_data uart_pdata = { 150static const struct imxuart_platform_data uart_pdata __initconst = {
151 .flags = IMXUART_HAVE_RTSCTS, 151 .flags = IMXUART_HAVE_RTSCTS,
152}; 152};
153 153
@@ -239,7 +239,7 @@ static void __init eukrea_cpuimx51_init(void)
239 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, 239 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
240 ARRAY_SIZE(eukrea_cpuimx51_pads)); 240 ARRAY_SIZE(eukrea_cpuimx51_pads));
241 241
242 mxc_register_device(&mxc_uart_device0, &uart_pdata); 242 imx51_add_imx_uart(0, &uart_pdata);
243 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq"); 243 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
244 gpio_direction_input(CPUIMX51_QUARTA_GPIO); 244 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
245 gpio_free(CPUIMX51_QUARTA_GPIO); 245 gpio_free(CPUIMX51_QUARTA_GPIO);
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
index b9d3331ba308..ed08a2352a1a 100644
--- a/arch/arm/mach-mx5/board-mx51_3ds.c
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -22,7 +22,6 @@
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/common.h> 23#include <mach/common.h>
24#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
25#include <mach/imx-uart.h>
26#include <mach/3ds_debugboard.h> 25#include <mach/3ds_debugboard.h>
27 26
28#include "devices-imx51.h" 27#include "devices-imx51.h"
@@ -74,15 +73,15 @@ static struct pad_desc mx51_3ds_pads[] = {
74 73
75/* Serial ports */ 74/* Serial ports */
76#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 75#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
77static struct imxuart_platform_data uart_pdata = { 76static const struct imxuart_platform_data uart_pdata __initconst = {
78 .flags = IMXUART_HAVE_RTSCTS, 77 .flags = IMXUART_HAVE_RTSCTS,
79}; 78};
80 79
81static inline void mxc_init_imx_uart(void) 80static inline void mxc_init_imx_uart(void)
82{ 81{
83 mxc_register_device(&mxc_uart_device0, &uart_pdata); 82 imx51_add_imx_uart(0, &uart_pdata);
84 mxc_register_device(&mxc_uart_device1, &uart_pdata); 83 imx51_add_imx_uart(1, &uart_pdata);
85 mxc_register_device(&mxc_uart_device2, &uart_pdata); 84 imx51_add_imx_uart(2, &uart_pdata);
86} 85}
87#else /* !SERIAL_IMX */ 86#else /* !SERIAL_IMX */
88static inline void mxc_init_imx_uart(void) 87static inline void mxc_init_imx_uart(void)
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 3f3075d7768f..7c0b6618a164 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -21,7 +21,6 @@
21 21
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/imx-uart.h>
25#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
26#include <mach/mxc_ehci.h> 25#include <mach/mxc_ehci.h>
27 26
@@ -31,6 +30,7 @@
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 31#include <asm/mach/time.h>
33 32
33#include "devices-imx51.h"
34#include "devices.h" 34#include "devices.h"
35 35
36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ 36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */
@@ -120,15 +120,15 @@ static struct pad_desc mx51babbage_pads[] = {
120 120
121/* Serial ports */ 121/* Serial ports */
122#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 122#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
123static struct imxuart_platform_data uart_pdata = { 123static const struct imxuart_platform_data uart_pdata __initconst = {
124 .flags = IMXUART_HAVE_RTSCTS, 124 .flags = IMXUART_HAVE_RTSCTS,
125}; 125};
126 126
127static inline void mxc_init_imx_uart(void) 127static inline void mxc_init_imx_uart(void)
128{ 128{
129 mxc_register_device(&mxc_uart_device0, &uart_pdata); 129 imx51_add_imx_uart(0, &uart_pdata);
130 mxc_register_device(&mxc_uart_device1, &uart_pdata); 130 imx51_add_imx_uart(1, &uart_pdata);
131 mxc_register_device(&mxc_uart_device2, &uart_pdata); 131 imx51_add_imx_uart(2, &uart_pdata);
132} 132}
133#else /* !SERIAL_IMX */ 133#else /* !SERIAL_IMX */
134static inline void mxc_init_imx_uart(void) 134static inline void mxc_init_imx_uart(void)
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 09d2b5c8b4f5..8235b8c6729b 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -13,6 +13,10 @@ extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
13#define imx51_add_imx_i2c(id, pdata) \ 13#define imx51_add_imx_i2c(id, pdata) \
14 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) 14 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
15 15
16extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst;
17#define imx51_add_imx_uart(id, pdata) \
18 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
19
16extern const struct imx_spi_imx_data imx51_cspi_data __initconst; 20extern const struct imx_spi_imx_data imx51_cspi_data __initconst;
17#define imx51_add_cspi(pdata) \ 21#define imx51_add_cspi(pdata) \
18 imx_add_spi_imx(&imx51_cspi_data, pdata) 22 imx_add_spi_imx(&imx51_cspi_data, pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 70b76d16391c..5f40082d9e61 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -17,63 +17,6 @@
17#include <mach/imx-uart.h> 17#include <mach/imx-uart.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19 19
20static struct resource uart0[] = {
21 {
22 .start = MX51_UART1_BASE_ADDR,
23 .end = MX51_UART1_BASE_ADDR + 0xfff,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = MX51_MXC_INT_UART1,
27 .end = MX51_MXC_INT_UART1,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32struct platform_device mxc_uart_device0 = {
33 .name = "imx-uart",
34 .id = 0,
35 .resource = uart0,
36 .num_resources = ARRAY_SIZE(uart0),
37};
38
39static struct resource uart1[] = {
40 {
41 .start = MX51_UART2_BASE_ADDR,
42 .end = MX51_UART2_BASE_ADDR + 0xfff,
43 .flags = IORESOURCE_MEM,
44 }, {
45 .start = MX51_MXC_INT_UART2,
46 .end = MX51_MXC_INT_UART2,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51struct platform_device mxc_uart_device1 = {
52 .name = "imx-uart",
53 .id = 1,
54 .resource = uart1,
55 .num_resources = ARRAY_SIZE(uart1),
56};
57
58static struct resource uart2[] = {
59 {
60 .start = MX51_UART3_BASE_ADDR,
61 .end = MX51_UART3_BASE_ADDR + 0xfff,
62 .flags = IORESOURCE_MEM,
63 }, {
64 .start = MX51_MXC_INT_UART3,
65 .end = MX51_MXC_INT_UART3,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70struct platform_device mxc_uart_device2 = {
71 .name = "imx-uart",
72 .id = 2,
73 .resource = uart2,
74 .num_resources = ARRAY_SIZE(uart2),
75};
76
77static struct resource mxc_fec_resources[] = { 20static struct resource mxc_fec_resources[] = {
78 { 21 {
79 .start = MX51_MXC_FEC_BASE_ADDR, 22 .start = MX51_MXC_FEC_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index 5c2918fcec0d..67a6d6910530 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -1,6 +1,3 @@
1extern struct platform_device mxc_uart_device0;
2extern struct platform_device mxc_uart_device1;
3extern struct platform_device mxc_uart_device2;
4extern struct platform_device mxc_fec_device; 1extern struct platform_device mxc_fec_device;
5extern struct platform_device mxc_usbdr_host_device; 2extern struct platform_device mxc_usbdr_host_device;
6extern struct platform_device mxc_usbh1_device; 3extern struct platform_device mxc_usbh1_device;
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
index ffa93d1d6ef8..d0e417ce2c08 100644
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -30,6 +30,7 @@
30 30
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32 32
33#include "devices-imx51.h"
33#include "devices.h" 34#include "devices.h"
34 35
35#define MBIMX51_TSC2007_GPIO (2*32 + 30) 36#define MBIMX51_TSC2007_GPIO (2*32 + 30)
@@ -114,7 +115,7 @@ static struct pad_desc mbimx51_pads[] = {
114 MX51_PAD_KEY_COL3__KEY_COL3, 115 MX51_PAD_KEY_COL3__KEY_COL3,
115}; 116};
116 117
117static struct imxuart_platform_data uart_pdata = { 118static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS, 119 .flags = IMXUART_HAVE_RTSCTS,
119}; 120};
120 121
@@ -172,8 +173,8 @@ void __init eukrea_mbimx51_baseboard_init(void)
172 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads, 173 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
173 ARRAY_SIZE(mbimx51_pads)); 174 ARRAY_SIZE(mbimx51_pads));
174 175
175 mxc_register_device(&mxc_uart_device1, NULL); 176 imx51_add_imx_uart(1, NULL);
176 mxc_register_device(&mxc_uart_device2, &uart_pdata); 177 imx51_add_imx_uart(2, &uart_pdata);
177 178
178 gpio_request(MBIMX51_LED0, "LED0"); 179 gpio_request(MBIMX51_LED0, "LED0");
179 gpio_direction_output(MBIMX51_LED0, 1); 180 gpio_direction_output(MBIMX51_LED0, 1);
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index af7fabba4e71..2039640adf27 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -94,6 +94,16 @@ const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
94}; 94};
95#endif /* ifdef CONFIG_ARCH_MX35 */ 95#endif /* ifdef CONFIG_ARCH_MX35 */
96 96
97#ifdef CONFIG_ARCH_MX51
98const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
99#define imx51_imx_uart_data_entry(_id, _hwid) \
100 imx_imx_uart_1irq_data_entry(MX51, _id, _hwid, SZ_4K)
101 imx51_imx_uart_data_entry(0, 1),
102 imx51_imx_uart_data_entry(1, 2),
103 imx51_imx_uart_data_entry(2, 3),
104};
105#endif /* ifdef CONFIG_ARCH_MX51 */
106
97struct platform_device *__init imx_add_imx_uart_3irq( 107struct platform_device *__init imx_add_imx_uart_3irq(
98 const struct imx_imx_uart_3irq_data *data, 108 const struct imx_imx_uart_3irq_data *data,
99 const struct imxuart_platform_data *pdata) 109 const struct imxuart_platform_data *pdata)
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index b919235768a0..b7359d7d54e2 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -310,9 +310,9 @@
310#define MX51_MXC_INT_SLIM_B 28 310#define MX51_MXC_INT_SLIM_B 28
311#define MX51_MXC_INT_SSI1 29 311#define MX51_MXC_INT_SSI1 29
312#define MX51_MXC_INT_SSI2 30 312#define MX51_MXC_INT_SSI2 30
313#define MX51_MXC_INT_UART1 31 313#define MX51_INT_UART1 31
314#define MX51_MXC_INT_UART2 32 314#define MX51_INT_UART2 32
315#define MX51_MXC_INT_UART3 33 315#define MX51_INT_UART3 33
316#define MX51_MXC_INT_RESV34 34 316#define MX51_MXC_INT_RESV34 34
317#define MX51_MXC_INT_RESV35 35 317#define MX51_MXC_INT_RESV35 35
318#define MX51_INT_ECSPI1 36 318#define MX51_INT_ECSPI1 36