diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-22 08:50:59 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-30 03:00:54 -0400 |
commit | d112f4e4e57cbcf81e5f04a0eba77804d14d8640 (patch) | |
tree | 97c8001c76e667e87dd1ee98c7c2741f08ff8255 /arch/arm/mach-imx | |
parent | 2db6823773760412706168be6378eef30c29808b (diff) |
ARM: imx: dynamically register imx-uart devices (imx1)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx1.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-mx1ads.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-scb9328.c | 6 |
6 files changed, 18 insertions, 45 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index c185ec3254ca..445ce10b8985 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -17,11 +17,13 @@ config ARCH_MX1ADS | |||
17 | bool "MX1ADS platform" | 17 | bool "MX1ADS platform" |
18 | select MACH_MXLADS | 18 | select MACH_MXLADS |
19 | select IMX_HAVE_PLATFORM_IMX_I2C | 19 | select IMX_HAVE_PLATFORM_IMX_I2C |
20 | select IMX_HAVE_PLATFORM_IMX_UART | ||
20 | help | 21 | help |
21 | Say Y here if you are using Motorola MX1ADS/MXLADS boards | 22 | Say Y here if you are using Motorola MX1ADS/MXLADS boards |
22 | 23 | ||
23 | config MACH_SCB9328 | 24 | config MACH_SCB9328 |
24 | bool "Synertronixx scb9328" | 25 | bool "Synertronixx scb9328" |
26 | select IMX_HAVE_PLATFORM_IMX_UART | ||
25 | help | 27 | help |
26 | Say Y here if you are using a Synertronixx scb9328 board | 28 | Say Y here if you are using a Synertronixx scb9328 board |
27 | 29 | ||
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h index a5cfe046deb4..a8d94f078196 100644 --- a/arch/arm/mach-imx/devices-imx1.h +++ b/arch/arm/mach-imx/devices-imx1.h | |||
@@ -11,3 +11,8 @@ | |||
11 | 11 | ||
12 | #define imx1_add_i2c_imx(pdata) \ | 12 | #define imx1_add_i2c_imx(pdata) \ |
13 | imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata) | 13 | imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata) |
14 | |||
15 | #define imx1_add_imx_uart0(pdata) \ | ||
16 | imx_add_imx_uart_3irq(0, MX1_UART1_BASE_ADDR, 0xd0, MX1_INT_UART1RX, MX1_INT_UART1TX, MX1_INT_UART1RTS, pdata) | ||
17 | #define imx1_add_imx_uart1(pdata) \ | ||
18 | imx_add_imx_uart_3irq(0, MX1_UART2_BASE_ADDR, 0xd0, MX1_INT_UART2RX, MX1_INT_UART2TX, MX1_INT_UART2RTS, pdata) | ||
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index 84e6da6b8c0c..b4bf8fc80216 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -70,37 +70,6 @@ struct platform_device imx1_camera_device = { | |||
70 | .num_resources = ARRAY_SIZE(imx1_camera_resources), | 70 | .num_resources = ARRAY_SIZE(imx1_camera_resources), |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #define DEFINE_IMX1_UART_DEVICE(n, baseaddr, irqrx, irqtx, irqrts) \ | ||
74 | static struct resource imx1_uart_resources ## n[] = { \ | ||
75 | { \ | ||
76 | .start = baseaddr, \ | ||
77 | .end = baseaddr + 0xd0, \ | ||
78 | .flags = IORESOURCE_MEM, \ | ||
79 | }, { \ | ||
80 | .start = irqrx, \ | ||
81 | .end = irqrx, \ | ||
82 | .flags = IORESOURCE_IRQ, \ | ||
83 | }, { \ | ||
84 | .start = irqtx, \ | ||
85 | .end = irqtx, \ | ||
86 | .flags = IORESOURCE_IRQ, \ | ||
87 | }, { \ | ||
88 | .start = irqrts, \ | ||
89 | .end = irqrts, \ | ||
90 | .flags = IORESOURCE_IRQ, \ | ||
91 | }, \ | ||
92 | }; \ | ||
93 | \ | ||
94 | struct platform_device imx1_uart_device ## n = { \ | ||
95 | .name = "imx-uart", \ | ||
96 | .id = n, \ | ||
97 | .num_resources = ARRAY_SIZE(imx1_uart_resources ## n), \ | ||
98 | .resource = imx1_uart_resources ## n, \ | ||
99 | } | ||
100 | |||
101 | DEFINE_IMX1_UART_DEVICE(0, MX1_UART1_BASE_ADDR, MX1_UART1_MINT_RX, MX1_UART1_MINT_TX, MX1_UART1_MINT_RTS); | ||
102 | DEFINE_IMX1_UART_DEVICE(1, MX1_UART2_BASE_ADDR, MX1_UART2_MINT_RX, MX1_UART2_MINT_TX, MX1_UART2_MINT_RTS); | ||
103 | |||
104 | static struct resource imx_rtc_resources[] = { | 73 | static struct resource imx_rtc_resources[] = { |
105 | { | 74 | { |
106 | .start = 0x00204000, | 75 | .start = 0x00204000, |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index db995b156ee6..e56efbcb75d6 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -1,7 +1,5 @@ | |||
1 | #ifdef CONFIG_ARCH_MX1 | 1 | #ifdef CONFIG_ARCH_MX1 |
2 | extern struct platform_device imx1_camera_device; | 2 | extern struct platform_device imx1_camera_device; |
3 | extern struct platform_device imx1_uart_device0; | ||
4 | extern struct platform_device imx1_uart_device1; | ||
5 | extern struct platform_device imx_rtc_device; | 3 | extern struct platform_device imx_rtc_device; |
6 | extern struct platform_device imx_wdt_device; | 4 | extern struct platform_device imx_wdt_device; |
7 | extern struct platform_device imx_usb_device; | 5 | extern struct platform_device imx_usb_device; |
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c index 339d41ad19d5..77a760cfadc0 100644 --- a/arch/arm/mach-imx/mach-mx1ads.c +++ b/arch/arm/mach-imx/mach-mx1ads.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <mach/common.h> | 26 | #include <mach/common.h> |
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/i2c.h> | 28 | #include <mach/i2c.h> |
29 | #include <mach/imx-uart.h> | ||
30 | #include <mach/iomux-mx1.h> | 29 | #include <mach/iomux-mx1.h> |
31 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
32 | 31 | ||
@@ -59,12 +58,12 @@ static int mx1ads_pins[] = { | |||
59 | * UARTs platform data | 58 | * UARTs platform data |
60 | */ | 59 | */ |
61 | 60 | ||
62 | static struct imxuart_platform_data uart_pdata[] = { | 61 | static const struct imxuart_platform_data uart0_pdata __initconst = { |
63 | { | 62 | .flags = IMXUART_HAVE_RTSCTS, |
64 | .flags = IMXUART_HAVE_RTSCTS, | 63 | }; |
65 | }, { | 64 | |
66 | .flags = IMXUART_HAVE_RTSCTS, | 65 | static const struct imxuart_platform_data uart1_pdata __initconst = { |
67 | }, | 66 | .flags = IMXUART_HAVE_RTSCTS, |
68 | }; | 67 | }; |
69 | 68 | ||
70 | /* | 69 | /* |
@@ -122,8 +121,8 @@ static void __init mx1ads_init(void) | |||
122 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); | 121 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); |
123 | 122 | ||
124 | /* UART */ | 123 | /* UART */ |
125 | mxc_register_device(&imx1_uart_device0, &uart_pdata[0]); | 124 | imx1_add_imx_uart0(&uart0_pdata); |
126 | mxc_register_device(&imx1_uart_device1, &uart_pdata[1]); | 125 | imx1_add_imx_uart1(&uart1_pdata); |
127 | 126 | ||
128 | /* Physmap flash */ | 127 | /* Physmap flash */ |
129 | mxc_register_device(&flash_device, &mx1ads_flash_data); | 128 | mxc_register_device(&flash_device, &mx1ads_flash_data); |
diff --git a/arch/arm/mach-imx/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c index 482b24df4624..88bf0d1e26e6 100644 --- a/arch/arm/mach-imx/mach-scb9328.c +++ b/arch/arm/mach-imx/mach-scb9328.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <mach/common.h> | 22 | #include <mach/common.h> |
23 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
24 | #include <mach/irqs.h> | 24 | #include <mach/irqs.h> |
25 | #include <mach/imx-uart.h> | ||
26 | #include <mach/iomux-mx1.h> | 25 | #include <mach/iomux-mx1.h> |
27 | 26 | ||
27 | #include "devices-imx1.h" | ||
28 | #include "devices.h" | 28 | #include "devices.h" |
29 | 29 | ||
30 | /* | 30 | /* |
@@ -114,7 +114,7 @@ static void uart1_mxc_exit(struct platform_device *pdev) | |||
114 | ARRAY_SIZE(mxc_uart1_pins)); | 114 | ARRAY_SIZE(mxc_uart1_pins)); |
115 | } | 115 | } |
116 | 116 | ||
117 | static struct imxuart_platform_data uart_pdata = { | 117 | static const struct imxuart_platform_data uart_pdata __initconst = { |
118 | .init = uart1_mxc_init, | 118 | .init = uart1_mxc_init, |
119 | .exit = uart1_mxc_exit, | 119 | .exit = uart1_mxc_exit, |
120 | .flags = IMXUART_HAVE_RTSCTS, | 120 | .flags = IMXUART_HAVE_RTSCTS, |
@@ -130,7 +130,7 @@ static struct platform_device *devices[] __initdata = { | |||
130 | */ | 130 | */ |
131 | static void __init scb9328_init(void) | 131 | static void __init scb9328_init(void) |
132 | { | 132 | { |
133 | mxc_register_device(&imx1_uart_device0, &uart_pdata); | 133 | imx1_add_imx_uart0(&uart_pdata); |
134 | 134 | ||
135 | printk(KERN_INFO"Scb9328: Adding devices\n"); | 135 | printk(KERN_INFO"Scb9328: Adding devices\n"); |
136 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 136 | platform_add_devices(devices, ARRAY_SIZE(devices)); |