diff options
author | Cyril Chemparathy <cyril@ti.com> | 2010-05-02 14:28:13 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-05-06 18:02:10 -0400 |
commit | 9ee1acefa86083c6acf4112983b88a0057eb7785 (patch) | |
tree | a5a3ce140b5596bbfc9fd48fe664c9fd6fc1786d /arch/arm | |
parent | da0122ca8b7804b9cd8fa7eff466bafba27f09a3 (diff) |
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')
-rw-r--r-- | arch/arm/mach-davinci/serial.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c index 709e1a90ec2a..81af42ca29d2 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, | |||
35 | int offset) | 35 | int offset) |
36 | { | 36 | { |
37 | offset <<= up->regshift; | 37 | offset <<= up->regshift; |
38 | return (unsigned int)__raw_readl(IO_ADDRESS(up->mapbase) + offset); | 38 | |
39 | WARN_ONCE(!up->membase, "unmapped read: uart[%d]\n", offset); | ||
40 | |||
41 | return (unsigned int)__raw_readl(up->membase + offset); | ||
39 | } | 42 | } |
40 | 43 | ||
41 | static inline void serial_write_reg(struct plat_serial8250_port *p, int offset, | 44 | static inline void serial_write_reg(struct plat_serial8250_port *p, int offset, |
42 | int value) | 45 | int value) |
43 | { | 46 | { |
44 | offset <<= p->regshift; | 47 | offset <<= p->regshift; |
45 | __raw_writel(value, IO_ADDRESS(p->mapbase) + offset); | 48 | |
49 | WARN_ONCE(!p->membase, "unmapped write: uart[%d]\n", offset); | ||
50 | |||
51 | __raw_writel(value, p->membase + offset); | ||
46 | } | 52 | } |
47 | 53 | ||
48 | static void __init davinci_serial_reset(struct plat_serial8250_port *p) | 54 | 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) | |||
83 | 89 | ||
84 | sprintf(name, "uart%d", i); | 90 | sprintf(name, "uart%d", i); |
85 | uart_clk = clk_get(dev, name); | 91 | uart_clk = clk_get(dev, name); |
86 | if (IS_ERR(uart_clk)) | 92 | if (IS_ERR(uart_clk)) { |
87 | printk(KERN_ERR "%s:%d: failed to get UART%d clock\n", | 93 | printk(KERN_ERR "%s:%d: failed to get UART%d clock\n", |
88 | __func__, __LINE__, i); | 94 | __func__, __LINE__, i); |
89 | else { | 95 | continue; |
90 | clk_enable(uart_clk); | ||
91 | p->uartclk = clk_get_rate(uart_clk); | ||
92 | davinci_serial_reset(p); | ||
93 | } | 96 | } |
97 | |||
98 | clk_enable(uart_clk); | ||
99 | p->uartclk = clk_get_rate(uart_clk); | ||
100 | |||
101 | if (!p->membase && p->mapbase) { | ||
102 | p->membase = ioremap(p->mapbase, SZ_4K); | ||
103 | |||
104 | if (p->membase) | ||
105 | p->flags &= ~UPF_IOREMAP; | ||
106 | else | ||
107 | pr_err("uart regs ioremap failed\n"); | ||
108 | } | ||
109 | |||
110 | if (p->membase) | ||
111 | davinci_serial_reset(p); | ||
94 | } | 112 | } |
95 | 113 | ||
96 | return platform_device_register(soc_info->serial_dev); | 114 | return platform_device_register(soc_info->serial_dev); |