mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pieter Cardoen <p.cardoen@televic.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Pieter Cardoen <p.cardoen@televic.com>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Russell King <linux@armlinux.org.uk>,
	Robert Karszniewicz <r.karszniewicz@phytec.de>,
	Oleksij Rempel <linux@rempel-privat.de>,
	Stefan Riedmueller <s.riedmueller@phytec.de>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: imx: mach-imx6ul: added gpr enet<x>-tx-clock config
Date: Wed,  2 Jun 2021 10:11:07 +0200	[thread overview]
Message-ID: <1622621468-17013-1-git-send-email-p.cardoen@televic.com> (raw)

Allow enable/disable of IMX6UL_GPR1_ENET1_CLK_OUTPUT and
IMX6UL_GPR2_ENET_CLK_OUTPUT as it may not be enabled when
using a phy in RMII mode. Enabling this clock output in
RMII mode results in multiple drivers on a single line.

Configuration can be done using gpr device-tree handle by
including string options enet1-tx-clock and enet2-tx-clock.

Signed-off-by: Pieter Cardoen <p.cardoen@televic.com>
---
 arch/arm/boot/dts/imx6ul.dtsi   |  1 +
 arch/arm/mach-imx/mach-imx6ul.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index 7901494..f4dbde8 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -737,6 +737,7 @@
 				compatible = "fsl,imx6ul-iomuxc-gpr",
 					     "fsl,imx6q-iomuxc-gpr", "syscon";
 				reg = <0x020e4000 0x4000>;
+				enet1-tx-clock = "enable";
 			};
 
 			gpt2: timer@20e8000 {
diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c
index 35e8120..ea2fae8 100644
--- a/arch/arm/mach-imx/mach-imx6ul.c
+++ b/arch/arm/mach-imx/mach-imx6ul.c
@@ -19,11 +19,24 @@
 static void __init imx6ul_enet_clk_init(void)
 {
 	struct regmap *gpr;
+	unsigned int enet_clk_output = 0;
+	struct device_node *node = of_find_compatible_node(NULL, NULL, "fsl,imx6ul-iomuxc-gpr");
+	const char *enable;
+
+	if (node) {
+		if (!of_property_read_string(node, "enet1-tx-clock", &enable))
+			if (strcmp(enable, "enable") == 0)
+				enet_clk_output |= IMX6UL_GPR1_ENET_CLK_OUTPUT;
+
+		if (!of_property_read_string(node, "enet2-tx-clock", &enable))
+			if (strcmp(enable, "enable") == 0)
+				enet_clk_output |= IMX6UL_GPR1_ENET2_CLK_OUTPUT;
+	}
 
 	gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
 	if (!IS_ERR(gpr))
 		regmap_update_bits(gpr, IOMUXC_GPR1, IMX6UL_GPR1_ENET_CLK_DIR,
-				   IMX6UL_GPR1_ENET_CLK_OUTPUT);
+				   enet_clk_output);
 	else
 		pr_err("failed to find fsl,imx6ul-iomux-gpr regmap\n");
 }
-- 
2.7.4


             reply	other threads:[~2021-06-02  8:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02  8:11 Pieter Cardoen [this message]
2021-06-02 11:55 ` [PATCH] ARM: imx: mach-imx6ul: support ptp and rmii clock from pad Pieter Cardoen

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=1622621468-17013-1-git-send-email-p.cardoen@televic.com \
    --to=p.cardoen@televic.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rempel-privat.de \
    --cc=r.karszniewicz@phytec.de \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.riedmueller@phytec.de \
    --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

all inboxes | Powered by JetHome®