2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 #include <linux/module.h>
21 #include <linux/platform_device.h>
22 #include <linux/serial.h>
23 #include <asm/hardware.h>
24 #include <asm/arch/imx-uart.h>
26 static struct resource uart0[] = {
28 .start = UART1_BASE_ADDR,
29 .end = UART1_BASE_ADDR + 0x0B5,
30 .flags = IORESOURCE_MEM,
32 .start = MXC_INT_UART1,
34 .flags = IORESOURCE_IRQ,
38 static struct platform_device mxc_uart_device0 = {
42 .num_resources = ARRAY_SIZE(uart0),
45 static struct resource uart1[] = {
47 .start = UART2_BASE_ADDR,
48 .end = UART2_BASE_ADDR + 0x0B5,
49 .flags = IORESOURCE_MEM,
51 .start = MXC_INT_UART2,
53 .flags = IORESOURCE_IRQ,
57 static struct platform_device mxc_uart_device1 = {
61 .num_resources = ARRAY_SIZE(uart1),
64 static struct resource uart2[] = {
66 .start = UART3_BASE_ADDR,
67 .end = UART3_BASE_ADDR + 0x0B5,
68 .flags = IORESOURCE_MEM,
70 .start = MXC_INT_UART3,
72 .flags = IORESOURCE_IRQ,
76 static struct platform_device mxc_uart_device2 = {
80 .num_resources = ARRAY_SIZE(uart2),
83 static struct resource uart3[] = {
85 .start = UART4_BASE_ADDR,
86 .end = UART4_BASE_ADDR + 0x0B5,
87 .flags = IORESOURCE_MEM,
89 .start = MXC_INT_UART4,
91 .flags = IORESOURCE_IRQ,
95 static struct platform_device mxc_uart_device3 = {
99 .num_resources = ARRAY_SIZE(uart3),
102 static struct resource uart4[] = {
104 .start = UART5_BASE_ADDR,
105 .end = UART5_BASE_ADDR + 0x0B5,
106 .flags = IORESOURCE_MEM,
108 .start = MXC_INT_UART5,
109 .end = MXC_INT_UART5,
110 .flags = IORESOURCE_IRQ,
114 static struct platform_device mxc_uart_device4 = {
118 .num_resources = ARRAY_SIZE(uart4),
121 static struct resource uart5[] = {
123 .start = UART6_BASE_ADDR,
124 .end = UART6_BASE_ADDR + 0x0B5,
125 .flags = IORESOURCE_MEM,
127 .start = MXC_INT_UART6,
128 .end = MXC_INT_UART6,
129 .flags = IORESOURCE_IRQ,
133 static struct platform_device mxc_uart_device5 = {
137 .num_resources = ARRAY_SIZE(uart5),
141 * Register only those UARTs that physically exists
143 int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
147 mxc_uart_device0.dev.platform_data = pdata;
148 platform_device_register(&mxc_uart_device0);
151 mxc_uart_device1.dev.platform_data = pdata;
152 platform_device_register(&mxc_uart_device1);
154 #ifndef CONFIG_MXC_IRDA
156 mxc_uart_device2.dev.platform_data = pdata;
157 platform_device_register(&mxc_uart_device2);
161 mxc_uart_device3.dev.platform_data = pdata;
162 platform_device_register(&mxc_uart_device3);
165 mxc_uart_device4.dev.platform_data = pdata;
166 platform_device_register(&mxc_uart_device4);
169 mxc_uart_device5.dev.platform_data = pdata;
170 platform_device_register(&mxc_uart_device5);