ARM: Orion: UART: Get the clock rate via clk_get_rate().
authorAndrew Lunn <andrew@lunn.ch>
Sat, 24 Dec 2011 02:06:34 +0000 (03:06 +0100)
committerMike Turquette <mturquette@linaro.org>
Tue, 8 May 2012 23:33:57 +0000 (16:33 -0700)
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>
arch/arm/mach-dove/common.c
arch/arm/mach-kirkwood/common.c
arch/arm/mach-mv78xx0/common.c
arch/arm/mach-orion5x/common.c
arch/arm/plat-orion/common.c
arch/arm/plat-orion/include/plat/common.h

index 02766960480dc658cd3497a2a814c5b34447697e..0ab0f81b661dd1b2e889402ff6af43f0ca17d82c 100644 (file)
@@ -128,7 +128,7 @@ void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
 void __init dove_uart0_init(void)
 {
        orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
-                        IRQ_DOVE_UART_0, get_tclk());
+                        IRQ_DOVE_UART_0, tclk);
 }
 
 /*****************************************************************************
@@ -137,7 +137,7 @@ void __init dove_uart0_init(void)
 void __init dove_uart1_init(void)
 {
        orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
-                        IRQ_DOVE_UART_1, get_tclk());
+                        IRQ_DOVE_UART_1, tclk);
 }
 
 /*****************************************************************************
@@ -146,7 +146,7 @@ void __init dove_uart1_init(void)
 void __init dove_uart2_init(void)
 {
        orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
-                        IRQ_DOVE_UART_2, get_tclk());
+                        IRQ_DOVE_UART_2, tclk);
 }
 
 /*****************************************************************************
@@ -155,7 +155,7 @@ void __init dove_uart2_init(void)
 void __init dove_uart3_init(void)
 {
        orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
-                        IRQ_DOVE_UART_3, get_tclk());
+                        IRQ_DOVE_UART_3, tclk);
 }
 
 /*****************************************************************************
index 880f3667a2eb5f7e4299825e0c668d5a4e3ed6f7..46d7b4374908f1a19c959006a883da1343e5e6e9 100644 (file)
@@ -299,7 +299,7 @@ void __init kirkwood_i2c_init(void)
 void __init kirkwood_uart0_init(void)
 {
        orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
-                        IRQ_KIRKWOOD_UART_0, kirkwood_tclk);
+                        IRQ_KIRKWOOD_UART_0, tclk);
 }
 
 
@@ -309,7 +309,7 @@ void __init kirkwood_uart0_init(void)
 void __init kirkwood_uart1_init(void)
 {
        orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
-                        IRQ_KIRKWOOD_UART_1, kirkwood_tclk);
+                        IRQ_KIRKWOOD_UART_1, tclk);
 }
 
 /*****************************************************************************
index ad4d037bbcd3e22fbd28b0a1326c7dc4bc3b000b..b4c53b846c9caa8402ce764aec9f9f254379031a 100644 (file)
@@ -299,7 +299,7 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
 void __init mv78xx0_uart0_init(void)
 {
        orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
-                        IRQ_MV78XX0_UART_0, get_tclk());
+                        IRQ_MV78XX0_UART_0, tclk);
 }
 
 
@@ -309,7 +309,7 @@ void __init mv78xx0_uart0_init(void)
 void __init mv78xx0_uart1_init(void)
 {
        orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
-                        IRQ_MV78XX0_UART_1, get_tclk());
+                        IRQ_MV78XX0_UART_1, tclk);
 }
 
 
@@ -319,7 +319,7 @@ void __init mv78xx0_uart1_init(void)
 void __init mv78xx0_uart2_init(void)
 {
        orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE,
-                        IRQ_MV78XX0_UART_2, get_tclk());
+                        IRQ_MV78XX0_UART_2, tclk);
 }
 
 /*****************************************************************************
@@ -328,7 +328,7 @@ void __init mv78xx0_uart2_init(void)
 void __init mv78xx0_uart3_init(void)
 {
        orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE,
-                        IRQ_MV78XX0_UART_3, get_tclk());
+                        IRQ_MV78XX0_UART_3, tclk);
 }
 
 /*****************************************************************************
index 067bdd7c06ddaf98448307316108eb2ccc4bb2a5..fd36e020d09d855a03bcae16d9ce16d61f387a64 100644 (file)
@@ -156,7 +156,7 @@ void __init orion5x_spi_init()
 void __init orion5x_uart0_init(void)
 {
        orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
-                        IRQ_ORION5X_UART0, orion5x_tclk);
+                        IRQ_ORION5X_UART0, tclk);
 }
 
 /*****************************************************************************
@@ -165,7 +165,7 @@ void __init orion5x_uart0_init(void)
 void __init orion5x_uart1_init(void)
 {
        orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
-                        IRQ_ORION5X_UART1, orion5x_tclk);
+                        IRQ_ORION5X_UART1, tclk);
 }
 
 /*****************************************************************************
index d349998f72e5955f4e0a9dd96aee49ac9da9ae47..61fd837624a8532dc38e13a078d1d83941afc1d8 100644 (file)
@@ -75,6 +75,12 @@ static void fill_resources(struct platform_device *device,
 /*****************************************************************************
  * UART
  ****************************************************************************/
+static unsigned long __init uart_get_clk_rate(struct clk *clk)
+{
+       clk_prepare_enable(clk);
+       return clk_get_rate(clk);
+}
+
 static void __init uart_complete(
        struct platform_device *orion_uart,
        struct plat_serial8250_port *data,
@@ -82,12 +88,12 @@ static void __init uart_complete(
        unsigned int membase,
        resource_size_t mapbase,
        unsigned int irq,
-       unsigned int uartclk)
+       struct clk *clk)
 {
        data->mapbase = mapbase;
        data->membase = (void __iomem *)membase;
        data->irq = irq;
-       data->uartclk = uartclk;
+       data->uartclk = uart_get_clk_rate(clk);
        orion_uart->dev.platform_data = data;
 
        fill_resources(orion_uart, resources, mapbase, 0xff, irq);
@@ -116,10 +122,10 @@ static struct platform_device orion_uart0 = {
 void __init orion_uart0_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk)
+                            struct clk *clk)
 {
        uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
-                     membase, mapbase, irq, uartclk);
+                     membase, mapbase, irq, clk);
 }
 
 /*****************************************************************************
@@ -144,10 +150,10 @@ static struct platform_device orion_uart1 = {
 void __init orion_uart1_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk)
+                            struct clk *clk)
 {
        uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
-                     membase, mapbase, irq, uartclk);
+                     membase, mapbase, irq, clk);
 }
 
 /*****************************************************************************
@@ -172,10 +178,10 @@ static struct platform_device orion_uart2 = {
 void __init orion_uart2_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk)
+                            struct clk *clk)
 {
        uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
-                     membase, mapbase, irq, uartclk);
+                     membase, mapbase, irq, clk);
 }
 
 /*****************************************************************************
@@ -200,10 +206,10 @@ static struct platform_device orion_uart3 = {
 void __init orion_uart3_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk)
+                            struct clk *clk)
 {
        uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
-                     membase, mapbase, irq, uartclk);
+                     membase, mapbase, irq, clk);
 }
 
 /*****************************************************************************
index c3bfa91bfaa645c57048643ab5dc6ca2dd525311..e00fdb2136090154ea930c9f224365677644444e 100644 (file)
@@ -16,22 +16,22 @@ struct dsa_platform_data;
 void __init orion_uart0_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk);
+                            struct clk *clk);
 
 void __init orion_uart1_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk);
+                            struct clk *clk);
 
 void __init orion_uart2_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk);
+                            struct clk *clk);
 
 void __init orion_uart3_init(unsigned int membase,
                             resource_size_t mapbase,
                             unsigned int irq,
-                            unsigned int uartclk);
+                            struct clk *clk);
 
 void __init orion_rtc_init(unsigned long mapbase,
                           unsigned long irq);