aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <sascha@saschahauer.de>2006-05-04 09:07:42 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-05-04 09:07:42 -0400
commit5b802344357338a4d645beac8ca97470bcbe3542 (patch)
treef3f8df6cb9bec5ddb6dc947ea99eb9454232066b
parentb2556da55f78a9dbe92830b1d1c0b612edfea9fd (diff)
[ARM] 3490/1: i.MX: move uart resources to board files
Patch from Sascha Hauer This patch moves the i.MX uart resources and the gpio pin setup to the board files. This allows the boards to decide how many internal uarts are connected to the outside world and whether they use rts/cts or not. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-imx/generic.c52
-rw-r--r--arch/arm/mach-imx/mx1ads.c74
-rw-r--r--drivers/serial/imx.c40
-rw-r--r--include/asm-arm/arch-imx/imx-uart.h10
4 files changed, 100 insertions, 76 deletions
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 9d8331be2b58..12ea58a3b84f 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -195,56 +195,6 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
195} 195}
196EXPORT_SYMBOL(imx_set_mmc_info); 196EXPORT_SYMBOL(imx_set_mmc_info);
197 197
198static struct resource imx_uart1_resources[] = {
199 [0] = {
200 .start = 0x00206000,
201 .end = 0x002060FF,
202 .flags = IORESOURCE_MEM,
203 },
204 [1] = {
205 .start = (UART1_MINT_RX),
206 .end = (UART1_MINT_RX),
207 .flags = IORESOURCE_IRQ,
208 },
209 [2] = {
210 .start = (UART1_MINT_TX),
211 .end = (UART1_MINT_TX),
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device imx_uart1_device = {
217 .name = "imx-uart",
218 .id = 0,
219 .num_resources = ARRAY_SIZE(imx_uart1_resources),
220 .resource = imx_uart1_resources,
221};
222
223static struct resource imx_uart2_resources[] = {
224 [0] = {
225 .start = 0x00207000,
226 .end = 0x002070FF,
227 .flags = IORESOURCE_MEM,
228 },
229 [1] = {
230 .start = (UART2_MINT_RX),
231 .end = (UART2_MINT_RX),
232 .flags = IORESOURCE_IRQ,
233 },
234 [2] = {
235 .start = (UART2_MINT_TX),
236 .end = (UART2_MINT_TX),
237 .flags = IORESOURCE_IRQ,
238 },
239};
240
241static struct platform_device imx_uart2_device = {
242 .name = "imx-uart",
243 .id = 1,
244 .num_resources = ARRAY_SIZE(imx_uart2_resources),
245 .resource = imx_uart2_resources,
246};
247
248static struct imxfb_mach_info imx_fb_info; 198static struct imxfb_mach_info imx_fb_info;
249 199
250void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info) 200void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
@@ -283,8 +233,6 @@ static struct platform_device imxfb_device = {
283static struct platform_device *devices[] __initdata = { 233static struct platform_device *devices[] __initdata = {
284 &imx_mmc_device, 234 &imx_mmc_device,
285 &imxfb_device, 235 &imxfb_device,
286 &imx_uart1_device,
287 &imx_uart2_device,
288}; 236};
289 237
290static struct map_desc imx_io_desc[] __initdata = { 238static struct map_desc imx_io_desc[] __initdata = {
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index e34d0df90aed..e1f6c0bbe1e7 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/arch/mmc.h> 28#include <asm/arch/mmc.h>
29#include <asm/arch/imx-uart.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
30#include "generic.h" 31#include "generic.h"
31 32
@@ -48,8 +49,70 @@ static struct platform_device cs89x0_device = {
48 .resource = cs89x0_resources, 49 .resource = cs89x0_resources,
49}; 50};
50 51
52static struct imxuart_platform_data uart_pdata = {
53 .flags = IMXUART_HAVE_RTSCTS,
54};
55
56static struct resource imx_uart1_resources[] = {
57 [0] = {
58 .start = 0x00206000,
59 .end = 0x002060FF,
60 .flags = IORESOURCE_MEM,
61 },
62 [1] = {
63 .start = (UART1_MINT_RX),
64 .end = (UART1_MINT_RX),
65 .flags = IORESOURCE_IRQ,
66 },
67 [2] = {
68 .start = (UART1_MINT_TX),
69 .end = (UART1_MINT_TX),
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device imx_uart1_device = {
75 .name = "imx-uart",
76 .id = 0,
77 .num_resources = ARRAY_SIZE(imx_uart1_resources),
78 .resource = imx_uart1_resources,
79 .dev = {
80 .platform_data = &uart_pdata,
81 }
82};
83
84static struct resource imx_uart2_resources[] = {
85 [0] = {
86 .start = 0x00207000,
87 .end = 0x002070FF,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = (UART2_MINT_RX),
92 .end = (UART2_MINT_RX),
93 .flags = IORESOURCE_IRQ,
94 },
95 [2] = {
96 .start = (UART2_MINT_TX),
97 .end = (UART2_MINT_TX),
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102static struct platform_device imx_uart2_device = {
103 .name = "imx-uart",
104 .id = 1,
105 .num_resources = ARRAY_SIZE(imx_uart2_resources),
106 .resource = imx_uart2_resources,
107 .dev = {
108 .platform_data = &uart_pdata,
109 }
110};
111
51static struct platform_device *devices[] __initdata = { 112static struct platform_device *devices[] __initdata = {
52 &cs89x0_device, 113 &cs89x0_device,
114 &imx_uart1_device,
115 &imx_uart2_device,
53}; 116};
54 117
55#ifdef CONFIG_MMC_IMX 118#ifdef CONFIG_MMC_IMX
@@ -75,6 +138,17 @@ mx1ads_init(void)
75 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20); 138 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
76 imx_set_mmc_info(&mx1ads_mmc_info); 139 imx_set_mmc_info(&mx1ads_mmc_info);
77#endif 140#endif
141
142 imx_gpio_mode(PC9_PF_UART1_CTS);
143 imx_gpio_mode(PC10_PF_UART1_RTS);
144 imx_gpio_mode(PC11_PF_UART1_TXD);
145 imx_gpio_mode(PC12_PF_UART1_RXD);
146
147 imx_gpio_mode(PB28_PF_UART2_CTS);
148 imx_gpio_mode(PB29_PF_UART2_RTS);
149 imx_gpio_mode(PB30_PF_UART2_TXD);
150 imx_gpio_mode(PB31_PF_UART2_RXD);
151
78 platform_add_devices(devices, ARRAY_SIZE(devices)); 152 platform_add_devices(devices, ARRAY_SIZE(devices));
79} 153}
80 154
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index c3b7a6673e9c..d202eb4f3848 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -45,6 +45,7 @@
45#include <asm/io.h> 45#include <asm/io.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/hardware.h> 47#include <asm/hardware.h>
48#include <asm/arch/imx-uart.h>
48 49
49/* We've been assigned a range on the "Low-density serial ports" major */ 50/* We've been assigned a range on the "Low-density serial ports" major */
50#define SERIAL_IMX_MAJOR 204 51#define SERIAL_IMX_MAJOR 204
@@ -73,7 +74,8 @@ struct imx_port {
73 struct uart_port port; 74 struct uart_port port;
74 struct timer_list timer; 75 struct timer_list timer;
75 unsigned int old_status; 76 unsigned int old_status;
76 int txirq,rxirq,rtsirq; 77 int txirq,rxirq,rtsirq;
78 int have_rtscts:1;
77}; 79};
78 80
79/* 81/*
@@ -491,8 +493,12 @@ imx_set_termios(struct uart_port *port, struct termios *termios,
491 ucr2 = UCR2_SRST | UCR2_IRTS; 493 ucr2 = UCR2_SRST | UCR2_IRTS;
492 494
493 if (termios->c_cflag & CRTSCTS) { 495 if (termios->c_cflag & CRTSCTS) {
494 ucr2 &= ~UCR2_IRTS; 496 if( sport->have_rtscts ) {
495 ucr2 |= UCR2_CTSC; 497 ucr2 &= ~UCR2_IRTS;
498 ucr2 |= UCR2_CTSC;
499 } else {
500 termios->c_cflag &= ~CRTSCTS;
501 }
496 } 502 }
497 503
498 if (termios->c_cflag & CSTOPB) 504 if (termios->c_cflag & CSTOPB)
@@ -719,27 +725,6 @@ static void __init imx_init_ports(void)
719 imx_ports[i].timer.function = imx_timeout; 725 imx_ports[i].timer.function = imx_timeout;
720 imx_ports[i].timer.data = (unsigned long)&imx_ports[i]; 726 imx_ports[i].timer.data = (unsigned long)&imx_ports[i];
721 } 727 }
722
723 imx_gpio_mode(PC9_PF_UART1_CTS);
724 imx_gpio_mode(PC10_PF_UART1_RTS);
725 imx_gpio_mode(PC11_PF_UART1_TXD);
726 imx_gpio_mode(PC12_PF_UART1_RXD);
727 imx_gpio_mode(PB28_PF_UART2_CTS);
728 imx_gpio_mode(PB29_PF_UART2_RTS);
729
730 imx_gpio_mode(PB30_PF_UART2_TXD);
731 imx_gpio_mode(PB31_PF_UART2_RXD);
732
733#if 0 /* We don't need these, on the mx1 the _modem_ side of the uart
734 * is implemented.
735 */
736 imx_gpio_mode(PD7_AF_UART2_DTR);
737 imx_gpio_mode(PD8_AF_UART2_DCD);
738 imx_gpio_mode(PD9_AF_UART2_RI);
739 imx_gpio_mode(PD10_AF_UART2_DSR);
740#endif
741
742
743} 728}
744 729
745#ifdef CONFIG_SERIAL_IMX_CONSOLE 730#ifdef CONFIG_SERIAL_IMX_CONSOLE
@@ -932,7 +917,14 @@ static int serial_imx_resume(struct platform_device *dev)
932 917
933static int serial_imx_probe(struct platform_device *dev) 918static int serial_imx_probe(struct platform_device *dev)
934{ 919{
920 struct imxuart_platform_data *pdata;
921
935 imx_ports[dev->id].port.dev = &dev->dev; 922 imx_ports[dev->id].port.dev = &dev->dev;
923
924 pdata = (struct imxuart_platform_data *)dev->dev.platform_data;
925 if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
926 imx_ports[dev->id].have_rtscts = 1;
927
936 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); 928 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
937 platform_set_drvdata(dev, &imx_ports[dev->id]); 929 platform_set_drvdata(dev, &imx_ports[dev->id]);
938 return 0; 930 return 0;
diff --git a/include/asm-arm/arch-imx/imx-uart.h b/include/asm-arm/arch-imx/imx-uart.h
new file mode 100644
index 000000000000..3a685e1780ea
--- /dev/null
+++ b/include/asm-arm/arch-imx/imx-uart.h
@@ -0,0 +1,10 @@
1#ifndef ASMARM_ARCH_UART_H
2#define ASMARM_ARCH_UART_H
3
4#define IMXUART_HAVE_RTSCTS (1<<0)
5
6struct imxuart_platform_data {
7 unsigned int flags;
8};
9
10#endif