From: Sven Van Asbroeck <thesven73@gmail.com>
To: shawnguo@kernel.org, fugang.duan@nxp.com, robh+dt@kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, devicetree@vger.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>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v5 3/3] ARM: imx6plus: optionally enable internal routing of clk_enet_ref
Date: Thu, 2 Jul 2020 13:53:52 -0400 [thread overview]
Message-ID: <20200702175352.19223-3-TheSven73@gmail.com> (raw)
In-Reply-To: <20200702175352.19223-1-TheSven73@gmail.com>
On imx6, the ethernet reference clock (clk_enet_ref) can be generated
by either the imx6, or an external source (e.g. an oscillator or the
PHY). When generated by the imx6, the clock source (from ANATOP)
must be routed to the input of clk_enet_ref via two pads on the SoC,
typically via a dedicated track on the PCB.
On an imx6 plus however, there is a new setting which enables this
clock to be routed internally on the SoC, from its ANATOP clock
source, straight to clk_enet_ref, without having to go through
the SoC pads.
Enable internal routing if the fsl,ptpclk-bypass-pad boolean
property is present in the "fsl,imx6q-fec" devicetree node.
Link: https://lore.kernel.org/lkml/CAOMZO5BYC3DmE_G0XRwRH9vSJiVVvKbtznODyntsAuorF=HoqA@mail.gmail.com/
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
---
Tree: v5.8-rc3
v4 -> v5:
- identified that existing imx6q-plus boards could break ethernet if v4
patch is applied.
reached consensus: prevent breakage by requiring an explicit devicetree
property for internal ptp clk routing.
Link: https://lore.kernel.org/lkml/CAOMZO5BYC3DmE_G0XRwRH9vSJiVVvKbtznODyntsAuorF=HoqA@mail.gmail.com/
v3 -> v4:
- avoid double-check for IS_ERR(gpr) by including Fabio Estevam's
patch.
v2 -> v3:
- remove check for imx6q, which is already implied when
of_machine_is_compatible("fsl,imx6qp")
v1 -> v2:
- Fabio Estevam: use of_machine_is_compatible() to determine if we
are running on an imx6 plus.
To: Shawn Guo <shawnguo@kernel.org>
To: Andy Duan <fugang.duan@nxp.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
arch/arm/mach-imx/mach-imx6q.c | 14 ++++++++++++++
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 3 +++
2 files changed, 17 insertions(+)
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index ae89ad93ca83..ac62994eb7ba 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -204,6 +204,20 @@ static void __init imx6q_1588_init(void)
regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_ENET_CLK_SEL_MASK,
clksel);
+ /*
+ * On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to
+ * be the PTP clock source, instead of having to be routed through
+ * pads.
+ */
+ if (of_machine_is_compatible("fsl,imx6qp")) {
+ clksel = of_property_read_bool(np, "fsl,ptpclk-bypass-pad") ?
+ IMX6Q_GPR5_ENET_TXCLK_SEL_PLL :
+ IMX6Q_GPR5_ENET_TXCLK_SEL_PAD;
+ regmap_update_bits(gpr, IOMUXC_GPR5,
+ IMX6Q_GPR5_ENET_TXCLK_SEL_MASK, clksel);
+ }
+
+
clk_put(enet_ref);
put_ptp_clk:
clk_put(ptp_clk);
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index d4b5e527a7a3..58377002427f 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -240,6 +240,9 @@
#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)
#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
+#define IMX6Q_GPR5_ENET_TXCLK_SEL_MASK BIT(9)
+#define IMX6Q_GPR5_ENET_TXCLK_SEL_PAD 0
+#define IMX6Q_GPR5_ENET_TXCLK_SEL_PLL BIT(9)
#define IMX6Q_GPR5_SATA_SW_PD BIT(10)
#define IMX6Q_GPR5_SATA_SW_RST BIT(11)
--
2.17.1
next prev parent reply other threads:[~2020-07-02 17:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 17:53 [PATCH v5 1/3] ARM: imx: mach-imx6q: Search for fsl,imx6q-iomuxc-gpr earlier Sven Van Asbroeck
2020-07-02 17:53 ` [PATCH v5 2/3] dt-bindings: fec: add fsl,ptpclk-bypass-pad boolean property Sven Van Asbroeck
2020-07-02 17:53 ` Sven Van Asbroeck [this message]
2020-07-02 22:29 ` [PATCH v5 3/3] ARM: imx6plus: optionally enable internal routing of clk_enet_ref Fabio Estevam
2020-07-03 0:50 ` Sven Van Asbroeck
2020-07-03 2:01 ` [EXT] " Andy Duan
2020-07-04 14:08 ` Sven Van Asbroeck
2020-07-05 14:45 ` [EXT] " Andy Duan
2020-07-05 15:34 ` Sven Van Asbroeck
2020-07-06 5:30 ` Andy Duan
2020-07-06 13:46 ` Fabio Estevam
2020-07-06 14:58 ` Sven Van Asbroeck
2020-07-06 14:59 ` Sven Van Asbroeck
2020-07-07 3:38 ` Andy Duan
2020-07-07 15:21 ` Sven Van Asbroeck
2020-07-08 5:16 ` Andy Duan
2020-07-06 14:53 ` Sven Van Asbroeck
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=20200702175352.19223-3-TheSven73@gmail.com \
--to=thesven73@gmail.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=fugang.duan@nxp.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.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;
as well as URLs for NNTP newsgroup(s).