Merge tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-orion5x / common.c
index e2e9db492d0c3622e20a21a3832d6b485508353d..9148b229d0de925b4f95fea5154421fa462331ba 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/mv643xx_i2c.h>
 #include <linux/ata_platform.h>
 #include <linux/delay.h>
+#include <linux/clk-provider.h>
 #include <net/dsa.h>
 #include <asm/page.h>
 #include <asm/setup.h>
@@ -69,6 +70,19 @@ void __init orion5x_map_io(void)
 }
 
 
+/*****************************************************************************
+ * CLK tree
+ ****************************************************************************/
+static struct clk *tclk;
+
+static void __init clk_init(void)
+{
+       tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
+                                      orion5x_tclk);
+
+       orion_clkdev_init(tclk);
+}
+
 /*****************************************************************************
  * EHCI0
  ****************************************************************************/
@@ -95,7 +109,7 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
 {
        orion_ge00_init(eth_data,
                        ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM,
-                       IRQ_ORION5X_ETH_ERR, orion5x_tclk);
+                       IRQ_ORION5X_ETH_ERR);
 }
 
 
@@ -132,7 +146,7 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
  ****************************************************************************/
 void __init orion5x_spi_init()
 {
-       orion_spi_init(SPI_PHYS_BASE, orion5x_tclk);
+       orion_spi_init(SPI_PHYS_BASE);
 }
 
 
@@ -142,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);
 }
 
 /*****************************************************************************
@@ -151,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);
 }
 
 /*****************************************************************************
@@ -179,7 +193,7 @@ static void __init orion5x_crypto_init(void)
  ****************************************************************************/
 void __init orion5x_wdt_init(void)
 {
-       orion_wdt_init(orion5x_tclk);
+       orion_wdt_init();
 }
 
 
@@ -276,6 +290,9 @@ void __init orion5x_init(void)
         */
        orion5x_setup_cpu_mbus_bridge();
 
+       /* Setup root of clk tree */
+       clk_init();
+
        /*
         * Don't issue "Wait for Interrupt" instruction if we are
         * running on D0 5281 silicon.