Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: imx6q: add ethernet refclock mux support

Add ethernet refclock mux support and set it to internal clock by
default. This configuration will not affect existing boards since
machine code currently overwrites this default.

The machine code will be fixed in a separate patch.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230131084642.709385-3-o.rempel@pengutronix.de

authored by

Oleksij Rempel and committed by
Abel Vesa
8bb289bb ee394f63

+16 -1
+13
drivers/clk/imx/clk-imx6q.c
··· 12 12 #include <linux/clk-provider.h> 13 13 #include <linux/err.h> 14 14 #include <linux/io.h> 15 + #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 15 16 #include <linux/of.h> 16 17 #include <linux/of_address.h> 17 18 #include <linux/of_irq.h> ··· 115 114 { .val = 3, .div = 4, }, 116 115 { /* sentinel */ } 117 116 }; 117 + 118 + static const char * enet_ref_sels[] = { "enet_ref", "enet_ref_pad", }; 119 + static const u32 enet_ref_sels_table[] = { IMX6Q_GPR1_ENET_CLK_SEL_ANATOP, IMX6Q_GPR1_ENET_CLK_SEL_PAD }; 120 + static const u32 enet_ref_sels_table_mask = IMX6Q_GPR1_ENET_CLK_SEL_ANATOP; 118 121 119 122 static unsigned int share_count_esai; 120 123 static unsigned int share_count_asrc; ··· 913 908 if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0) 914 909 hws[IMX6QDL_CLK_GPT_3M] = hws[IMX6QDL_CLK_GPT_IPG_PER]; 915 910 911 + hws[IMX6QDL_CLK_ENET_REF_PAD] = imx6q_obtain_fixed_clk_hw(ccm_node, "enet_ref_pad", 0); 912 + 913 + hws[IMX6QDL_CLK_ENET_REF_SEL] = imx_clk_gpr_mux("enet_ref_sel", "fsl,imx6q-iomuxc-gpr", 914 + IOMUXC_GPR1, enet_ref_sels, ARRAY_SIZE(enet_ref_sels), 915 + enet_ref_sels_table, enet_ref_sels_table_mask); 916 + 916 917 imx_check_clk_hws(hws, IMX6QDL_CLK_END); 917 918 918 919 of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data); ··· 984 973 clk_set_parent(hws[IMX6QDL_CLK_GPU2D_CORE_SEL]->clk, 985 974 hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk); 986 975 } 976 + 977 + clk_set_parent(hws[IMX6QDL_CLK_ENET_REF_SEL]->clk, hws[IMX6QDL_CLK_ENET_REF]->clk); 987 978 988 979 imx_register_uart_clocks(); 989 980 }
+3 -1
include/dt-bindings/clock/imx6qdl-clock.h
··· 273 273 #define IMX6QDL_CLK_MMDC_P0_IPG 263 274 274 #define IMX6QDL_CLK_DCIC1 264 275 275 #define IMX6QDL_CLK_DCIC2 265 276 - #define IMX6QDL_CLK_END 266 276 + #define IMX6QDL_CLK_ENET_REF_SEL 266 277 + #define IMX6QDL_CLK_ENET_REF_PAD 267 278 + #define IMX6QDL_CLK_END 268 277 279 278 280 #endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */