devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Abel Vesa <abelvesa@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	Abel Vesa <abel.vesa@linaro.org>,
	kernel@pengutronix.de, Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Russell King <linux@armlinux.org.uk>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-clk@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH v3 02/19] clk: imx6q: add ethernet refclock mux support
Date: Tue, 31 Jan 2023 09:46:25 +0100	[thread overview]
Message-ID: <20230131084642.709385-3-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20230131084642.709385-1-o.rempel@pengutronix.de>

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>
---
 drivers/clk/imx/clk-imx6q.c               | 13 +++++++++++++
 include/dt-bindings/clock/imx6qdl-clock.h |  4 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index da71e064531e..bf4c1d9c9928 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -12,6 +12,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -115,6 +116,10 @@ static struct clk_div_table video_div_table[] = {
 	{ /* sentinel */ }
 };
 
+static const char * enet_ref_sels[] = { "enet_ref", "enet_ref_pad", };
+static const u32 enet_ref_sels_table[] = { IMX6Q_GPR1_ENET_CLK_SEL_ANATOP, IMX6Q_GPR1_ENET_CLK_SEL_PAD };
+static const u32 enet_ref_sels_table_mask = IMX6Q_GPR1_ENET_CLK_SEL_ANATOP;
+
 static unsigned int share_count_esai;
 static unsigned int share_count_asrc;
 static unsigned int share_count_ssi1;
@@ -908,6 +913,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
 	if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0)
 		hws[IMX6QDL_CLK_GPT_3M] = hws[IMX6QDL_CLK_GPT_IPG_PER];
 
+	hws[IMX6QDL_CLK_ENET_REF_PAD] = imx6q_obtain_fixed_clk_hw(ccm_node, "enet_ref_pad", 0);
+
+	hws[IMX6QDL_CLK_ENET_REF_SEL] = imx_clk_gpr_mux("enet_ref_sel", "fsl,imx6q-iomuxc-gpr",
+				IOMUXC_GPR1, enet_ref_sels, ARRAY_SIZE(enet_ref_sels),
+				enet_ref_sels_table, enet_ref_sels_table_mask);
+
 	imx_check_clk_hws(hws, IMX6QDL_CLK_END);
 
 	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)
 			       hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk);
 	}
 
+	clk_set_parent(hws[IMX6QDL_CLK_ENET_REF_SEL]->clk, hws[IMX6QDL_CLK_ENET_REF]->clk);
+
 	imx_register_uart_clocks();
 }
 CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
diff --git a/include/dt-bindings/clock/imx6qdl-clock.h b/include/dt-bindings/clock/imx6qdl-clock.h
index e20c43cc36f6..e5b2a1ba02bc 100644
--- a/include/dt-bindings/clock/imx6qdl-clock.h
+++ b/include/dt-bindings/clock/imx6qdl-clock.h
@@ -273,6 +273,8 @@
 #define IMX6QDL_CLK_MMDC_P0_IPG			263
 #define IMX6QDL_CLK_DCIC1			264
 #define IMX6QDL_CLK_DCIC2			265
-#define IMX6QDL_CLK_END				266
+#define IMX6QDL_CLK_ENET_REF_SEL		266
+#define IMX6QDL_CLK_ENET_REF_PAD		267
+#define IMX6QDL_CLK_END				268
 
 #endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */
-- 
2.30.2


  parent reply	other threads:[~2023-01-31  8:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31  8:46 [PATCH v3 00/19] ARM: imx: make Ethernet refclock configurable Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 01/19] clk: imx: add clk-gpr-mux driver Oleksij Rempel
2023-01-31  8:46 ` Oleksij Rempel [this message]
2023-01-31  8:46 ` [PATCH v3 03/19] ARM: imx6q: skip ethernet refclock reconfiguration if enet_clk_ref is present Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 04/19] ARM: dts: imx6qdl: use enet_clk_ref instead of enet_out for the FEC node Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 05/19] ARM: dts: imx6dl-lanmcu: configure ethernet reference clock parent Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 06/19] ARM: dts: imx6dl-alti6p: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 07/19] ARM: dts: imx6dl-plybas: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 08/19] ARM: dts: imx6dl-plym2m: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 09/19] ARM: dts: imx6dl-prtmvt: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 10/19] ARM: dts: imx6dl-victgo: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 11/19] ARM: dts: imx6q-prtwd2: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 12/19] ARM: dts: imx6qdl-skov-cpu: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 13/19] ARM: dts: imx6dl-eckelmann-ci4x10: " Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 14/19] clk: imx: add imx_obtain_fixed_of_clock() Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 15/19] clk: imx6ul: fix enet1 gate configuration Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 16/19] clk: imx6ul: add ethernet refclock mux support Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 17/19] ARM: dts: imx6ul: set enet_clk_ref to CLK_ENETx_REF_SEL Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 18/19] ARM: mach-imx: imx6ul: remove not optional ethernet refclock overwrite Oleksij Rempel
2023-01-31  8:46 ` [PATCH v3 19/19] ARM: dts: imx6ul-prti6g: configure ethernet reference clock parent Oleksij Rempel
2023-01-31 12:51 ` [PATCH v3 00/19] ARM: imx: make Ethernet refclock configurable Abel Vesa
2023-03-06  2:02 ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131084642.709385-3-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=abel.vesa@linaro.org \
    --cc=abelvesa@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).