]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: imx6q: remove board specific CLKO setup
authorShawn Guo <shawn.guo@linaro.org>
Thu, 18 Jul 2013 06:42:28 +0000 (14:42 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Thu, 22 Aug 2013 15:29:34 +0000 (23:29 +0800)
The CLKO is widely used by imx6q board designs to clock audio codec.
Since most codecs accept 24 MHz frequency, let's initially set up CLKO
with OSC24M (cko <-- cko2 <-- osc).  Then those board specific CLKO
setup for audio codec can be removed.

The board dts files also need an update on cko reference in codec node.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/boot/dts/imx6q-sabrelite.dts
arch/arm/boot/dts/imx6qdl-sabresd.dtsi
arch/arm/boot/dts/imx6qdl-wandboard.dtsi
arch/arm/mach-imx/clk-imx6q.c
arch/arm/mach-imx/mach-imx6q.c

index e0f4cd041c7018f3ad68bebdf461652953d2b8d6..3530280f5150e43d826987ab225e4b53930b33aa 100644 (file)
        codec: sgtl5000@0a {
                compatible = "fsl,sgtl5000";
                reg = <0x0a>;
-               clocks = <&clks 169>;
+               clocks = <&clks 201>;
                VDDA-supply = <&reg_2p5v>;
                VDDIO-supply = <&reg_3p3v>;
        };
index 166b9aead12d39c22d35d15e5c23423f0e8c95bc..75b36b2aed618e99af54e4b078290a707627b4c9 100644 (file)
        codec: wm8962@1a {
                compatible = "wlf,wm8962";
                reg = <0x1a>;
-               clocks = <&clks 169>;
+               clocks = <&clks 201>;
                DCVDD-supply = <&reg_audio>;
                DBVDD-supply = <&reg_audio>;
                AVDD-supply = <&reg_audio>;
index 7a46f64eccb553aa7228b0f095cf9f61baa28041..77188cbf047a2d2087649e97785348398fef3686 100644 (file)
@@ -60,7 +60,7 @@
        codec: sgtl5000@0a {
                compatible = "fsl,sgtl5000";
                reg = <0x0a>;
-               clocks = <&clks 169>;
+               clocks = <&clks 201>;
                VDDA-supply = <&reg_2p5v>;
                VDDIO-supply = <&reg_3p3v>;
        };
index bbafa3ccacb567e075adcf9da3eed24f68b3e75a..9181a241d3a8e543c41a2433b38cbfa6b774de02 100644 (file)
@@ -288,6 +288,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
        struct device_node *np;
        void __iomem *base;
        int i, irq;
+       int ret;
 
        clk[dummy] = imx_clk_fixed("dummy", 0);
        clk[ckil] = imx_obtain_fixed_clock("ckil", 0);
@@ -592,6 +593,16 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
                clk_prepare_enable(clk[usbphy2_gate]);
        }
 
+       /*
+        * Let's initially set up CLKO with OSC24M, since this configuration
+        * is widely used by imx6q board designs to clock audio codec.
+        */
+       ret = clk_set_parent(clk[cko2_sel], clk[osc]);
+       if (!ret)
+               ret = clk_set_parent(clk[cko], clk[cko2]);
+       if (ret)
+               pr_warn("failed to set up CLKO: %d\n", ret);
+
        /* Set initial power mode */
        imx6q_set_lpm(WAIT_CLOCKED);
 
index 1e093abe7b956ff2abffa9fb2f1caa6ce1ad4785..b60509831d673fd5e1521baddaa156dd650080ad 100644 (file)
@@ -162,30 +162,6 @@ static int ar8031_phy_fixup(struct phy_device *dev)
        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);
-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);
-}
-
 #define PHY_ID_AR8031  0x004dd074
 
 static void __init imx6q_enet_phy_init(void)
@@ -200,45 +176,6 @@ static void __init imx6q_enet_phy_init(void)
        }
 }
 
-static void __init imx6q_sabresd_cko1_setup(void)
-{
-       struct clk *cko1_sel, *pll4, *pll4_post, *cko1;
-       unsigned long rate;
-
-       cko1_sel = clk_get_sys(NULL, "cko1_sel");
-       pll4 = clk_get_sys(NULL, "pll4_audio");
-       pll4_post = clk_get_sys(NULL, "pll4_post_div");
-       cko1 = clk_get_sys(NULL, "cko1");
-       if (IS_ERR(cko1_sel) || IS_ERR(pll4)
-                       || IS_ERR(pll4_post) || IS_ERR(cko1)) {
-               pr_err("cko1 setup failed!\n");
-               goto put_clk;
-       }
-       /*
-        * Setting pll4 at 768MHz (24MHz * 32)
-        * So its child clock can get 24MHz easily
-        */
-       clk_set_rate(pll4, 768000000);
-
-       clk_set_parent(cko1_sel, pll4_post);
-       rate = clk_round_rate(cko1, 24000000);
-       clk_set_rate(cko1, rate);
-put_clk:
-       if (!IS_ERR(cko1_sel))
-               clk_put(cko1_sel);
-       if (!IS_ERR(pll4_post))
-               clk_put(pll4_post);
-       if (!IS_ERR(pll4))
-               clk_put(pll4);
-       if (!IS_ERR(cko1))
-               clk_put(cko1);
-}
-
-static void __init imx6q_sabresd_init(void)
-{
-       imx6q_sabresd_cko1_setup();
-}
-
 static void __init imx6q_1588_init(void)
 {
        struct regmap *gpr;
@@ -255,12 +192,6 @@ static void __init imx6q_1588_init(void)
 
 static void __init imx6q_init_machine(void)
 {
-       if (of_machine_is_compatible("fsl,imx6q-sabrelite"))
-               imx6q_sabrelite_cko1_setup();
-       else if (of_machine_is_compatible("fsl,imx6q-sabresd") ||
-                       of_machine_is_compatible("fsl,imx6dl-sabresd"))
-               imx6q_sabresd_init();
-
        imx6q_enet_phy_init();
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);