diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-02-18 20:54:25 +0800 |
---|---|---|
committer | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-02-19 18:50:12 +0800 |
commit | 4588363363f1c6e354a4047708049196639fe1a2 (patch) | |
tree | a2d91922d928967e7b861bb5c2b1fa7b8dcddc98 /arch | |
parent | 0d7ac3c74923d82d474280403e32d0a233e28ff5 (diff) |
ENGR00299756-3 ARM: imx6q: Add the clock route from external OSC to ESAI clock
This patch mainly adds the clock route from external 24.576MHz OSC to internal
ESAI clock via analog clock2 PADs on the SoC and pll4 so that ESAI can get an
entirely synchronous clock source against CS42888.
[ 1, We found if using pll4 to generate a 24.576MHz from inernal 24.0MHz OSC,
we would get noise during the audio playback via ESAI->CS42888 even though
this generated clock's rate is equal to the external one statistically. It
might be resulted from the tiny difference between two clock source, which
might be crucial to the sensitive CODEC we use -- CS42888. So we here apply
the old 3.0.35 way to feed ESAI the same clock source as CS42888.
2, Ideally, we should use bypass mode for pll4 since we only need to get
the raw rate (24.576MHz) while currently bypass mode in clk-pllv3.c isn't
entirely supported: The clock rate would be fixed to 24.0MHz if setting to
bypass, which would cause child clock get an incorrect rate and the driver
who uses the child clock fail to derive a needed clock rate, and it might
be dangerous to involve the clk-pllv3.c driver to this fix. Thus we here
apply 3.0.35 way provisionally. ]
Expected result:
anaclk2 0 1 24576000
lvds2_in 0 1 24576000
pll4_sel 0 1 24576000
pll4_audio 0 1 786432000
pll4_post_div 0 1 786432000
pll4_audio_div 0 1 786432000
esai_sel 0 1 786432000
esai_pred 0 1 98304000
esai_podf 0 1 24576000
esai 0 1 24576000
Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
(cherry picked from commit 49584be724d4d9c7a753d2b981b3932d8d871eb4)
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/clk-imx6q.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-imx6q.c | 26 |
3 files changed, 31 insertions, 4 deletions
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 95513cd10d4e..d9c3af9f58e9 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -30,7 +30,7 @@ }; clocks { - codec_osc: codec_osc { + codec_osc: anaclk2 { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <24576000>; diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 9bc6f6166b8e..59ec5fe965fb 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c @@ -484,8 +484,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) clk_register_clkdev(clk[ahb], "ahb", NULL); clk_register_clkdev(clk[cko1], "cko1", NULL); clk_register_clkdev(clk[arm], NULL, "cpu0"); - clk_register_clkdev(clk[pll4_post_div], "pll4_post_div", NULL); - clk_register_clkdev(clk[pll4_audio], "pll4_audio", NULL); + clk_register_clkdev(clk[pll4_audio_div], "pll4_audio_div", NULL); + clk_register_clkdev(clk[pll4_sel], "pll4_sel", NULL); + clk_register_clkdev(clk[lvds2_in], "lvds2_in", NULL); + clk_register_clkdev(clk[esai], "esai", NULL); if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) || cpu_is_imx6dl()) { clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]); @@ -558,6 +560,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) clk_set_parent(clk[ssi1_sel], clk[pll4_audio_div]); clk_set_parent(clk[ssi2_sel], clk[pll4_audio_div]); clk_set_parent(clk[ssi3_sel], clk[pll4_audio_div]); + clk_set_parent(clk[esai_sel], clk[pll4_audio_div]); clk_set_parent(clk[spdif_sel], clk[pll3_pfd3_454m]); clk_set_parent(clk[asrc_sel], clk[pll3_usb_otg]); clk_set_rate(clk[asrc_sel], 7500000); diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 8dbd402ec3b5..5fb11af5643d 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -398,6 +398,28 @@ put_node: of_node_put(np); } +#define ESAI_AUDIO_MCLK 24576000 + +static void __init imx6q_audio_lvds2_init(void) +{ + struct clk *pll4_sel, *lvds2_in, *pll4_audio_div, *esai; + + pll4_audio_div = clk_get_sys(NULL, "pll4_audio_div"); + pll4_sel = clk_get_sys(NULL, "pll4_sel"); + lvds2_in = clk_get_sys(NULL, "lvds2_in"); + esai = clk_get_sys(NULL, "esai"); + if (IS_ERR(pll4_audio_div) || IS_ERR(pll4_sel) || + IS_ERR(lvds2_in) || IS_ERR(esai)) + return; + + if (clk_get_rate(lvds2_in) != ESAI_AUDIO_MCLK) + return; + + clk_set_parent(pll4_sel, lvds2_in); + clk_set_rate(pll4_audio_div, 786432000); + clk_set_rate(esai, ESAI_AUDIO_MCLK); +} + static struct platform_device imx6q_cpufreq_pdev = { .name = "imx6-cpufreq", }; @@ -431,8 +453,10 @@ static void __init imx6q_init_late(void) } if (of_machine_is_compatible("fsl,imx6q-sabreauto") - || of_machine_is_compatible("fsl,imx6dl-sabreauto")) + || of_machine_is_compatible("fsl,imx6dl-sabreauto")) { imx6q_flexcan_fixup_auto(); + imx6q_audio_lvds2_init(); + } } static void __init imx6q_map_io(void) |