ARM: 6788/1: SPEAr: Include mach/hardware.h instead of mach/spear.h
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-spear6xx / spear6xx.c
index f2fe14e8471d45dabea19bb994ce5ccdc992e72b..378440bdb1c95d1c7338a531315db0406b1c699e 100644 (file)
@@ -18,9 +18,9 @@
 #include <asm/hardware/vic.h>
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
-#include <mach/irqs.h>
 #include <mach/generic.h>
-#include <mach/spear.h>
+#include <mach/hardware.h>
+#include <mach/irqs.h>
 
 /* Add spear6xx machines common devices here */
 /* uart device registration */
@@ -155,3 +155,34 @@ void __init spear6xx_map_io(void)
        /* This will initialize clock framework */
        clk_init();
 }
+
+static void __init spear6xx_timer_init(void)
+{
+       char pclk_name[] = "pll3_48m_clk";
+       struct clk *gpt_clk, *pclk;
+
+       /* get the system timer clock */
+       gpt_clk = clk_get_sys("gpt0", NULL);
+       if (IS_ERR(gpt_clk)) {
+               pr_err("%s:couldn't get clk for gpt\n", __func__);
+               BUG();
+       }
+
+       /* get the suitable parent clock for timer*/
+       pclk = clk_get(NULL, pclk_name);
+       if (IS_ERR(pclk)) {
+               pr_err("%s:couldn't get %s as parent for gpt\n",
+                               __func__, pclk_name);
+               BUG();
+       }
+
+       clk_set_parent(gpt_clk, pclk);
+       clk_put(gpt_clk);
+       clk_put(pclk);
+
+       spear_setup_timer();
+}
+
+struct sys_timer spear6xx_timer = {
+       .init = spear6xx_timer_init,
+};