ARM: imx6q_sabrelite: clk_register_clkdev cko1 for sgtl5000
authorRichard Zhao <richard.zhao@freescale.com>
Tue, 24 Apr 2012 06:19:13 +0000 (14:19 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Fri, 11 May 2012 07:18:06 +0000 (15:18 +0800)
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/mach-imx/clk-imx6q.c
arch/arm/mach-imx/mach-imx6q.c

index f80d18b3f05366e515a5217fc5eb39eb64326f0f..cab02d0a15d60d1c1bfe6e16157b386c0fb6b062 100644 (file)
@@ -420,6 +420,9 @@ int __init mx6q_clocks_init(void)
        clk_register_clkdev(clk[dummy], NULL, "20bc000.wdog");
        clk_register_clkdev(clk[dummy], NULL, "20c0000.wdog");
        clk_register_clkdev(clk[ssi1_ipg], NULL, "2028000.ssi");
+       clk_register_clkdev(clk[cko1_sel], "cko1_sel", NULL);
+       clk_register_clkdev(clk[ahb], "ahb", NULL);
+       clk_register_clkdev(clk[cko1], "cko1", NULL);
 
        for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) {
                c = clk_get_sys(clks_init_on[i], NULL);
index e0cc3dac3becc723088450963bb2253252d16abf..095c5c5de7bc02082a8e881e28fcdbcc0c723dbf 100644 (file)
@@ -10,6 +10,8 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
+#include <linux/clk.h>
+#include <linux/clkdev.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/io.h>
@@ -77,11 +79,37 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
        return 0;
 }
 
+static void __init imx6q_sabrelite_cko1_setup(void)
+{
+       struct clk *cko1_sel, *ahb, *cko1;
+       unsigned long rate;
+
+       cko1_sel = clk_get_sys(NULL, "cko1_sel");
+       ahb = clk_get_sys(NULL, "ahb");
+       cko1 = clk_get_sys(NULL, "cko1");
+       if (IS_ERR(cko1_sel) || IS_ERR(ahb) || IS_ERR(cko1)) {
+               pr_err("cko1 setup failed!\n");
+               goto put_clk;
+       }
+       clk_set_parent(cko1_sel, ahb);
+       rate = clk_round_rate(cko1, 16000000);
+       clk_set_rate(cko1, rate);
+       clk_register_clkdev(cko1, NULL, "0-000a");
+put_clk:
+       if (!IS_ERR(cko1_sel))
+               clk_put(cko1_sel);
+       if (!IS_ERR(ahb))
+               clk_put(ahb);
+       if (!IS_ERR(cko1))
+               clk_put(cko1);
+}
+
 static void __init imx6q_sabrelite_init(void)
 {
        if (IS_ENABLED(CONFIG_PHYLIB))
                phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
                                ksz9021rn_phy_fixup);
+       imx6q_sabrelite_cko1_setup();
 }
 
 static void __init imx6q_init_machine(void)