diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2013-05-17 09:49:03 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-06-17 03:45:13 -0400 |
commit | beb2d1c1ba8bcbb31cc15875f65bcff0b2f79f64 (patch) | |
tree | 634225fc19697759a30602756d130cd9988cc9ad | |
parent | c9a74f556987ff696da3050ad66595458ad649c6 (diff) |
ARM i.MX5: Add S/PDIF clocks
This patch adds the S/PDIF clocks for i.MX51 and i.MX53. Tested on i.MX53.
The i.MX51 has a second set of spdif_root clock dividers, and on i.MX53
there is an additional input to the spdif_xtal mux.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/clock/imx5-clock.txt | 12 | ||||
-rw-r--r-- | arch/arm/mach-imx/clk-imx51-imx53.c | 28 |
2 files changed, 39 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/clock/imx5-clock.txt b/Documentation/devicetree/bindings/clock/imx5-clock.txt index b66cf36952a9..f46f5625d8ad 100644 --- a/Documentation/devicetree/bindings/clock/imx5-clock.txt +++ b/Documentation/devicetree/bindings/clock/imx5-clock.txt | |||
@@ -185,6 +185,18 @@ clocks and IDs. | |||
185 | srtc_gate 171 | 185 | srtc_gate 171 |
186 | pata_gate 172 | 186 | pata_gate 172 |
187 | sata_gate 173 | 187 | sata_gate 173 |
188 | spdif_xtal_sel 174 | ||
189 | spdif0_sel 175 | ||
190 | spdif1_sel 176 | ||
191 | spdif0_pred 177 | ||
192 | spdif0_podf 178 | ||
193 | spdif1_pred 179 | ||
194 | spdif1_podf 180 | ||
195 | spdif0_com_sel 181 | ||
196 | spdif1_com_sel 182 | ||
197 | spdif0_gate 183 | ||
198 | spdif1_gate 184 | ||
199 | spdif_ipg_gate 185 | ||
188 | 200 | ||
189 | Examples (for mx53): | 201 | Examples (for mx53): |
190 | 202 | ||
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c index 7d1d66ed4093..04b1bad68350 100644 --- a/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/arch/arm/mach-imx/clk-imx51-imx53.c | |||
@@ -73,6 +73,12 @@ static const char *mx53_cko2_sel[] = { | |||
73 | "tve_sel", "lp_apm", | 73 | "tve_sel", "lp_apm", |
74 | "uart_root", "dummy"/* spdif0_clk_root */, | 74 | "uart_root", "dummy"/* spdif0_clk_root */, |
75 | "dummy", "dummy", }; | 75 | "dummy", "dummy", }; |
76 | static const char *mx51_spdif_xtal_sel[] = { "osc", "ckih", "ckih2", }; | ||
77 | static const char *mx53_spdif_xtal_sel[] = { "osc", "ckih", "ckih2", "pll4_sw", }; | ||
78 | static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_sel", }; | ||
79 | static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", }; | ||
80 | static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", }; | ||
81 | |||
76 | 82 | ||
77 | enum imx5_clks { | 83 | enum imx5_clks { |
78 | dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred, | 84 | dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred, |
@@ -110,7 +116,9 @@ enum imx5_clks { | |||
110 | owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate, | 116 | owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate, |
111 | cko1_sel, cko1_podf, cko1, | 117 | cko1_sel, cko1_podf, cko1, |
112 | cko2_sel, cko2_podf, cko2, | 118 | cko2_sel, cko2_podf, cko2, |
113 | srtc_gate, pata_gate, sata_gate, | 119 | srtc_gate, pata_gate, sata_gate, spdif_xtal_sel, spdif0_sel, |
120 | spdif1_sel, spdif0_pred, spdif0_podf, spdif1_pred, spdif1_podf, | ||
121 | spdif0_com_s, spdif1_com_sel, spdif0_gate, spdif1_gate, spdif_ipg_gate, | ||
114 | clk_max | 122 | clk_max |
115 | }; | 123 | }; |
116 | 124 | ||
@@ -269,6 +277,13 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, | |||
269 | clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22); | 277 | clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22); |
270 | clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28); | 278 | clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28); |
271 | clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0); | 279 | clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0); |
280 | clk[spdif0_sel] = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel)); | ||
281 | clk[spdif0_pred] = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3); | ||
282 | clk[spdif0_podf] = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6); | ||
283 | clk[spdif0_com_s] = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1, | ||
284 | spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT); | ||
285 | clk[spdif0_gate] = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26); | ||
286 | clk[spdif_ipg_gate] = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30); | ||
272 | 287 | ||
273 | for (i = 0; i < ARRAY_SIZE(clk); i++) | 288 | for (i = 0; i < ARRAY_SIZE(clk); i++) |
274 | if (IS_ERR(clk[i])) | 289 | if (IS_ERR(clk[i])) |
@@ -380,6 +395,15 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, | |||
380 | clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8); | 395 | clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8); |
381 | clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10); | 396 | clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10); |
382 | clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12); | 397 | clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12); |
398 | clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, | ||
399 | mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel)); | ||
400 | clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2, | ||
401 | spdif_sel, ARRAY_SIZE(spdif_sel)); | ||
402 | clk[spdif1_pred] = imx_clk_divider("spdif1_podf", "spdif1_sel", MXC_CCM_CDCDR, 16, 3); | ||
403 | clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6); | ||
404 | clk[spdif1_com_sel] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1, | ||
405 | mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel)); | ||
406 | clk[spdif1_gate] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28); | ||
383 | 407 | ||
384 | for (i = 0; i < ARRAY_SIZE(clk); i++) | 408 | for (i = 0; i < ARRAY_SIZE(clk); i++) |
385 | if (IS_ERR(clk[i])) | 409 | if (IS_ERR(clk[i])) |
@@ -498,6 +522,8 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc, | |||
498 | mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel)); | 522 | mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel)); |
499 | clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); | 523 | clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); |
500 | clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); | 524 | clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); |
525 | clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2, | ||
526 | mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel)); | ||
501 | 527 | ||
502 | for (i = 0; i < ARRAY_SIZE(clk); i++) | 528 | for (i = 0; i < ARRAY_SIZE(clk); i++) |
503 | if (IS_ERR(clk[i])) | 529 | if (IS_ERR(clk[i])) |