From 0e138dfe10981e1064f76bd724883dde067a141e Mon Sep 17 00:00:00 2001 From: Kris Bahnsen Date: Tue, 23 Apr 2024 22:11:48 +0000 Subject: [PATCH] ARM: dts: imx28: fix enet flapping issue The net system is (intentionally) designed to only ever issue a hardware reset once. While there have been some hacks over the years to try and bring in a runtime PHY reset control, for example to reduce power by turning everything off when the interface is down; these are unused by many drivers and look to be slowly ripped out over time. The FEC driver, while aware of the imx28 ENET_CLK out, still ends up turning it off at points. Because of the above design choice to only ever reset once, this means the PHY has its clock turned off and back on without a real reset. And in the case of the imx28 MAC, this defaults to 25 MHz, then goes to 50 MHz, when there is a MAC restart. By connecting the enet-out clock to the ethphy handle, this gets connected to the PHY driver which never turns it off. This keeps the clock refcount always positive, and the clock will never turn off. Testing has shown this to eliminate the ethernet PHY link cycling/flapping issue on out i.MX28 platforms. Signed-off-by: Kris Bahnsen --- arch/arm/boot/dts/imx28-ts7400v2.dts | 5 ++++- arch/arm/boot/dts/imx28-ts7670.dts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/imx28-ts7400v2.dts b/arch/arm/boot/dts/imx28-ts7400v2.dts index 6dbde2ec3c7cc..d45d494ec7095 100644 --- a/arch/arm/boot/dts/imx28-ts7400v2.dts +++ b/arch/arm/boot/dts/imx28-ts7400v2.dts @@ -200,7 +200,7 @@ phy-supply = <®_enet_3v3>; phy-handle = <ðphy0>; phy-reset-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>; - phy-reset-duration = <26>; + phy-reset-duration = <100>; phy-reset-post-delay = <1>; status = "okay"; @@ -210,6 +210,9 @@ ethphy0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; + /* magic number "64" is enet out from CPU */ + clocks = <&clks 64>; + clock-names = "rmii-ref"; reg = <0>; }; }; diff --git a/arch/arm/boot/dts/imx28-ts7670.dts b/arch/arm/boot/dts/imx28-ts7670.dts index 11c9e9594b0ff..4e2f5efb6e5b0 100644 --- a/arch/arm/boot/dts/imx28-ts7670.dts +++ b/arch/arm/boot/dts/imx28-ts7670.dts @@ -228,7 +228,7 @@ phy-supply = <®_enet_3v3>; phy-handle = <ðphy0>; phy-reset-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>; - phy-reset-duration = <26>; + phy-reset-duration = <100>; phy-reset-post-delay = <1>; status = "okay"; @@ -238,6 +238,9 @@ ethphy0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; + /* magic number "64" is enet out from CPU */ + clocks = <&clks 64>; + clock-names = "rmii-ref"; reg = <0>; }; };