Commit 5b802344 authored by Sascha Hauer's avatar Sascha Hauer Committed by Russell King

[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: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent b2556da5
...@@ -195,56 +195,6 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info) ...@@ -195,56 +195,6 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
} }
EXPORT_SYMBOL(imx_set_mmc_info); EXPORT_SYMBOL(imx_set_mmc_info);
static struct resource imx_uart1_resources[] = {
[0] = {
.start = 0x00206000,
.end = 0x002060FF,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = (UART1_MINT_RX),
.end = (UART1_MINT_RX),
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = (UART1_MINT_TX),
.end = (UART1_MINT_TX),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device imx_uart1_device = {
.name = "imx-uart",
.id = 0,
.num_resources = ARRAY_SIZE(imx_uart1_resources),
.resource = imx_uart1_resources,
};
static struct resource imx_uart2_resources[] = {
[0] = {
.start = 0x00207000,
.end = 0x002070FF,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = (UART2_MINT_RX),
.end = (UART2_MINT_RX),
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = (UART2_MINT_TX),
.end = (UART2_MINT_TX),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device imx_uart2_device = {
.name = "imx-uart",
.id = 1,
.num_resources = ARRAY_SIZE(imx_uart2_resources),
.resource = imx_uart2_resources,
};
static struct imxfb_mach_info imx_fb_info; static struct imxfb_mach_info imx_fb_info;
void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info) void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
...@@ -283,8 +233,6 @@ static struct platform_device imxfb_device = { ...@@ -283,8 +233,6 @@ static struct platform_device imxfb_device = {
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&imx_mmc_device, &imx_mmc_device,
&imxfb_device, &imxfb_device,
&imx_uart1_device,
&imx_uart2_device,
}; };
static struct map_desc imx_io_desc[] __initdata = { static struct map_desc imx_io_desc[] __initdata = {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/arch/mmc.h> #include <asm/arch/mmc.h>
#include <asm/arch/imx-uart.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include "generic.h" #include "generic.h"
...@@ -48,8 +49,70 @@ static struct platform_device cs89x0_device = { ...@@ -48,8 +49,70 @@ static struct platform_device cs89x0_device = {
.resource = cs89x0_resources, .resource = cs89x0_resources,
}; };
static struct imxuart_platform_data uart_pdata = {
.flags = IMXUART_HAVE_RTSCTS,
};
static struct resource imx_uart1_resources[] = {
[0] = {
.start = 0x00206000,
.end = 0x002060FF,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = (UART1_MINT_RX),
.end = (UART1_MINT_RX),
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = (UART1_MINT_TX),
.end = (UART1_MINT_TX),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device imx_uart1_device = {
.name = "imx-uart",
.id = 0,
.num_resources = ARRAY_SIZE(imx_uart1_resources),
.resource = imx_uart1_resources,
.dev = {
.platform_data = &uart_pdata,
}
};
static struct resource imx_uart2_resources[] = {
[0] = {
.start = 0x00207000,
.end = 0x002070FF,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = (UART2_MINT_RX),
.end = (UART2_MINT_RX),
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = (UART2_MINT_TX),
.end = (UART2_MINT_TX),
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device imx_uart2_device = {
.name = "imx-uart",
.id = 1,
.num_resources = ARRAY_SIZE(imx_uart2_resources),
.resource = imx_uart2_resources,
.dev = {
.platform_data = &uart_pdata,
}
};
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&cs89x0_device, &cs89x0_device,
&imx_uart1_device,
&imx_uart2_device,
}; };
#ifdef CONFIG_MMC_IMX #ifdef CONFIG_MMC_IMX
...@@ -75,6 +138,17 @@ mx1ads_init(void) ...@@ -75,6 +138,17 @@ mx1ads_init(void)
imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20); imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
imx_set_mmc_info(&mx1ads_mmc_info); imx_set_mmc_info(&mx1ads_mmc_info);
#endif #endif
imx_gpio_mode(PC9_PF_UART1_CTS);
imx_gpio_mode(PC10_PF_UART1_RTS);
imx_gpio_mode(PC11_PF_UART1_TXD);
imx_gpio_mode(PC12_PF_UART1_RXD);
imx_gpio_mode(PB28_PF_UART2_CTS);
imx_gpio_mode(PB29_PF_UART2_RTS);
imx_gpio_mode(PB30_PF_UART2_TXD);
imx_gpio_mode(PB31_PF_UART2_RXD);
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
} }
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/arch/imx-uart.h>
/* We've been assigned a range on the "Low-density serial ports" major */ /* We've been assigned a range on the "Low-density serial ports" major */
#define SERIAL_IMX_MAJOR 204 #define SERIAL_IMX_MAJOR 204
...@@ -73,7 +74,8 @@ struct imx_port { ...@@ -73,7 +74,8 @@ struct imx_port {
struct uart_port port; struct uart_port port;
struct timer_list timer; struct timer_list timer;
unsigned int old_status; unsigned int old_status;
int txirq,rxirq,rtsirq; int txirq,rxirq,rtsirq;
int have_rtscts:1;
}; };
/* /*
...@@ -491,8 +493,12 @@ imx_set_termios(struct uart_port *port, struct termios *termios, ...@@ -491,8 +493,12 @@ imx_set_termios(struct uart_port *port, struct termios *termios,
ucr2 = UCR2_SRST | UCR2_IRTS; ucr2 = UCR2_SRST | UCR2_IRTS;
if (termios->c_cflag & CRTSCTS) { if (termios->c_cflag & CRTSCTS) {
ucr2 &= ~UCR2_IRTS; if( sport->have_rtscts ) {
ucr2 |= UCR2_CTSC; ucr2 &= ~UCR2_IRTS;
ucr2 |= UCR2_CTSC;
} else {
termios->c_cflag &= ~CRTSCTS;
}
} }
if (termios->c_cflag & CSTOPB) if (termios->c_cflag & CSTOPB)
...@@ -719,27 +725,6 @@ static void __init imx_init_ports(void) ...@@ -719,27 +725,6 @@ static void __init imx_init_ports(void)
imx_ports[i].timer.function = imx_timeout; imx_ports[i].timer.function = imx_timeout;
imx_ports[i].timer.data = (unsigned long)&imx_ports[i]; imx_ports[i].timer.data = (unsigned long)&imx_ports[i];
} }
imx_gpio_mode(PC9_PF_UART1_CTS);
imx_gpio_mode(PC10_PF_UART1_RTS);
imx_gpio_mode(PC11_PF_UART1_TXD);
imx_gpio_mode(PC12_PF_UART1_RXD);
imx_gpio_mode(PB28_PF_UART2_CTS);
imx_gpio_mode(PB29_PF_UART2_RTS);
imx_gpio_mode(PB30_PF_UART2_TXD);
imx_gpio_mode(PB31_PF_UART2_RXD);
#if 0 /* We don't need these, on the mx1 the _modem_ side of the uart
* is implemented.
*/
imx_gpio_mode(PD7_AF_UART2_DTR);
imx_gpio_mode(PD8_AF_UART2_DCD);
imx_gpio_mode(PD9_AF_UART2_RI);
imx_gpio_mode(PD10_AF_UART2_DSR);
#endif
} }
#ifdef CONFIG_SERIAL_IMX_CONSOLE #ifdef CONFIG_SERIAL_IMX_CONSOLE
...@@ -932,7 +917,14 @@ static int serial_imx_resume(struct platform_device *dev) ...@@ -932,7 +917,14 @@ static int serial_imx_resume(struct platform_device *dev)
static int serial_imx_probe(struct platform_device *dev) static int serial_imx_probe(struct platform_device *dev)
{ {
struct imxuart_platform_data *pdata;
imx_ports[dev->id].port.dev = &dev->dev; imx_ports[dev->id].port.dev = &dev->dev;
pdata = (struct imxuart_platform_data *)dev->dev.platform_data;
if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
imx_ports[dev->id].have_rtscts = 1;
uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
platform_set_drvdata(dev, &imx_ports[dev->id]); platform_set_drvdata(dev, &imx_ports[dev->id]);
return 0; return 0;
......
#ifndef ASMARM_ARCH_UART_H
#define ASMARM_ARCH_UART_H
#define IMXUART_HAVE_RTSCTS (1<<0)
struct imxuart_platform_data {
unsigned int flags;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment