mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Florijan Plohl <florijan.plohl@norik.com>
To: barebox@lists.infradead.org, s.hauer@pengutronix.de
Cc: upstream@lists.phytec.de
Subject: [PATCH] ARM: boards: phytec-som-imx6: Add KSZ9131 PHY support
Date: Fri, 16 Oct 2026 10:22:14 +0200	[thread overview]
Message-ID: <20261016082240.381141-1-florijan.plohl@norik.com> (raw)

The phyCORE-i.MX6 can be populated with a KSZ9131 instead of the
KSZ9031 PHY. The KSZ9131 driver reads its pad skews from the *-psec
device tree properties, which the KSZ9031 driver ignores, so add them
to the PHY node.

The KSZ9131 additionally needs the 2 ns RXC delay of its internal DLL,
but with the "rgmii" phy-mode the driver disables it. Changing the
phy-mode in the device tree is not an option as it would also change the
RGMII delays of the KSZ9031 and ADIN1300, so add a PHY fixup that
switches only the KSZ9131 to RGMII-RXID before its config_init runs.

Co-developed-by: Andrej Picej <andrej.picej@norik.com>
Signed-off-by: Andrej Picej <andrej.picej@norik.com>
Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
---
 arch/arm/boards/phytec-som-imx6/board.c      | 16 ++++++++++++++++
 arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi | 18 ++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c
index 031d11d816..a1ff4b2c3b 100644
--- a/arch/arm/boards/phytec-som-imx6/board.c
+++ b/arch/arm/boards/phytec-som-imx6/board.c
@@ -129,6 +129,19 @@ static int adin1300_phy_fixup(struct phy_device *phydev)
 	return 0;
 }
 
+static int ksz9131_phy_fixup(struct phy_device *phydev)
+{
+	/*
+	 * The KSZ9131 needs the 2 ns RXC delay of its internal DLL, but with
+	 * the "rgmii" phy-mode shared with the KSZ9031 and ADIN1300 the driver
+	 * disables it. Switch the KSZ9131 to RGMII-RXID before its
+	 * config_init runs, the pad skews are set from the device tree.
+	 */
+	phydev->interface = PHY_INTERFACE_MODE_RGMII_RXID;
+
+	return 0;
+}
+
 static int phycore_da9062_setup_buck_mode(void)
 {
 	struct i2c_adapter *adapter = NULL;
@@ -249,6 +262,9 @@ static int physom_imx6_probe(struct device *dev)
 	phy_register_fixup_for_uid(PHY_ID_ADIN1300, ADIN_PHY_ID_MASK,
 			adin1300_phy_fixup);
 
+	phy_register_fixup_for_uid(PHY_ID_KSZ9131, MICREL_PHY_ID_MASK,
+			ksz9131_phy_fixup);
+
 	switch (bootsource_get()) {
 	case BOOTSOURCE_MMC:
 		environment_path = basprintf("/chosen/environment-sd%d",
diff --git a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi
index 7199c416c8..7b70f885bb 100644
--- a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi
+++ b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi
@@ -38,6 +38,24 @@ environment-spinor {
 
 /delete-node/ &{/memory@10000000};
 
+&ethphy {
+	/*
+	 * Pad skews for the KSZ9131, which can be populated instead of the
+	 * KSZ9031. Only the KSZ9131 driver evaluates the *-psec properties.
+	 */
+	txen-skew-psec = <(-600)>;
+	txc-skew-psec = <2400>;
+	txd0-skew-psec = <(-600)>;
+	txd1-skew-psec = <(-600)>;
+	txd2-skew-psec = <(-600)>;
+	txd3-skew-psec = <(-600)>;
+	rxdv-skew-psec = <800>;
+	rxd0-skew-psec = <800>;
+	rxd1-skew-psec = <800>;
+	rxd2-skew-psec = <800>;
+	rxd3-skew-psec = <800>;
+};
+
 &fec {
 	/delete-property/ phy-supply;
 	phy-reset-duration = <10>; /* in msecs */

base-commit: b8b7f9eb319d642a52fc09114abb79245d8b963d
-- 
2.43.0




                 reply	other threads:[~2026-10-16  8:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261016082240.381141-1-florijan.plohl@norik.com \
    --to=florijan.plohl@norik.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=upstream@lists.phytec.de \
    /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