aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/serial.c
diff options
context:
space:
mode:
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)
73/* Enable UART clock and obtain its rate */ 73/* Enable UART clock and obtain its rate */
74int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate) 74int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
75{ 75{
76 char name[16];
77 struct clk *clk; 76 struct clk *clk;
78 struct davinci_soc_info *soc_info = &davinci_soc_info; 77 struct davinci_soc_info *soc_info = &davinci_soc_info;
79 struct device *dev = &soc_info->serial_dev->dev; 78 struct device *dev = &soc_info->serial_dev[instance].dev;
80 79
81 sprintf(name, "uart%d", instance); 80 clk = clk_get(dev, NULL);
82 clk = clk_get(dev, name);
83 if (IS_ERR(clk)) { 81 if (IS_ERR(clk)) {
84 pr_err("%s:%d: failed to get UART%d clock\n", 82 pr_err("%s:%d: failed to get UART%d clock\n",
85 __func__, __LINE__, instance); 83 __func__, __LINE__, instance);
@@ -96,19 +94,25 @@ int __init davinci_serial_setup_clk(unsigned instance, unsigned int *rate)
96 94
97int __init davinci_serial_init(struct davinci_uart_config *info) 95int __init davinci_serial_init(struct davinci_uart_config *info)
98{ 96{
99 int i, ret; 97 int i, ret = 0;
100 struct davinci_soc_info *soc_info = &davinci_soc_info; 98 struct davinci_soc_info *soc_info = &davinci_soc_info;
101 struct device *dev = &soc_info->serial_dev->dev; 99 struct device *dev;
102 struct plat_serial8250_port *p = dev->platform_data; 100 struct plat_serial8250_port *p;
103 101
104 /* 102 /*
105 * Make sure the serial ports are muxed on at this point. 103 * Make sure the serial ports are muxed on at this point.
106 * You have to mux them off in device drivers later on if not needed. 104 * You have to mux them off in device drivers later on if not needed.
107 */ 105 */
108 for (i = 0; p->flags; i++, p++) { 106 for (i = 0; soc_info->serial_dev[i].dev.platform_data != NULL; i++) {
107 dev = &soc_info->serial_dev[i].dev;
108 p = dev->platform_data;
109 if (!(info->enabled_uarts & (1 << i))) 109 if (!(info->enabled_uarts & (1 << i)))
110 continue; 110 continue;
111 111
112 ret = platform_device_register(&soc_info->serial_dev[i]);
113 if (ret)
114 continue;
115
112 ret = davinci_serial_setup_clk(i, &p->uartclk); 116 ret = davinci_serial_setup_clk(i, &p->uartclk);
113 if (ret) 117 if (ret)
114 continue; 118 continue;
@@ -125,6 +129,5 @@ int __init davinci_serial_init(struct davinci_uart_config *info)
125 if (p->membase && p->type != PORT_AR7) 129 if (p->membase && p->type != PORT_AR7)
126 davinci_serial_reset(p); 130 davinci_serial_reset(p);
127 } 131 }
128 132 return ret;
129 return platform_device_register(soc_info->serial_dev);
130} 133}