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 <[email protected]> Signed-off-by: Andrej Picej <[email protected]> Signed-off-by: Florijan Plohl <[email protected]> --- 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}; +ðphy { + /* + * 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
