aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/devices/platform-imx-uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-mxc/devices/platform-imx-uart.c')
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c127
1 files changed, 105 insertions, 22 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
index fa3dff1433e8..af7fabba4e71 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-uart.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -6,55 +6,138 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h>
9#include <mach/devices-common.h> 10#include <mach/devices-common.h>
10 11
11struct platform_device *__init imx_add_imx_uart_3irq(int id, 12#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
12 resource_size_t iobase, resource_size_t iosize, 13 [_id] = { \
13 resource_size_t irqrx, resource_size_t irqtx, 14 .id = _id, \
14 resource_size_t irqrts, 15 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irqrx = soc ## _INT_UART ## _hwid ## RX, \
18 .irqtx = soc ## _INT_UART ## _hwid ## TX, \
19 .irqrts = soc ## _INT_UART ## _hwid ## RTS, \
20 }
21
22#define imx_imx_uart_1irq_data_entry(soc, _id, _hwid, _size) \
23 [_id] = { \
24 .id = _id, \
25 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
26 .iosize = _size, \
27 .irq = soc ## _INT_UART ## _hwid, \
28 }
29
30#ifdef CONFIG_SOC_IMX1
31const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst = {
32#define imx1_imx_uart_data_entry(_id, _hwid) \
33 imx_imx_uart_3irq_data_entry(MX1, _id, _hwid, 0xd0)
34 imx1_imx_uart_data_entry(0, 1),
35 imx1_imx_uart_data_entry(1, 2),
36};
37#endif /* ifdef CONFIG_SOC_IMX1 */
38
39#ifdef CONFIG_SOC_IMX21
40const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
41#define imx21_imx_uart_data_entry(_id, _hwid) \
42 imx_imx_uart_1irq_data_entry(MX21, _id, _hwid, SZ_4K)
43 imx21_imx_uart_data_entry(0, 1),
44 imx21_imx_uart_data_entry(1, 2),
45 imx21_imx_uart_data_entry(2, 3),
46 imx21_imx_uart_data_entry(3, 4),
47};
48#endif
49
50#ifdef CONFIG_ARCH_MX25
51const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = {
52#define imx25_imx_uart_data_entry(_id, _hwid) \
53 imx_imx_uart_1irq_data_entry(MX25, _id, _hwid, SZ_16K)
54 imx25_imx_uart_data_entry(0, 1),
55 imx25_imx_uart_data_entry(1, 2),
56 imx25_imx_uart_data_entry(2, 3),
57 imx25_imx_uart_data_entry(3, 4),
58 imx25_imx_uart_data_entry(4, 5),
59};
60#endif /* ifdef CONFIG_ARCH_MX25 */
61
62#ifdef CONFIG_SOC_IMX27
63const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
64#define imx27_imx_uart_data_entry(_id, _hwid) \
65 imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
66 imx27_imx_uart_data_entry(0, 1),
67 imx27_imx_uart_data_entry(1, 2),
68 imx27_imx_uart_data_entry(2, 3),
69 imx27_imx_uart_data_entry(3, 4),
70 imx27_imx_uart_data_entry(4, 5),
71 imx27_imx_uart_data_entry(5, 6),
72};
73#endif /* ifdef CONFIG_SOC_IMX27 */
74
75#ifdef CONFIG_ARCH_MX31
76const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
77#define imx31_imx_uart_data_entry(_id, _hwid) \
78 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
79 imx31_imx_uart_data_entry(0, 1),
80 imx31_imx_uart_data_entry(1, 2),
81 imx31_imx_uart_data_entry(2, 3),
82 imx31_imx_uart_data_entry(3, 4),
83 imx31_imx_uart_data_entry(4, 5),
84};
85#endif /* ifdef CONFIG_ARCH_MX31 */
86
87#ifdef CONFIG_ARCH_MX35
88const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
89#define imx35_imx_uart_data_entry(_id, _hwid) \
90 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_16K)
91 imx35_imx_uart_data_entry(0, 1),
92 imx35_imx_uart_data_entry(1, 2),
93 imx35_imx_uart_data_entry(2, 3),
94};
95#endif /* ifdef CONFIG_ARCH_MX35 */
96
97struct platform_device *__init imx_add_imx_uart_3irq(
98 const struct imx_imx_uart_3irq_data *data,
15 const struct imxuart_platform_data *pdata) 99 const struct imxuart_platform_data *pdata)
16{ 100{
17 struct resource res[] = { 101 struct resource res[] = {
18 { 102 {
19 .start = iobase, 103 .start = data->iobase,
20 .end = iobase + iosize - 1, 104 .end = data->iobase + data->iosize - 1,
21 .flags = IORESOURCE_MEM, 105 .flags = IORESOURCE_MEM,
22 }, { 106 }, {
23 .start = irqrx, 107 .start = data->irqrx,
24 .end = irqrx, 108 .end = data->irqrx,
25 .flags = IORESOURCE_IRQ, 109 .flags = IORESOURCE_IRQ,
26 }, { 110 }, {
27 .start = irqtx, 111 .start = data->irqtx,
28 .end = irqtx, 112 .end = data->irqtx,
29 .flags = IORESOURCE_IRQ, 113 .flags = IORESOURCE_IRQ,
30 }, { 114 }, {
31 .start = irqrts, 115 .start = data->irqrts,
32 .end = irqrx, 116 .end = data->irqrx,
33 .flags = IORESOURCE_IRQ, 117 .flags = IORESOURCE_IRQ,
34 }, 118 },
35 }; 119 };
36 120
37 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res), 121 return imx_add_platform_device("imx-uart", data->id, res,
38 pdata, sizeof(*pdata)); 122 ARRAY_SIZE(res), pdata, sizeof(*pdata));
39} 123}
40 124
41struct platform_device *__init imx_add_imx_uart_1irq(int id, 125struct platform_device *__init imx_add_imx_uart_1irq(
42 resource_size_t iobase, resource_size_t iosize, 126 const struct imx_imx_uart_1irq_data *data,
43 resource_size_t irq,
44 const struct imxuart_platform_data *pdata) 127 const struct imxuart_platform_data *pdata)
45{ 128{
46 struct resource res[] = { 129 struct resource res[] = {
47 { 130 {
48 .start = iobase, 131 .start = data->iobase,
49 .end = iobase + iosize - 1, 132 .end = data->iobase + data->iosize - 1,
50 .flags = IORESOURCE_MEM, 133 .flags = IORESOURCE_MEM,
51 }, { 134 }, {
52 .start = irq, 135 .start = data->irq,
53 .end = irq, 136 .end = data->irq,
54 .flags = IORESOURCE_IRQ, 137 .flags = IORESOURCE_IRQ,
55 }, 138 },
56 }; 139 };
57 140
58 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res), 141 return imx_add_platform_device("imx-uart", data->id, res, ARRAY_SIZE(res),
59 pdata, sizeof(*pdata)); 142 pdata, sizeof(*pdata));
60} 143}