aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolin Chen <Guangyu.Chen@freescale.com>2014-04-22 03:10:32 -0400
committerNicolin Chen <Guangyu.Chen@freescale.com>2014-04-23 04:45:01 -0400
commitb50eb55b1eb35e8e568ab777dc794370f20464eb (patch)
treec09f51658b1852a9d03e0fc9255278c7b300c5ef
parent4d1ec7cfc28cdea7f12967d778066a73c506f778 (diff)
ENGR00309977-1 ARM: imx6sx: Separate SPDIF and Audio clocks
Shawn's patch -- ARM: imx: shared gate support for i.MX clk_gate2 clocko has fixed the problem of clock conflicts due to sharing a same gate. So from now on, we can no longer need to take care the shared gate clock for each audio clock route. Thus this patch separates them by using the new clock registering helper function. And meanwhile, we set a proper rate for each route so as to support each module. For S/PDIF, we use 98304000Hz so that the current driver would perfectly get 32000Hz and 48000Hz sample rate playback support, even though we can only get 43885Hz for 44100Hz sample rate in this way -- If user want to playback 44100Hz group sample rates, they need to change the parent rate. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
index 6a5a8b543c23..e8b9a973b502 100644
--- a/arch/arm/mach-imx/clk-imx6sx.c
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -115,6 +115,9 @@ static struct clk_div_table video_div_table[] = {
115 { } 115 { }
116}; 116};
117 117
118static u32 share_count_asrc;
119static u32 share_count_audio;
120
118static void __init imx6sx_clocks_init(struct device_node *ccm_node) 121static void __init imx6sx_clocks_init(struct device_node *ccm_node)
119{ 122{
120 struct device_node *np; 123 struct device_node *np;
@@ -319,9 +322,8 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
319 clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1", "ahb", base + 0x68, 0); 322 clks[IMX6SX_CLK_AIPS_TZ1] = imx_clk_gate2("aips_tz1", "ahb", base + 0x68, 0);
320 clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2", "ahb", base + 0x68, 2); 323 clks[IMX6SX_CLK_AIPS_TZ2] = imx_clk_gate2("aips_tz2", "ahb", base + 0x68, 2);
321 clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4); 324 clks[IMX6SX_CLK_APBH_DMA] = imx_clk_gate2("apbh_dma", "usdhc3", base + 0x68, 4);
322 clks[IMX6SX_CLK_ASRC_GATE] = imx_clk_gate2("asrc_gate", "ahb", base + 0x68, 6); 325 clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_gate2_shared("asrc_mem", "ahb", base + 0x68, 6, &share_count_asrc);
323 clks[IMX6SX_CLK_ASRC_MEM] = imx_clk_fixed_factor("asrc_mem", "asrc_gate", 1, 1); 326 clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_gate2_shared("asrc_ipg", "ahb", base + 0x68, 6, &share_count_asrc);
324 clks[IMX6SX_CLK_ASRC_IPG] = imx_clk_fixed_factor("asrc_ipg", "asrc_gate", 1, 1);
325 clks[IMX6SX_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8); 327 clks[IMX6SX_CLK_CAAM_MEM] = imx_clk_gate2("caam_mem", "ahb", base + 0x68, 8);
326 clks[IMX6SX_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10); 328 clks[IMX6SX_CLK_CAAM_ACLK] = imx_clk_gate2("caam_aclk", "ahb", base + 0x68, 10);
327 clks[IMX6SX_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12); 329 clks[IMX6SX_CLK_CAAM_IPG] = imx_clk_gate2("caam_ipg", "ipg", base + 0x68, 12);
@@ -394,9 +396,8 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
394 clks[IMX6SX_CLK_ROM] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); 396 clks[IMX6SX_CLK_ROM] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0);
395 clks[IMX6SX_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); 397 clks[IMX6SX_CLK_SDMA] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6);
396 clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); 398 clks[IMX6SX_CLK_SPBA] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12);
397 clks[IMX6SX_CLK_AUDIO_GATE] = imx_clk_gate2("audio_gate", "audio_podf", base + 0x7c, 14); 399 clks[IMX6SX_CLK_AUDIO] = imx_clk_gate2_shared("audio", "audio_podf", base + 0x7c, 14, &share_count_audio);
398 clks[IMX6SX_CLK_AUDIO] = imx_clk_fixed_factor("audio", "audio_gate", 1, 1); 400 clks[IMX6SX_CLK_SPDIF] = imx_clk_gate2_shared("spdif", "spdif_podf", base + 0x7c, 14, &share_count_audio);
399 clks[IMX6SX_CLK_SPDIF] = imx_clk_fixed_factor("spdif", "audio_gate", 1, 1);
400 clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); 401 clks[IMX6SX_CLK_SSI1_IPG] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18);
401 clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20); 402 clks[IMX6SX_CLK_SSI2_IPG] = imx_clk_gate2("ssi2_ipg", "ipg", base + 0x7c, 20);
402 clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22); 403 clks[IMX6SX_CLK_SSI3_IPG] = imx_clk_gate2("ssi3_ipg", "ipg", base + 0x7c, 22);
@@ -479,20 +480,11 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
479 /* Audio clocks */ 480 /* Audio clocks */
480 clk_set_rate(clks[IMX6SX_CLK_PLL4_AUDIO_DIV], 393216000); 481 clk_set_rate(clks[IMX6SX_CLK_PLL4_AUDIO_DIV], 393216000);
481 482
482 /* 483 clk_set_parent(clks[IMX6SX_CLK_SPDIF_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
483 * IMPORTANT: 484 clk_set_rate(clks[IMX6SX_CLK_SPDIF_PODF], 98304000);
484 * SPDIF and AUDIO clocks are sharing the same gate on i.MX6 Solo X 485
485 * while their rates and gates are being handled by separate drivers.
486 * To keep them safe, we here merge them into one clock and use one
487 * exact rate so there'd not be any conflict during usages of them.
488 *
489 * But this results a limitation that if using these two simultaneous,
490 * make sure to keep them identical as what the code does over here.
491 */
492 clk_set_parent(clks[IMX6SX_CLK_SPDIF_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]);
493 clk_set_parent(clks[IMX6SX_CLK_AUDIO_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]); 486 clk_set_parent(clks[IMX6SX_CLK_AUDIO_SEL], clks[IMX6SX_CLK_PLL3_USB_OTG]);
494 clk_set_rate(clks[IMX6SX_CLK_SPDIF_PODF], 48000000); 487 clk_set_rate(clks[IMX6SX_CLK_AUDIO_PODF], 24000000);
495 clk_set_rate(clks[IMX6SX_CLK_AUDIO_PODF], 48000000);
496 488
497 clk_set_parent(clks[IMX6SX_CLK_SSI1_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 489 clk_set_parent(clks[IMX6SX_CLK_SSI1_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);
498 clk_set_parent(clks[IMX6SX_CLK_SSI2_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]); 490 clk_set_parent(clks[IMX6SX_CLK_SSI2_SEL], clks[IMX6SX_CLK_PLL4_AUDIO_DIV]);