mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: boards: phytec-som-imx6: Add KSZ9131 PHY support
@ 2026-10-16  8:22 Florijan Plohl
  0 siblings, 0 replies; only message in thread
From: Florijan Plohl @ 2026-10-16  8:22 UTC (permalink / raw)
  To: barebox, s.hauer; +Cc: upstream

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-16  8:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  8:22 [PATCH] ARM: boards: phytec-som-imx6: Add KSZ9131 PHY support Florijan Plohl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox