Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / mach-imx / devices / platform-imx-uart.c
blobfaac4aa6ca6d0dc3d109b40160ac4d310cac5750
1 /*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9 #include "../hardware.h"
10 #include "devices-common.h"
12 #define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \
14 .id = _id, \
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, \
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, \
30 #ifdef CONFIG_SOC_IMX1
31 const 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),
37 #endif /* ifdef CONFIG_SOC_IMX1 */
39 #ifdef CONFIG_SOC_IMX21
40 const 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),
48 #endif
50 #ifdef CONFIG_SOC_IMX25
51 const 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),
60 #endif /* ifdef CONFIG_SOC_IMX25 */
62 #ifdef CONFIG_SOC_IMX27
63 const 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),
73 #endif /* ifdef CONFIG_SOC_IMX27 */
75 #ifdef CONFIG_SOC_IMX31
76 const 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),
85 #endif /* ifdef CONFIG_SOC_IMX31 */
87 #ifdef CONFIG_SOC_IMX35
88 const 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(MX35, _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),
95 #endif /* ifdef CONFIG_SOC_IMX35 */
97 #ifdef CONFIG_SOC_IMX51
98 const 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),
105 #endif /* ifdef CONFIG_SOC_IMX51 */
107 #ifdef CONFIG_SOC_IMX53
108 const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst = {
109 #define imx53_imx_uart_data_entry(_id, _hwid) \
110 imx_imx_uart_1irq_data_entry(MX53, _id, _hwid, SZ_4K)
111 imx53_imx_uart_data_entry(0, 1),
112 imx53_imx_uart_data_entry(1, 2),
113 imx53_imx_uart_data_entry(2, 3),
114 imx53_imx_uart_data_entry(3, 4),
115 imx53_imx_uart_data_entry(4, 5),
117 #endif /* ifdef CONFIG_SOC_IMX53 */
119 struct platform_device *__init imx_add_imx_uart_3irq(
120 const struct imx_imx_uart_3irq_data *data,
121 const struct imxuart_platform_data *pdata)
123 struct resource res[] = {
125 .start = data->iobase,
126 .end = data->iobase + data->iosize - 1,
127 .flags = IORESOURCE_MEM,
128 }, {
129 .start = data->irqrx,
130 .end = data->irqrx,
131 .flags = IORESOURCE_IRQ,
132 }, {
133 .start = data->irqtx,
134 .end = data->irqtx,
135 .flags = IORESOURCE_IRQ,
136 }, {
137 .start = data->irqrts,
138 .end = data->irqrx,
139 .flags = IORESOURCE_IRQ,
143 return imx_add_platform_device("imx1-uart", data->id, res,
144 ARRAY_SIZE(res), pdata, sizeof(*pdata));
147 struct platform_device *__init imx_add_imx_uart_1irq(
148 const struct imx_imx_uart_1irq_data *data,
149 const struct imxuart_platform_data *pdata)
151 struct resource res[] = {
153 .start = data->iobase,
154 .end = data->iobase + data->iosize - 1,
155 .flags = IORESOURCE_MEM,
156 }, {
157 .start = data->irq,
158 .end = data->irq,
159 .flags = IORESOURCE_IRQ,
163 /* i.mx21 type uart runs on all i.mx except i.mx1 */
164 return imx_add_platform_device("imx21-uart", data->id,
165 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));