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.
9 #include "../hardware.h"
10 #include "devices-common.h"
12 #define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
15 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
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) \
25 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
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),
50 #ifdef CONFIG_SOC_IMX27
51 const struct imx_imx_uart_1irq_data imx27_imx_uart_data
[] __initconst
= {
52 #define imx27_imx_uart_data_entry(_id, _hwid) \
53 imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
54 imx27_imx_uart_data_entry(0, 1),
55 imx27_imx_uart_data_entry(1, 2),
56 imx27_imx_uart_data_entry(2, 3),
57 imx27_imx_uart_data_entry(3, 4),
58 imx27_imx_uart_data_entry(4, 5),
59 imx27_imx_uart_data_entry(5, 6),
61 #endif /* ifdef CONFIG_SOC_IMX27 */
63 #ifdef CONFIG_SOC_IMX31
64 const struct imx_imx_uart_1irq_data imx31_imx_uart_data
[] __initconst
= {
65 #define imx31_imx_uart_data_entry(_id, _hwid) \
66 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
67 imx31_imx_uart_data_entry(0, 1),
68 imx31_imx_uart_data_entry(1, 2),
69 imx31_imx_uart_data_entry(2, 3),
70 imx31_imx_uart_data_entry(3, 4),
71 imx31_imx_uart_data_entry(4, 5),
73 #endif /* ifdef CONFIG_SOC_IMX31 */
75 #ifdef CONFIG_SOC_IMX35
76 const struct imx_imx_uart_1irq_data imx35_imx_uart_data
[] __initconst
= {
77 #define imx35_imx_uart_data_entry(_id, _hwid) \
78 imx_imx_uart_1irq_data_entry(MX35, _id, _hwid, SZ_16K)
79 imx35_imx_uart_data_entry(0, 1),
80 imx35_imx_uart_data_entry(1, 2),
81 imx35_imx_uart_data_entry(2, 3),
83 #endif /* ifdef CONFIG_SOC_IMX35 */
85 struct platform_device
*__init
imx_add_imx_uart_3irq(
86 const struct imx_imx_uart_3irq_data
*data
,
87 const struct imxuart_platform_data
*pdata
)
89 struct resource res
[] = {
91 .start
= data
->iobase
,
92 .end
= data
->iobase
+ data
->iosize
- 1,
93 .flags
= IORESOURCE_MEM
,
97 .flags
= IORESOURCE_IRQ
,
101 .flags
= IORESOURCE_IRQ
,
103 .start
= data
->irqrts
,
105 .flags
= IORESOURCE_IRQ
,
109 return imx_add_platform_device("imx1-uart", data
->id
, res
,
110 ARRAY_SIZE(res
), pdata
, sizeof(*pdata
));
113 struct platform_device
*__init
imx_add_imx_uart_1irq(
114 const struct imx_imx_uart_1irq_data
*data
,
115 const struct imxuart_platform_data
*pdata
)
117 struct resource res
[] = {
119 .start
= data
->iobase
,
120 .end
= data
->iobase
+ data
->iosize
- 1,
121 .flags
= IORESOURCE_MEM
,
125 .flags
= IORESOURCE_IRQ
,
129 /* i.mx21 type uart runs on all i.mx except i.mx1 */
130 return imx_add_platform_device("imx21-uart", data
->id
,
131 res
, ARRAY_SIZE(res
), pdata
, sizeof(*pdata
));