aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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
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')
-rw-r--r--arch/arm/mach-dove/common.c8
-rw-r--r--arch/arm/mach-kirkwood/common.c4
-rw-r--r--arch/arm/mach-mv78xx0/common.c8
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/plat-orion/common.c26
-rw-r--r--arch/arm/plat-orion/include/plat/common.h8
6 files changed, 32 insertions, 26 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 02766960480d..0ab0f81b661d 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -128,7 +128,7 @@ void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
128void __init dove_uart0_init(void) 128void __init dove_uart0_init(void)
129{ 129{
130 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE, 130 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
131 IRQ_DOVE_UART_0, get_tclk()); 131 IRQ_DOVE_UART_0, tclk);
132} 132}
133 133
134/***************************************************************************** 134/*****************************************************************************
@@ -137,7 +137,7 @@ void __init dove_uart0_init(void)
137void __init dove_uart1_init(void) 137void __init dove_uart1_init(void)
138{ 138{
139 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE, 139 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
140 IRQ_DOVE_UART_1, get_tclk()); 140 IRQ_DOVE_UART_1, tclk);
141} 141}
142 142
143/***************************************************************************** 143/*****************************************************************************
@@ -146,7 +146,7 @@ void __init dove_uart1_init(void)
146void __init dove_uart2_init(void) 146void __init dove_uart2_init(void)
147{ 147{
148 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE, 148 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
149 IRQ_DOVE_UART_2, get_tclk()); 149 IRQ_DOVE_UART_2, tclk);
150} 150}
151 151
152/***************************************************************************** 152/*****************************************************************************
@@ -155,7 +155,7 @@ void __init dove_uart2_init(void)
155void __init dove_uart3_init(void) 155void __init dove_uart3_init(void)
156{ 156{
157 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE, 157 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
158 IRQ_DOVE_UART_3, get_tclk()); 158 IRQ_DOVE_UART_3, tclk);
159} 159}
160 160
161/***************************************************************************** 161/*****************************************************************************
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 880f3667a2eb..46d7b4374908 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -299,7 +299,7 @@ void __init kirkwood_i2c_init(void)
299void __init kirkwood_uart0_init(void) 299void __init kirkwood_uart0_init(void)
300{ 300{
301 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, 301 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
302 IRQ_KIRKWOOD_UART_0, kirkwood_tclk); 302 IRQ_KIRKWOOD_UART_0, tclk);
303} 303}
304 304
305 305
@@ -309,7 +309,7 @@ void __init kirkwood_uart0_init(void)
309void __init kirkwood_uart1_init(void) 309void __init kirkwood_uart1_init(void)
310{ 310{
311 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, 311 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
312 IRQ_KIRKWOOD_UART_1, kirkwood_tclk); 312 IRQ_KIRKWOOD_UART_1, tclk);
313} 313}
314 314
315/***************************************************************************** 315/*****************************************************************************
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index ad4d037bbcd3..b4c53b846c9c 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -299,7 +299,7 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
299void __init mv78xx0_uart0_init(void) 299void __init mv78xx0_uart0_init(void)
300{ 300{
301 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, 301 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
302 IRQ_MV78XX0_UART_0, get_tclk()); 302 IRQ_MV78XX0_UART_0, tclk);
303} 303}
304 304
305 305
@@ -309,7 +309,7 @@ void __init mv78xx0_uart0_init(void)
309void __init mv78xx0_uart1_init(void) 309void __init mv78xx0_uart1_init(void)
310{ 310{
311 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, 311 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
312 IRQ_MV78XX0_UART_1, get_tclk()); 312 IRQ_MV78XX0_UART_1, tclk);
313} 313}
314 314
315 315
@@ -319,7 +319,7 @@ void __init mv78xx0_uart1_init(void)
319void __init mv78xx0_uart2_init(void) 319void __init mv78xx0_uart2_init(void)
320{ 320{
321 orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE, 321 orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE,
322 IRQ_MV78XX0_UART_2, get_tclk()); 322 IRQ_MV78XX0_UART_2, tclk);
323} 323}
324 324
325/***************************************************************************** 325/*****************************************************************************
@@ -328,7 +328,7 @@ void __init mv78xx0_uart2_init(void)
328void __init mv78xx0_uart3_init(void) 328void __init mv78xx0_uart3_init(void)
329{ 329{
330 orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE, 330 orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE,
331 IRQ_MV78XX0_UART_3, get_tclk()); 331 IRQ_MV78XX0_UART_3, tclk);
332} 332}
333 333
334/***************************************************************************** 334/*****************************************************************************
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 067bdd7c06dd..fd36e020d09d 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -156,7 +156,7 @@ void __init orion5x_spi_init()
156void __init orion5x_uart0_init(void) 156void __init orion5x_uart0_init(void)
157{ 157{
158 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, 158 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
159 IRQ_ORION5X_UART0, orion5x_tclk); 159 IRQ_ORION5X_UART0, tclk);
160} 160}
161 161
162/***************************************************************************** 162/*****************************************************************************
@@ -165,7 +165,7 @@ void __init orion5x_uart0_init(void)
165void __init orion5x_uart1_init(void) 165void __init orion5x_uart1_init(void)
166{ 166{
167 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, 167 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
168 IRQ_ORION5X_UART1, orion5x_tclk); 168 IRQ_ORION5X_UART1, tclk);
169} 169}
170 170
171/***************************************************************************** 171/*****************************************************************************
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index d349998f72e5..61fd837624a8 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 c3bfa91bfaa6..e00fdb213609 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);