summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Eichenberger <stefan.eichenberger@toradex.com>2026-01-20 23:30:03 +0300
committerJakub Kicinski <kuba@kernel.org>2026-01-23 05:27:32 +0300
commitfa1197a09496e6145e3d54a5ce60334a65595d48 (patch)
tree0d17a872349b0289e7054b6177f18357f157b6fa
parent2153e151c27cee16f5b33b882aa7ffe03bc7afc8 (diff)
downloadlinux-fa1197a09496e6145e3d54a5ce60334a65595d48.tar.xz
net: phy: micrel: add option to keep the preamble before sfd for KSZ9131
If the PHY_F_KEEP_PREAMBLE_BEFORE_SFD flag is set in the phy_device::dev_flags field, the preamble will be kept before the start frame delimiter (SFD) on the KSZ9131 PHY. This flag is not officially documented by Micrel. However, information provided by NXP and Micrel indicates that this flag ensures the PHY sends the full preamble instead of removing it. The full discussion can be found on the NXP forum: https://community.nxp.com/t5/i-MX-Processors/iMX8MP-eqos-not-working-for-10base-t/m-p/2151032 Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260120203905.23805-3-eichest@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/phy/micrel.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 225d4adf28be..b2a584b60bff 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -101,6 +101,14 @@
#define LAN8814_CABLE_DIAG_VCT_DATA_MASK GENMASK(7, 0)
#define LAN8814_PAIR_BIT_SHIFT 12
+/* KSZ9x31 remote loopback register */
+#define KSZ9x31_REMOTE_LOOPBACK 0x11
+/* This is an undocumented bit of the KSZ9131RNX.
+ * It was reported by NXP in cooperation with Micrel.
+ */
+#define KSZ9x31_REMOTE_LOOPBACK_KEEP_PREAMBLE BIT(2)
+#define KSZ9x31_REMOTE_LOOPBACK_EN BIT(8)
+
#define LAN8814_SKUS 0xB
#define LAN8814_WIRE_PAIR_MASK 0xF
@@ -1500,7 +1508,11 @@ static int ksz9131_config_init(struct phy_device *phydev)
if (ret < 0)
return ret;
- return 0;
+ if (phydev->dev_flags & PHY_F_KEEP_PREAMBLE_BEFORE_SFD)
+ ret = phy_modify(phydev, KSZ9x31_REMOTE_LOOPBACK, 0,
+ KSZ9x31_REMOTE_LOOPBACK_KEEP_PREAMBLE);
+
+ return ret;
}
#define MII_KSZ9131_AUTO_MDIX 0x1C