Skip to content

Commit 8bb289b

Browse files
oleremabelvesa
authored andcommitted
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
1 parent ee394f6 commit 8bb289b

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/clk/imx/clk-imx6q.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/clk-provider.h>
1313
#include <linux/err.h>
1414
#include <linux/io.h>
15+
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
1516
#include <linux/of.h>
1617
#include <linux/of_address.h>
1718
#include <linux/of_irq.h>
@@ -115,6 +116,10 @@ static struct clk_div_table video_div_table[] = {
115116
{ /* sentinel */ }
116117
};
117118

119+
static const char * enet_ref_sels[] = { "enet_ref", "enet_ref_pad", };
120+
static const u32 enet_ref_sels_table[] = { IMX6Q_GPR1_ENET_CLK_SEL_ANATOP, IMX6Q_GPR1_ENET_CLK_SEL_PAD };
121+
static const u32 enet_ref_sels_table_mask = IMX6Q_GPR1_ENET_CLK_SEL_ANATOP;
122+
118123
static unsigned int share_count_esai;
119124
static unsigned int share_count_asrc;
120125
static unsigned int share_count_ssi1;
@@ -908,6 +913,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
908913
if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0)
909914
hws[IMX6QDL_CLK_GPT_3M] = hws[IMX6QDL_CLK_GPT_IPG_PER];
910915

916+
hws[IMX6QDL_CLK_ENET_REF_PAD] = imx6q_obtain_fixed_clk_hw(ccm_node, "enet_ref_pad", 0);
917+
918+
hws[IMX6QDL_CLK_ENET_REF_SEL] = imx_clk_gpr_mux("enet_ref_sel", "fsl,imx6q-iomuxc-gpr",
919+
IOMUXC_GPR1, enet_ref_sels, ARRAY_SIZE(enet_ref_sels),
920+
enet_ref_sels_table, enet_ref_sels_table_mask);
921+
911922
imx_check_clk_hws(hws, IMX6QDL_CLK_END);
912923

913924
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
@@ -974,6 +985,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
974985
hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk);
975986
}
976987

988+
clk_set_parent(hws[IMX6QDL_CLK_ENET_REF_SEL]->clk, hws[IMX6QDL_CLK_ENET_REF]->clk);
989+
977990
imx_register_uart_clocks();
978991
}
979992
CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);

include/dt-bindings/clock/imx6qdl-clock.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@
273273
#define IMX6QDL_CLK_MMDC_P0_IPG 263
274274
#define IMX6QDL_CLK_DCIC1 264
275275
#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
277279

278280
#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */

0 commit comments

Comments
 (0)