summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/serial.c
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-05-02 14:28:13 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-05-06 15:02:10 -0700
commit9ee1acefa86083c6acf4112983b88a0057eb7785 (patch)
treea5a3ce140b5596bbfc9fd48fe664c9fd6fc1786d /arch/arm/mach-davinci/serial.c
parentda0122ca8b7804b9cd8fa7eff466bafba27f09a3 (diff)
downloadop-kernel-dev-9ee1acefa86083c6acf4112983b88a0057eb7785.zip
op-kernel-dev-9ee1acefa86083c6acf4112983b88a0057eb7785.tar.gz
Davinci: serial - use ioremap()
This patch implements davinci serial cleanups towards having this code reusable on tnetv107x. The change reuses the platform data membase field to hold the remapped space. By disabling the UPF_IOREMAP flag in the platform data, we prevent the 8250 driver from repeating the ioremap. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/serial.c')
-rw-r--r--arch/arm/mach-davinci/serial.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 709e1a9..81af42c 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -35,14 +35,20 @@ static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
int offset)
{
offset <<= up->regshift;
- return (unsigned int)__raw_readl(IO_ADDRESS(up->mapbase) + offset);
+
+ WARN_ONCE(!up->membase, "unmapped read: uart[%d]\n", offset);
+
+ return (unsigned int)__raw_readl(up->membase + offset);
}
static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
int value)
{
offset <<= p->regshift;
- __raw_writel(value, IO_ADDRESS(p->mapbase) + offset);
+
+ WARN_ONCE(!p->membase, "unmapped write: uart[%d]\n", offset);
+
+ __raw_writel(value, p->membase + offset);
}
static void __init davinci_serial_reset(struct plat_serial8250_port *p)
@@ -83,14 +89,26 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
sprintf(name, "uart%d", i);
uart_clk = clk_get(dev, name);
- if (IS_ERR(uart_clk))
+ if (IS_ERR(uart_clk)) {
printk(KERN_ERR "%s:%d: failed to get UART%d clock\n",
__func__, __LINE__, i);
- else {
- clk_enable(uart_clk);
- p->uartclk = clk_get_rate(uart_clk);
- davinci_serial_reset(p);
+ continue;
}
+
+ clk_enable(uart_clk);
+ p->uartclk = clk_get_rate(uart_clk);
+
+ if (!p->membase && p->mapbase) {
+ p->membase = ioremap(p->mapbase, SZ_4K);
+
+ if (p->membase)
+ p->flags &= ~UPF_IOREMAP;
+ else
+ pr_err("uart regs ioremap failed\n");
+ }
+
+ if (p->membase)
+ davinci_serial_reset(p);
}
return platform_device_register(soc_info->serial_dev);
OpenPOWER on IntegriCloud