Lines Matching +full:osc +full:- +full:bypass

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2011-2013 Freescale Semiconductor, Inc.
12 #include <linux/clk-provider.h>
15 #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
20 #include <dt-bindings/clock/imx6qdl-clock.h>
24 static const char *step_sels[] = { "osc", "pll2_pfd2_396m", };
27 static const char *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", "dummy", };
60 static const char *uart_sels[] = { "pll3_80m", "osc", };
61 static const char *ipg_per_sels[] = { "ipg", "osc", };
62 static const char *ecspi_sels[] = { "pll3_60m", "osc", };
63 static const char *can_sels[] = { "pll3_60m", "osc", "pll3_80m", };
71 "ipu2", "vdo_axi", "osc", "gpu2d_core",
82 "dummy", "dummy", "dummy", "dummy", "osc",
84 static const char *pll_bypass_src_sels[] = { "osc", "lvds1_in", "lvds2_in", "dummy", };
154 return -ENOENT; in ldb_di_sel_by_clock_id()
165 return -ENOENT; in ldb_di_sel_by_clock_id()
177 num_parents = of_count_phandle_with_args(node, "assigned-clock-parents", in of_assigned_ldb_sels()
178 "#clock-cells"); in of_assigned_ldb_sels()
180 rc = of_parse_phandle_with_args(node, "assigned-clock-parents", in of_assigned_ldb_sels()
181 "#clock-cells", index, &clkspec); in of_assigned_ldb_sels()
184 if (rc == -ENOENT) in of_assigned_ldb_sels()
195 rc = of_parse_phandle_with_args(node, "assigned-clocks", in of_assigned_ldb_sels()
196 "#clock-cells", index, &clkspec); in of_assigned_ldb_sels()
228 num_clocks = of_count_phandle_with_args(node, "assigned-clocks", in pll6_bypassed()
229 "#clock-cells"); in pll6_bypassed()
234 ret = of_parse_phandle_with_args(node, "assigned-clocks", in pll6_bypassed()
235 "#clock-cells", index, in pll6_bypassed()
245 /* PLL6 bypass is not part of the assigned clock list */ in pll6_bypassed()
249 ret = of_parse_phandle_with_args(node, "assigned-clock-parents", in pll6_bypassed()
250 "#clock-cells", index, &clkspec); in pll6_bypassed()
269 * bypass clock source, since there is no CG bit for mmdc_ch1.
275 clk_set_parent(hws[IMX6QDL_CLK_PERIPH2_CLK2_SEL]->clk, in mmdc_ch1_disable()
276 hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); in mmdc_ch1_disable()
278 /* Disable pll3_sw_clk by selecting the bypass clock source */ in mmdc_ch1_disable()
288 /* Enable pll3_sw_clk by disabling the bypass */ in mmdc_ch1_reenable()
306 * to decide between the first and second 4-port mux:
308 * pll5_video_div 0 --|\
309 * pll2_pfd0_352m 1 --| |_
310 * pll2_pfd2_396m 2 --| | `-|\
311 * mmdc_ch1_axi 3 --|/ | |
312 * | |--
313 * pll3_usb_otg 4 --|\ | |
314 * 5 --| |_,-|/
315 * 6 --| |
316 * 7 --|/
318 * The ldb_di0/1_clk_sel[1:0] bits control both 4-port muxes at the same time.
319 * The ldb_di0/1_clk_sel[2] bit controls the 2-port mux. The code below
350 (clk_get_parent(hws[IMX6QDL_CLK_PERIPH_PRE]->clk) == in init_ldb_clks()
351 hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk)) { in init_ldb_clks()
364 pr_debug("ccm: switching ldb_di%d_sel: %d->%d->%d->%d\n", i, in init_ldb_clks()
400 /* Make sure PLL2 PFDs 0-2 are gated */ in disable_anatop_clocks()
403 if (clk_get_parent(hws[IMX6QDL_CLK_PERIPH_PRE]->clk) == in disable_anatop_clocks()
404 hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk) in disable_anatop_clocks()
410 /* Make sure PLL3 PFDs 0-3 are gated */ in disable_anatop_clocks()
447 clk_hw_data->num = IMX6QDL_CLK_END; in imx6q_clocks_init()
448 hws = clk_hw_data->hws; in imx6q_clocks_init()
454 hws[IMX6QDL_CLK_OSC] = imx6q_obtain_fixed_clk_hw(ccm_node, "osc", 0); in imx6q_clocks_init()
460 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); in imx6q_clocks_init()
482 hws[IMX6QDL_CLK_PLL1] = imx_clk_hw_pllv3(IMX_PLLV3_SYS, "pll1", "osc", base + 0x00, 0x7f); in imx6q_clocks_init()
483 hws[IMX6QDL_CLK_PLL2] = imx_clk_hw_pllv3(IMX_PLLV3_GENERIC, "pll2", "osc", base + 0x30, 0x1); in imx6q_clocks_init()
484 hws[IMX6QDL_CLK_PLL3] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll3", "osc", base + 0x10, 0x3); in imx6q_clocks_init()
485 hws[IMX6QDL_CLK_PLL4] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll4", "osc", base + 0x70, 0x7f); in imx6q_clocks_init()
486 hws[IMX6QDL_CLK_PLL5] = imx_clk_hw_pllv3(IMX_PLLV3_AV, "pll5", "osc", base + 0xa0, 0x7f); in imx6q_clocks_init()
487 hws[IMX6QDL_CLK_PLL6] = imx_clk_hw_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3); in imx6q_clocks_init()
488 hws[IMX6QDL_CLK_PLL7] = imx_clk_hw_pllv3(IMX_PLLV3_USB, "pll7", "osc", base + 0x20, 0x3); in imx6q_clocks_init()
498 /* Do not bypass PLLs initially */ in imx6q_clocks_init()
499 clk_set_parent(hws[IMX6QDL_PLL1_BYPASS]->clk, hws[IMX6QDL_CLK_PLL1]->clk); in imx6q_clocks_init()
500 clk_set_parent(hws[IMX6QDL_PLL2_BYPASS]->clk, hws[IMX6QDL_CLK_PLL2]->clk); in imx6q_clocks_init()
501 clk_set_parent(hws[IMX6QDL_PLL3_BYPASS]->clk, hws[IMX6QDL_CLK_PLL3]->clk); in imx6q_clocks_init()
502 clk_set_parent(hws[IMX6QDL_PLL4_BYPASS]->clk, hws[IMX6QDL_CLK_PLL4]->clk); in imx6q_clocks_init()
503 clk_set_parent(hws[IMX6QDL_PLL5_BYPASS]->clk, hws[IMX6QDL_CLK_PLL5]->clk); in imx6q_clocks_init()
504 clk_set_parent(hws[IMX6QDL_PLL6_BYPASS]->clk, hws[IMX6QDL_CLK_PLL6]->clk); in imx6q_clocks_init()
505 clk_set_parent(hws[IMX6QDL_PLL7_BYPASS]->clk, hws[IMX6QDL_CLK_PLL7]->clk); in imx6q_clocks_init()
516 * Bit 20 is the reserved and read-only bit, we do this only for: in imx6q_clocks_init()
517 * - Do nothing for usbphy clk_enable/disable in imx6q_clocks_init()
518 * - Keep refcount when do usbphy clk_enable/disable, in that case, in imx6q_clocks_init()
533 * different post-dividers that are all affected by the single bypass in imx6q_clocks_init()
536 * dynamically changing the bypass bit, will yield unexpected results. in imx6q_clocks_init()
538 * essentially static with the divider ratios reflecting the bypass in imx6q_clocks_init()
561 * lvds1_gate and lvds2_gate are pseudo-gates. Both can be in imx6q_clocks_init()
591 hws[IMX6QDL_CLK_GPT_3M] = imx_clk_hw_fixed_factor("gpt_3m", "osc", 1, 8); in imx6q_clocks_init()
653 * The LDB_DI0/1_SEL muxes are registered read-only due to a hardware in imx6q_clocks_init()
918 hws[IMX6QDL_CLK_ENET_REF_SEL] = imx_clk_gpr_mux("enet_ref_sel", "fsl,imx6q-iomuxc-gpr", in imx6q_clocks_init()
928 clk_set_rate(hws[IMX6QDL_CLK_PLL3_PFD1_540M]->clk, 540000000); in imx6q_clocks_init()
930 clk_set_parent(hws[IMX6QDL_CLK_IPU1_SEL]->clk, hws[IMX6QDL_CLK_PLL3_PFD1_540M]->clk); in imx6q_clocks_init()
932 clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI0_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); in imx6q_clocks_init()
933 clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI1_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); in imx6q_clocks_init()
934 clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI0_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); in imx6q_clocks_init()
935 clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI1_PRE_SEL]->clk, hws[IMX6QDL_CLK_PLL5_VIDEO_DIV]->clk); in imx6q_clocks_init()
936 clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI0_SEL]->clk, hws[IMX6QDL_CLK_IPU1_DI0_PRE]->clk); in imx6q_clocks_init()
937 clk_set_parent(hws[IMX6QDL_CLK_IPU1_DI1_SEL]->clk, hws[IMX6QDL_CLK_IPU1_DI1_PRE]->clk); in imx6q_clocks_init()
938 clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI0_SEL]->clk, hws[IMX6QDL_CLK_IPU2_DI0_PRE]->clk); in imx6q_clocks_init()
939 clk_set_parent(hws[IMX6QDL_CLK_IPU2_DI1_SEL]->clk, hws[IMX6QDL_CLK_IPU2_DI1_PRE]->clk); in imx6q_clocks_init()
946 clk_set_parent(hws[IMX6QDL_CLK_ENFC_SEL]->clk, hws[IMX6QDL_CLK_PLL2_PFD2_396M]->clk); in imx6q_clocks_init()
949 clk_prepare_enable(hws[IMX6QDL_CLK_USBPHY1_GATE]->clk); in imx6q_clocks_init()
950 clk_prepare_enable(hws[IMX6QDL_CLK_USBPHY2_GATE]->clk); in imx6q_clocks_init()
957 ret = clk_set_parent(hws[IMX6QDL_CLK_CKO2_SEL]->clk, hws[IMX6QDL_CLK_OSC]->clk); in imx6q_clocks_init()
959 ret = clk_set_parent(hws[IMX6QDL_CLK_CKO]->clk, hws[IMX6QDL_CLK_CKO2]->clk); in imx6q_clocks_init()
963 /* Audio-related clocks configuration */ in imx6q_clocks_init()
964 clk_set_parent(hws[IMX6QDL_CLK_SPDIF_SEL]->clk, hws[IMX6QDL_CLK_PLL3_PFD3_454M]->clk); in imx6q_clocks_init()
968 clk_set_parent(hws[IMX6QDL_CLK_LVDS1_SEL]->clk, hws[IMX6QDL_CLK_SATA_REF_100M]->clk); in imx6q_clocks_init()
975 clk_set_parent(hws[IMX6QDL_CLK_GPU3D_CORE_SEL]->clk, in imx6q_clocks_init()
976 hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); in imx6q_clocks_init()
977 clk_set_parent(hws[IMX6QDL_CLK_GPU2D_CORE_SEL]->clk, in imx6q_clocks_init()
978 hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); in imx6q_clocks_init()
980 clk_set_parent(hws[IMX6QDL_CLK_GPU3D_CORE_SEL]->clk, in imx6q_clocks_init()
981 hws[IMX6QDL_CLK_MMDC_CH0_AXI]->clk); in imx6q_clocks_init()
982 clk_set_parent(hws[IMX6QDL_CLK_GPU3D_SHADER_SEL]->clk, in imx6q_clocks_init()
983 hws[IMX6QDL_CLK_PLL2_PFD1_594M]->clk); in imx6q_clocks_init()
984 clk_set_parent(hws[IMX6QDL_CLK_GPU2D_CORE_SEL]->clk, in imx6q_clocks_init()
985 hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); in imx6q_clocks_init()
988 clk_set_parent(hws[IMX6QDL_CLK_ENET_REF_SEL]->clk, hws[IMX6QDL_CLK_ENET_REF]->clk); in imx6q_clocks_init()
992 CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);