summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/serial.c
diff options
context:
space:
mode:
authorManjunathappa, Prakash <prakash.pm@ti.com>2013-06-19 11:15:38 +0200
committerSekhar Nori <nsekhar@ti.com>2013-07-22 12:04:55 +0200
commit19955c3d7453757271d05859958ca1804a5d2d67 (patch)
tree978e156a66db7dae2435c23046a75757958f8e5f /arch/arm/mach-davinci/serial.c
parentLinux 3.11-rc2 (diff)
downloadlinux-19955c3d7453757271d05859958ca1804a5d2d67.tar.xz
linux-19955c3d7453757271d05859958ca1804a5d2d67.zip
ARM: davinci: uart: move to devid based clk_get
For modules having single clock, clk_get should be done with dev_id. But current davinci implementation handles multiple instances of the UART devices with single platform_device_register. Hence clk_get is based on con_id rather than dev_id, this is not correct. Do platform_device_register for each instance and clk_get on dev_id. Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com> [nsekhar@ti.com: actually stop using con_id in clk_get(), squash the patch adding OF aux data into this one] Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci/serial.c')
-rw-r--r--arch/arm/mach-davinci/serial.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index f2625814c3c9..2bc74c2a8d45 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -73,13 +73,11 @@ static void __init davinci_serial_reset(struct plat_serial8250_port *p)
/* Enable UART clock and obtain its rate */
int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
{
- char name[16];
struct clk *clk;
struct davinci_soc_info *soc_info = &davinci_soc_info;
- struct device *dev = &soc_info->serial_dev->dev;
+ struct device *dev = &soc_info->serial_dev[instance].dev;
- sprintf(name, "uart%d", instance);
- clk = clk_get(dev, name);
+ clk = clk_get(dev, NULL);
if (IS_ERR(clk)) {
pr_err("%s:%d: failed to get UART%d clock\n",
__func__, __LINE__, instance);
@@ -96,19 +94,25 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
int __init davinci_serial_init(struct davinci_uart_config *info)
{
- int i, ret;
+ int i, ret = 0;
struct davinci_soc_info *soc_info = &davinci_soc_info;
- struct device *dev = &soc_info->serial_dev->dev;
- struct plat_serial8250_port *p = dev->platform_data;
+ struct device *dev;
+ struct plat_serial8250_port *p;
/*
* Make sure the serial ports are muxed on at this point.
* You have to mux them off in device drivers later on if not needed.
*/
- for (i = 0; p->flags; i++, p++) {
+ for (i = 0; soc_info->serial_dev[i].dev.platform_data != NULL; i++) {
+ dev = &soc_info->serial_dev[i].dev;
+ p = dev->platform_data;
if (!(info->enabled_uarts & (1 << i)))
continue;
+ ret = platform_device_register(&soc_info->serial_dev[i]);
+ if (ret)
+ continue;
+
ret = davinci_serial_setup_clk(i, &p->uartclk);
if (ret)
continue;
@@ -125,6 +129,5 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
if (p->membase && p->type != PORT_AR7)
davinci_serial_reset(p);
}
-
- return platform_device_register(soc_info->serial_dev);
+ return ret;
}