1
2
3
4
5
6
7
8
9#include "../hardware.h"
10#include "devices-common.h"
11
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, \
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_IMX21
31const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
32#define imx21_imx_uart_data_entry(_id, _hwid) \
33 imx_imx_uart_1irq_data_entry(MX21, _id, _hwid, SZ_4K)
34 imx21_imx_uart_data_entry(0, 1),
35 imx21_imx_uart_data_entry(1, 2),
36 imx21_imx_uart_data_entry(2, 3),
37 imx21_imx_uart_data_entry(3, 4),
38};
39#endif
40
41#ifdef CONFIG_SOC_IMX27
42const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
43#define imx27_imx_uart_data_entry(_id, _hwid) \
44 imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
45 imx27_imx_uart_data_entry(0, 1),
46 imx27_imx_uart_data_entry(1, 2),
47 imx27_imx_uart_data_entry(2, 3),
48 imx27_imx_uart_data_entry(3, 4),
49 imx27_imx_uart_data_entry(4, 5),
50 imx27_imx_uart_data_entry(5, 6),
51};
52#endif
53
54#ifdef CONFIG_SOC_IMX31
55const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
56#define imx31_imx_uart_data_entry(_id, _hwid) \
57 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
58 imx31_imx_uart_data_entry(0, 1),
59 imx31_imx_uart_data_entry(1, 2),
60 imx31_imx_uart_data_entry(2, 3),
61 imx31_imx_uart_data_entry(3, 4),
62 imx31_imx_uart_data_entry(4, 5),
63};
64#endif
65
66#ifdef CONFIG_SOC_IMX35
67const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
68#define imx35_imx_uart_data_entry(_id, _hwid) \
69 imx_imx_uart_1irq_data_entry(MX35, _id, _hwid, SZ_16K)
70 imx35_imx_uart_data_entry(0, 1),
71 imx35_imx_uart_data_entry(1, 2),
72 imx35_imx_uart_data_entry(2, 3),
73};
74#endif
75
76struct platform_device *__init imx_add_imx_uart_1irq(
77 const struct imx_imx_uart_1irq_data *data,
78 const struct imxuart_platform_data *pdata)
79{
80 struct resource res[] = {
81 {
82 .start = data->iobase,
83 .end = data->iobase + data->iosize - 1,
84 .flags = IORESOURCE_MEM,
85 }, {
86 .start = data->irq,
87 .end = data->irq,
88 .flags = IORESOURCE_IRQ,
89 },
90 };
91
92
93 return imx_add_platform_device("imx21-uart", data->id,
94 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
95}
96