diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2013-03-29 07:29:02 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-04-12 07:28:12 -0400 |
commit | 2df1d026edc11e88ad0a2216e79232737f5939e2 (patch) | |
tree | 3b17268e8625e4d364e6c03b337bd4162d376dac /arch/arm/mach-imx | |
parent | d19dacb732209ba25e2e1f912b74d9d64a608bb0 (diff) |
ARM i.MX6q: Add audio/video PLL post dividers for i.MX6q rev 1.1
Query silicon revision to determine clock tree and add post
dividers for newer revisions.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/clk-imx6q.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 47d0af1c4210..2b230f83170b 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "clk.h" | 24 | #include "clk.h" |
25 | #include "common.h" | 25 | #include "common.h" |
26 | #include "hardware.h" | ||
26 | 27 | ||
27 | #define CCR 0x0 | 28 | #define CCR 0x0 |
28 | #define BM_CCR_WB_COUNT (0x7 << 16) | 29 | #define BM_CCR_WB_COUNT (0x7 << 16) |
@@ -180,29 +181,29 @@ static const char *periph_clk2_sels[] = { "pll3_usb_otg", "osc", }; | |||
180 | static const char *periph_sels[] = { "periph_pre", "periph_clk2", }; | 181 | static const char *periph_sels[] = { "periph_pre", "periph_clk2", }; |
181 | static const char *periph2_sels[] = { "periph2_pre", "periph2_clk2", }; | 182 | static const char *periph2_sels[] = { "periph2_pre", "periph2_clk2", }; |
182 | static const char *axi_sels[] = { "periph", "pll2_pfd2_396m", "pll3_pfd1_540m", }; | 183 | static const char *axi_sels[] = { "periph", "pll2_pfd2_396m", "pll3_pfd1_540m", }; |
183 | static const char *audio_sels[] = { "pll4_audio", "pll3_pfd2_508m", "pll3_pfd3_454m", "pll3_usb_otg", }; | 184 | static const char *audio_sels[] = { "pll4_post_div", "pll3_pfd2_508m", "pll3_pfd3_454m", "pll3_usb_otg", }; |
184 | static const char *gpu_axi_sels[] = { "axi", "ahb", }; | 185 | static const char *gpu_axi_sels[] = { "axi", "ahb", }; |
185 | static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", }; | 186 | static const char *gpu2d_core_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd0_352m", "pll2_pfd2_396m", }; |
186 | static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", }; | 187 | static const char *gpu3d_core_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd2_396m", }; |
187 | static const char *gpu3d_shader_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd9_720m", }; | 188 | static const char *gpu3d_shader_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll2_pfd1_594m", "pll2_pfd9_720m", }; |
188 | static const char *ipu_sels[] = { "mmdc_ch0_axi", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", }; | 189 | static const char *ipu_sels[] = { "mmdc_ch0_axi", "pll2_pfd2_396m", "pll3_120m", "pll3_pfd1_540m", }; |
189 | static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "mmdc_ch1_axi", "pll3_usb_otg", }; | 190 | static const char *ldb_di_sels[] = { "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "mmdc_ch1_axi", "pll3_usb_otg", }; |
190 | static const char *ipu_di_pre_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll5_video", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", }; | 191 | static const char *ipu_di_pre_sels[] = { "mmdc_ch0_axi", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0_352m", "pll2_pfd2_396m", "pll3_pfd1_540m", }; |
191 | static const char *ipu1_di0_sels[] = { "ipu1_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; | 192 | static const char *ipu1_di0_sels[] = { "ipu1_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
192 | static const char *ipu1_di1_sels[] = { "ipu1_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; | 193 | static const char *ipu1_di1_sels[] = { "ipu1_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
193 | static const char *ipu2_di0_sels[] = { "ipu2_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; | 194 | static const char *ipu2_di0_sels[] = { "ipu2_di0_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
194 | static const char *ipu2_di1_sels[] = { "ipu2_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; | 195 | static const char *ipu2_di1_sels[] = { "ipu2_di1_pre", "dummy", "dummy", "ldb_di0", "ldb_di1", }; |
195 | static const char *hsi_tx_sels[] = { "pll3_120m", "pll2_pfd2_396m", }; | 196 | static const char *hsi_tx_sels[] = { "pll3_120m", "pll2_pfd2_396m", }; |
196 | static const char *pcie_axi_sels[] = { "axi", "ahb", }; | 197 | static const char *pcie_axi_sels[] = { "axi", "ahb", }; |
197 | static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll3_pfd3_454m", "pll4_audio", }; | 198 | static const char *ssi_sels[] = { "pll3_pfd2_508m", "pll3_pfd3_454m", "pll4_post_div", }; |
198 | static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", }; | 199 | static const char *usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", }; |
199 | static const char *enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", }; | 200 | static const char *enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg", "pll2_pfd2_396m", }; |
200 | static const char *emi_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd2_396m", "pll2_pfd0_352m", }; | 201 | static const char *emi_sels[] = { "axi", "pll3_usb_otg", "pll2_pfd2_396m", "pll2_pfd0_352m", }; |
201 | static const char *vdo_axi_sels[] = { "axi", "ahb", }; | 202 | static const char *vdo_axi_sels[] = { "axi", "ahb", }; |
202 | static const char *vpu_axi_sels[] = { "axi", "pll2_pfd2_396m", "pll2_pfd0_352m", }; | 203 | static const char *vpu_axi_sels[] = { "axi", "pll2_pfd2_396m", "pll2_pfd0_352m", }; |
203 | static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video", | 204 | static const char *cko1_sels[] = { "pll3_usb_otg", "pll2_bus", "pll1_sys", "pll5_video_div", |
204 | "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0", | 205 | "dummy", "axi", "enfc", "ipu1_di0", "ipu1_di1", "ipu2_di0", |
205 | "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_audio", }; | 206 | "ipu2_di1", "ahb", "ipg", "ipg_per", "ckil", "pll4_post_div", }; |
206 | 207 | ||
207 | enum mx6q_clks { | 208 | enum mx6q_clks { |
208 | dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, | 209 | dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, |
@@ -236,7 +237,7 @@ enum mx6q_clks { | |||
236 | pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg, | 237 | pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg, |
237 | ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5, | 238 | ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5, |
238 | sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate, | 239 | sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate, |
239 | usbphy2_gate, clk_max | 240 | usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, clk_max |
240 | }; | 241 | }; |
241 | 242 | ||
242 | static struct clk *clk[clk_max]; | 243 | static struct clk *clk[clk_max]; |
@@ -253,6 +254,21 @@ static struct clk_div_table clk_enet_ref_table[] = { | |||
253 | { .val = 3, .div = 4, }, | 254 | { .val = 3, .div = 4, }, |
254 | }; | 255 | }; |
255 | 256 | ||
257 | static struct clk_div_table post_div_table[] = { | ||
258 | { .val = 2, .div = 1, }, | ||
259 | { .val = 1, .div = 2, }, | ||
260 | { .val = 0, .div = 4, }, | ||
261 | { } | ||
262 | }; | ||
263 | |||
264 | static struct clk_div_table video_div_table[] = { | ||
265 | { .val = 0, .div = 1, }, | ||
266 | { .val = 1, .div = 2, }, | ||
267 | { .val = 2, .div = 1, }, | ||
268 | { .val = 3, .div = 4, }, | ||
269 | { } | ||
270 | }; | ||
271 | |||
256 | int __init mx6q_clocks_init(void) | 272 | int __init mx6q_clocks_init(void) |
257 | { | 273 | { |
258 | struct device_node *np; | 274 | struct device_node *np; |
@@ -279,6 +295,14 @@ int __init mx6q_clocks_init(void) | |||
279 | base = of_iomap(np, 0); | 295 | base = of_iomap(np, 0); |
280 | WARN_ON(!base); | 296 | WARN_ON(!base); |
281 | 297 | ||
298 | /* Audio/video PLL post dividers do not work on i.MX6q revision 1.0 */ | ||
299 | if (imx6q_revision() == IMX_CHIP_REVISION_1_0) { | ||
300 | post_div_table[1].div = 1; | ||
301 | post_div_table[2].div = 1; | ||
302 | video_div_table[1].div = 1; | ||
303 | video_div_table[2].div = 1; | ||
304 | }; | ||
305 | |||
282 | /* type name parent_name base div_mask */ | 306 | /* type name parent_name base div_mask */ |
283 | clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); | 307 | clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); |
284 | clk[pll2_bus] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); | 308 | clk[pll2_bus] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1); |
@@ -331,6 +355,10 @@ int __init mx6q_clocks_init(void) | |||
331 | clk[pll3_60m] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); | 355 | clk[pll3_60m] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8); |
332 | clk[twd] = imx_clk_fixed_factor("twd", "arm", 1, 2); | 356 | clk[twd] = imx_clk_fixed_factor("twd", "arm", 1, 2); |
333 | 357 | ||
358 | clk[pll4_post_div] = clk_register_divider_table(NULL, "pll4_post_div", "pll4_audio", CLK_SET_RATE_PARENT, base + 0x70, 19, 2, 0, post_div_table, &imx_ccm_lock); | ||
359 | clk[pll5_post_div] = clk_register_divider_table(NULL, "pll5_post_div", "pll5_video", CLK_SET_RATE_PARENT, base + 0xa0, 19, 2, 0, post_div_table, &imx_ccm_lock); | ||
360 | clk[pll5_video_div] = clk_register_divider_table(NULL, "pll5_video_div", "pll5_post_div", CLK_SET_RATE_PARENT, base + 0x170, 30, 2, 0, video_div_table, &imx_ccm_lock); | ||
361 | |||
334 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ccm"); | 362 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ccm"); |
335 | base = of_iomap(np, 0); | 363 | base = of_iomap(np, 0); |
336 | WARN_ON(!base); | 364 | WARN_ON(!base); |