aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-orion
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-12-23 21:06:34 -0500
committerMike Turquette <mturquette@linaro.org>2012-05-08 19:33:57 -0400
commit74c335761acdfd94736d28ba0b941a2efb9c81f0 (patch)
tree48a1011670391a6dfd8b2b1fac33a4f0221fe0d2 /arch/arm/plat-orion
parent4f04be62af95119d258b8035f498100e43c8c527 (diff)
ARM: Orion: UART: Get the clock rate via clk_get_rate().
Let the machine pass to the platform which clock is used by the uart. Enable the clock and use clk_get_rate() to determine its rate. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r--arch/arm/plat-orion/common.c26
-rw-r--r--arch/arm/plat-orion/include/plat/common.h8
2 files changed, 20 insertions, 14 deletions
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index d349998f72e..61fd837624a 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -75,6 +75,12 @@ static void fill_resources(struct platform_device *device,
75/***************************************************************************** 75/*****************************************************************************
76 * UART 76 * UART
77 ****************************************************************************/ 77 ****************************************************************************/
78static unsigned long __init uart_get_clk_rate(struct clk *clk)
79{
80 clk_prepare_enable(clk);
81 return clk_get_rate(clk);
82}
83
78static void __init uart_complete( 84static void __init uart_complete(
79 struct platform_device *orion_uart, 85 struct platform_device *orion_uart,
80 struct plat_serial8250_port *data, 86 struct plat_serial8250_port *data,
@@ -82,12 +88,12 @@ static void __init uart_complete(
82 unsigned int membase, 88 unsigned int membase,
83 resource_size_t mapbase, 89 resource_size_t mapbase,
84 unsigned int irq, 90 unsigned int irq,
85 unsigned int uartclk) 91 struct clk *clk)
86{ 92{
87 data->mapbase = mapbase; 93 data->mapbase = mapbase;
88 data->membase = (void __iomem *)membase; 94 data->membase = (void __iomem *)membase;
89 data->irq = irq; 95 data->irq = irq;
90 data->uartclk = uartclk; 96 data->uartclk = uart_get_clk_rate(clk);
91 orion_uart->dev.platform_data = data; 97 orion_uart->dev.platform_data = data;
92 98
93 fill_resources(orion_uart, resources, mapbase, 0xff, irq); 99 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
@@ -116,10 +122,10 @@ static struct platform_device orion_uart0 = {
116void __init orion_uart0_init(unsigned int membase, 122void __init orion_uart0_init(unsigned int membase,
117 resource_size_t mapbase, 123 resource_size_t mapbase,
118 unsigned int irq, 124 unsigned int irq,
119 unsigned int uartclk) 125 struct clk *clk)
120{ 126{
121 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources, 127 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
122 membase, mapbase, irq, uartclk); 128 membase, mapbase, irq, clk);
123} 129}
124 130
125/***************************************************************************** 131/*****************************************************************************
@@ -144,10 +150,10 @@ static struct platform_device orion_uart1 = {
144void __init orion_uart1_init(unsigned int membase, 150void __init orion_uart1_init(unsigned int membase,
145 resource_size_t mapbase, 151 resource_size_t mapbase,
146 unsigned int irq, 152 unsigned int irq,
147 unsigned int uartclk) 153 struct clk *clk)
148{ 154{
149 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources, 155 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
150 membase, mapbase, irq, uartclk); 156 membase, mapbase, irq, clk);
151} 157}
152 158
153/***************************************************************************** 159/*****************************************************************************
@@ -172,10 +178,10 @@ static struct platform_device orion_uart2 = {
172void __init orion_uart2_init(unsigned int membase, 178void __init orion_uart2_init(unsigned int membase,
173 resource_size_t mapbase, 179 resource_size_t mapbase,
174 unsigned int irq, 180 unsigned int irq,
175 unsigned int uartclk) 181 struct clk *clk)
176{ 182{
177 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources, 183 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
178 membase, mapbase, irq, uartclk); 184 membase, mapbase, irq, clk);
179} 185}
180 186
181/***************************************************************************** 187/*****************************************************************************
@@ -200,10 +206,10 @@ static struct platform_device orion_uart3 = {
200void __init orion_uart3_init(unsigned int membase, 206void __init orion_uart3_init(unsigned int membase,
201 resource_size_t mapbase, 207 resource_size_t mapbase,
202 unsigned int irq, 208 unsigned int irq,
203 unsigned int uartclk) 209 struct clk *clk)
204{ 210{
205 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources, 211 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
206 membase, mapbase, irq, uartclk); 212 membase, mapbase, irq, clk);
207} 213}
208 214
209/***************************************************************************** 215/*****************************************************************************
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index c3bfa91bfaa..e00fdb21360 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -16,22 +16,22 @@ struct dsa_platform_data;
16void __init orion_uart0_init(unsigned int membase, 16void __init orion_uart0_init(unsigned int membase,
17 resource_size_t mapbase, 17 resource_size_t mapbase,
18 unsigned int irq, 18 unsigned int irq,
19 unsigned int uartclk); 19 struct clk *clk);
20 20
21void __init orion_uart1_init(unsigned int membase, 21void __init orion_uart1_init(unsigned int membase,
22 resource_size_t mapbase, 22 resource_size_t mapbase,
23 unsigned int irq, 23 unsigned int irq,
24 unsigned int uartclk); 24 struct clk *clk);
25 25
26void __init orion_uart2_init(unsigned int membase, 26void __init orion_uart2_init(unsigned int membase,
27 resource_size_t mapbase, 27 resource_size_t mapbase,
28 unsigned int irq, 28 unsigned int irq,
29 unsigned int uartclk); 29 struct clk *clk);
30 30
31void __init orion_uart3_init(unsigned int membase, 31void __init orion_uart3_init(unsigned int membase,
32 resource_size_t mapbase, 32 resource_size_t mapbase,
33 unsigned int irq, 33 unsigned int irq,
34 unsigned int uartclk); 34 struct clk *clk);
35 35
36void __init orion_rtc_init(unsigned long mapbase, 36void __init orion_rtc_init(unsigned long mapbase,
37 unsigned long irq); 37 unsigned long irq);