From: Stefan Eichenberger 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 --- drivers/net/phy/micrel.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 05de68b9f7191..a51bfe4a8d7b5 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 -- 2.51.0