[PATCH 0/2] sunxi: Fix Ethernet on mostly A20 boards

Hi,
testing on a BananaPi M1 board revealed that Ethernet has regressed since the last release due to not only one, but two bugs: - The pinmux and GMAC clock setup for the A20 GMAC is apparently called too early now. - The updated RGMII phy-mode properties are now taken for real, so many boards are using the wrong RX/TX line delay setup, with mostly fatal consequences.
Fix those two issues to bring Ethernet back on those affected boards.
I refrained from just syncing the DTs from the kernel (to fix the second issue): Recent changes in the mainline DTs require newer kernels to work, which breaks Linux distro installer ISO images running via UEFI. We need to find a solution for that, but not in -rc4, which would be rather late for a normal DT sync anyway.
Please have a look and test on your board!
Cheers, Andre
Andre Przywara (2): sunxi: Fix old GMAC pinmux setup sunxi: dts: Update RGMII phy-mode properties
arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 2 +- arch/arm/dts/sun50i-h5-nanopi-neo2.dts | 2 +- arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts | 2 +- arch/arm/dts/sun6i-a31-hummingbird.dts | 2 +- arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts | 2 +- arch/arm/dts/sun7i-a20-bananapi.dts | 2 +- arch/arm/dts/sun7i-a20-bananapro.dts | 2 +- arch/arm/dts/sun7i-a20-cubietruck.dts | 2 +- arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 2 +- arch/arm/dts/sun7i-a20-pcduino3-nano.dts | 2 +- arch/arm/dts/sun8i-a83t-bananapi-m3.dts | 2 +- arch/arm/dts/sun8i-a83t-cubietruck-plus.dts | 2 +- arch/arm/dts/sun8i-h3-orangepi-plus.dts | 2 +- arch/arm/dts/sunxi-bananapi-m2-plus.dtsi | 2 +- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 16 files changed, 17 insertions(+), 15 deletions(-)

Commit 5bc4cd05d7d4 ("sunxi: move non-essential code out of s_init()") moved the call to eth_init_board() from s_init() into board_init_f(). This means it's now only called from the SPL, which makes sense for most of the other moved low-level functions. However the GMAC pinmux and clock setup in eth_init_board() was not happy about that, so it broke the sun7i GMAC.
Since Ethernet is of no use in the SPL anyway, just move the call into board_init(), which is only run in U-Boot proper.
This fixes Ethernet operation for the A20 SoCs, which broke in v2022.04-rc1, with the above mentioned commit.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 0071de19ffd..9a7673d82dc 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -333,7 +333,6 @@ void board_init_f(ulong dummy) clock_init(); timer_init(); gpio_init(); - eth_init_board();
spl_init(); preloader_console_init(); diff --git a/board/sunxi/board.c b/board/sunxi/board.c index a0961590479..28f702bc296 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -30,6 +30,7 @@ #include <asm/arch/prcm.h> #include <asm/arch/pmic_bus.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/global_data.h> #include <linux/delay.h> #include <u-boot/crc.h> @@ -308,6 +309,8 @@ int board_init(void) #endif #endif /* CONFIG_DM_MMC */
+ eth_init_board(); + return 0; }

Dne sreda, 16. marec 2022 ob 01:54:42 CET je Andre Przywara napisal(a):
Commit 5bc4cd05d7d4 ("sunxi: move non-essential code out of s_init()") moved the call to eth_init_board() from s_init() into board_init_f(). This means it's now only called from the SPL, which makes sense for most of the other moved low-level functions. However the GMAC pinmux and clock setup in eth_init_board() was not happy about that, so it broke the sun7i GMAC.
Since Ethernet is of no use in the SPL anyway, just move the call into board_init(), which is only run in U-Boot proper.
This fixes Ethernet operation for the A20 SoCs, which broke in v2022.04-rc1, with the above mentioned commit.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Jernej Skrabec jernej.skrabec@gmail.com
I guess this function will soon go away with introduction of clock and pinctrl driver.
Best regards, Jernej
arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 0071de19ffd..9a7673d82dc 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -333,7 +333,6 @@ void board_init_f(ulong dummy) clock_init(); timer_init(); gpio_init();
eth_init_board();
spl_init(); preloader_console_init();
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index a0961590479..28f702bc296 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -30,6 +30,7 @@ #include <asm/arch/prcm.h> #include <asm/arch/pmic_bus.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/global_data.h> #include <linux/delay.h> #include <u-boot/crc.h> @@ -308,6 +309,8 @@ int board_init(void) #endif #endif /* CONFIG_DM_MMC */
- eth_init_board();
- return 0;
}
-- 2.35.1

On Wed, 16 Mar 2022 17:55:16 +0100 Jernej Škrabec jernej.skrabec@gmail.com wrote:
Dne sreda, 16. marec 2022 ob 01:54:42 CET je Andre Przywara napisal(a):
Commit 5bc4cd05d7d4 ("sunxi: move non-essential code out of s_init()") moved the call to eth_init_board() from s_init() into board_init_f(). This means it's now only called from the SPL, which makes sense for most of the other moved low-level functions. However the GMAC pinmux and clock setup in eth_init_board() was not happy about that, so it broke the sun7i GMAC.
Since Ethernet is of no use in the SPL anyway, just move the call into board_init(), which is only run in U-Boot proper.
This fixes Ethernet operation for the A20 SoCs, which broke in v2022.04-rc1, with the above mentioned commit.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Jernej Skrabec jernej.skrabec@gmail.com
Thanks!
I guess this function will soon go away with introduction of clock and pinctrl driver.
Yes, indeed, forgot to mention this. This is just a stop-gap measure to fix Ethernet before the 2022.04 release.
Cheers, Andre
Best regards, Jernej
arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 0071de19ffd..9a7673d82dc 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -333,7 +333,6 @@ void board_init_f(ulong dummy) clock_init(); timer_init(); gpio_init();
eth_init_board();
spl_init(); preloader_console_init();
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index a0961590479..28f702bc296 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -30,6 +30,7 @@ #include <asm/arch/prcm.h> #include <asm/arch/pmic_bus.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/global_data.h> #include <linux/delay.h> #include <u-boot/crc.h> @@ -308,6 +309,8 @@ int board_init(void) #endif #endif /* CONFIG_DM_MMC */
- eth_init_board();
- return 0;
}
-- 2.35.1

Andre Przywara andre.przywara@arm.com [2022-03-16 00:54:42]:
Commit 5bc4cd05d7d4 ("sunxi: move non-essential code out of s_init()") moved the call to eth_init_board() from s_init() into board_init_f(). This means it's now only called from the SPL, which makes sense for most of the other moved low-level functions. However the GMAC pinmux and clock setup in eth_init_board() was not happy about that, so it broke the sun7i GMAC.
Since Ethernet is of no use in the SPL anyway, just move the call into board_init(), which is only run in U-Boot proper.
This fixes Ethernet operation for the A20 SoCs, which broke in v2022.04-rc1, with the above mentioned commit.
Tested-by: Petr Štetiar ynezz@true.cz [a20-olinuxino-lime2]
Signed-off-by: Andre Przywara andre.przywara@arm.com
arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 0071de19ffd..9a7673d82dc 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -333,7 +333,6 @@ void board_init_f(ulong dummy) clock_init(); timer_init(); gpio_init();
eth_init_board();
spl_init(); preloader_console_init();
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index a0961590479..28f702bc296 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -30,6 +30,7 @@ #include <asm/arch/prcm.h> #include <asm/arch/pmic_bus.h> #include <asm/arch/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/global_data.h> #include <linux/delay.h> #include <u-boot/crc.h> @@ -308,6 +309,8 @@ int board_init(void) #endif #endif /* CONFIG_DM_MMC */
- eth_init_board();
- return 0;
}
-- 2.35.1

Commit f11513d99787 ("net: phy: realtek: Add tx/rx delay config for 8211e") made the Realtek PHY driver honour the phy-mode DT property, to set up the proper delay scheme for the RX and TX lines. A similar change in the kernel revealed that those properties were mostly wrong. The kernel DTs got updated over the last few months, but we were missing out on the U-Boot version.
Just sync in the phy-mode properties from the mainline kernel, v5.17-rc7, to avoid the breaking DT sync that late in the cycle.
This fixes Ethernet operation on the affected boards.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 2 +- arch/arm/dts/sun50i-h5-nanopi-neo2.dts | 2 +- arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts | 2 +- arch/arm/dts/sun6i-a31-hummingbird.dts | 2 +- arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts | 2 +- arch/arm/dts/sun7i-a20-bananapi.dts | 2 +- arch/arm/dts/sun7i-a20-bananapro.dts | 2 +- arch/arm/dts/sun7i-a20-cubietruck.dts | 2 +- arch/arm/dts/sun7i-a20-olinuxino-lime2.dts | 2 +- arch/arm/dts/sun7i-a20-pcduino3-nano.dts | 2 +- arch/arm/dts/sun8i-a83t-bananapi-m3.dts | 2 +- arch/arm/dts/sun8i-a83t-cubietruck-plus.dts | 2 +- arch/arm/dts/sun8i-h3-orangepi-plus.dts | 2 +- arch/arm/dts/sunxi-bananapi-m2-plus.dtsi | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts index e22b94c8364..5e66ce1a334 100644 --- a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts +++ b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts @@ -79,7 +79,7 @@ &emac { pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>; - phy-mode = "rgmii-id"; + phy-mode = "rgmii-txid"; phy-handle = <&ext_rgmii_phy>; phy-supply = <®_dc1sw>; status = "okay"; diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo2.dts b/arch/arm/dts/sun50i-h5-nanopi-neo2.dts index 02f8e72f0ca..05486cccee1 100644 --- a/arch/arm/dts/sun50i-h5-nanopi-neo2.dts +++ b/arch/arm/dts/sun50i-h5-nanopi-neo2.dts @@ -75,7 +75,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; phy-handle = <&ext_rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay"; };
diff --git a/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts b/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts index d13980ed7a7..7ec5ac850a0 100644 --- a/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts +++ b/arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts @@ -69,7 +69,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; phy-handle = <&ext_rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay"; };
diff --git a/arch/arm/dts/sun6i-a31-hummingbird.dts b/arch/arm/dts/sun6i-a31-hummingbird.dts index ce4f9e9834b..2c143580350 100644 --- a/arch/arm/dts/sun6i-a31-hummingbird.dts +++ b/arch/arm/dts/sun6i-a31-hummingbird.dts @@ -162,7 +162,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_pins_rgmii_a>, <&gmac_phy_reset_pin_hummingbird>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; snps,reset-gpio = <&pio 0 21 GPIO_ACTIVE_HIGH>; snps,reset-active-low; snps,reset-delays-us = <0 10000 30000>; diff --git a/arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts b/arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts index e2bfe005883..4dbcad1343b 100644 --- a/arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts +++ b/arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts @@ -130,7 +130,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-supply = <®_gmac_3v3>; status = "okay";
diff --git a/arch/arm/dts/sun7i-a20-bananapi.dts b/arch/arm/dts/sun7i-a20-bananapi.dts index 81bc85d398c..33040c43bce 100644 --- a/arch/arm/dts/sun7i-a20-bananapi.dts +++ b/arch/arm/dts/sun7i-a20-bananapi.dts @@ -132,7 +132,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-supply = <®_gmac_3v3>; status = "okay";
diff --git a/arch/arm/dts/sun7i-a20-bananapro.dts b/arch/arm/dts/sun7i-a20-bananapro.dts index 0176e9de018..8a75545e228 100644 --- a/arch/arm/dts/sun7i-a20-bananapro.dts +++ b/arch/arm/dts/sun7i-a20-bananapro.dts @@ -110,7 +110,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; phy-supply = <®_gmac_3v3>; status = "okay";
diff --git a/arch/arm/dts/sun7i-a20-cubietruck.dts b/arch/arm/dts/sun7i-a20-cubietruck.dts index 99f531b8d2a..46a9f4669e1 100644 --- a/arch/arm/dts/sun7i-a20-cubietruck.dts +++ b/arch/arm/dts/sun7i-a20-cubietruck.dts @@ -151,7 +151,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay";
phy1: ethernet-phy@1 { diff --git a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts index 4e1c590eb09..996201665b7 100644 --- a/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts +++ b/arch/arm/dts/sun7i-a20-olinuxino-lime2.dts @@ -112,7 +112,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay";
phy1: ethernet-phy@1 { diff --git a/arch/arm/dts/sun7i-a20-pcduino3-nano.dts b/arch/arm/dts/sun7i-a20-pcduino3-nano.dts index 538ea15fa32..205eaae44a0 100644 --- a/arch/arm/dts/sun7i-a20-pcduino3-nano.dts +++ b/arch/arm/dts/sun7i-a20-pcduino3-nano.dts @@ -115,7 +115,7 @@ pinctrl-names = "default"; pinctrl-0 = <&gmac_rgmii_pins>; phy = <&phy1>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay";
phy1: ethernet-phy@1 { diff --git a/arch/arm/dts/sun8i-a83t-bananapi-m3.dts b/arch/arm/dts/sun8i-a83t-bananapi-m3.dts index eaff6fa4018..2beafe3a31d 100644 --- a/arch/arm/dts/sun8i-a83t-bananapi-m3.dts +++ b/arch/arm/dts/sun8i-a83t-bananapi-m3.dts @@ -123,7 +123,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_sw>; phy-handle = <&rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; allwinner,rx-delay-ps = <700>; allwinner,tx-delay-ps = <700>; status = "okay"; diff --git a/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts index 5dba4fc310f..ecd9ff38a8b 100644 --- a/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts +++ b/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts @@ -160,7 +160,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_dldo4>; phy-handle = <&rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; status = "okay"; };
diff --git a/arch/arm/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/dts/sun8i-h3-orangepi-plus.dts index 97f497854e0..d05fa679dcd 100644 --- a/arch/arm/dts/sun8i-h3-orangepi-plus.dts +++ b/arch/arm/dts/sun8i-h3-orangepi-plus.dts @@ -85,7 +85,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; phy-handle = <&ext_rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id";
status = "okay"; }; diff --git a/arch/arm/dts/sunxi-bananapi-m2-plus.dtsi b/arch/arm/dts/sunxi-bananapi-m2-plus.dtsi index 39263e74fbb..8e5cb3b3fd6 100644 --- a/arch/arm/dts/sunxi-bananapi-m2-plus.dtsi +++ b/arch/arm/dts/sunxi-bananapi-m2-plus.dtsi @@ -126,7 +126,7 @@ pinctrl-0 = <&emac_rgmii_pins>; phy-supply = <®_gmac_3v3>; phy-handle = <&ext_rgmii_phy>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id";
status = "okay"; };

On 3/15/22 7:54 PM, Andre Przywara wrote:
Commit f11513d99787 ("net: phy: realtek: Add tx/rx delay config for 8211e") made the Realtek PHY driver honour the phy-mode DT property, to set up the proper delay scheme for the RX and TX lines. A similar change in the kernel revealed that those properties were mostly wrong. The kernel DTs got updated over the last few months, but we were missing out on the U-Boot version.
Just sync in the phy-mode properties from the mainline kernel, v5.17-rc7, to avoid the breaking DT sync that late in the cycle.
This fixes Ethernet operation on the affected boards.
Signed-off-by: Andre Przywara andre.przywara@arm.com
Reviewed-by: Samuel Holland samuel@sholland.org
Verified against the updated files from Linux. I suppose I broke this by not sending a DT sync series during the same release cycle. Hopefully we can get DT syncing unblocked soon and merged for the next release.
Regards, Samuel
participants (4)
-
Andre Przywara
-
Jernej Škrabec
-
Petr Štetiar
-
Samuel Holland