sunxi: Fix Ethernet on mostly A20 boards
Subsystems (3)
cover 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(-)
Signature · 1 line
2.35.1
PATCH 1/2 sunxi: Fix old GMAC pinmux setup
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.
--- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/board.c +0 -1
@@ -333,7 +333,6 @@ void board_init_f(ulong dummy)clock_init ();timer_init ();gpio_init (); -eth_init_board ();spl_init ();preloader_console_init ();
board/sunxi/board.c +3 -0
@@ -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 ; }
Signature · 1 line
2.35.1
Re: [PATCH 1/2] sunxi: Fix old GMAC pinmux setup
Dne sreda, 16. marec 2022 ob 01:54:42 CET je Andre Przywara napisal(a):
Quoted 7 lines
Commit
5bc4cd05d7d4("sunxi: move non-essential code out ofs_init()") moved the call toeth_init_board()froms_init()intoboard_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 ineth_init_board()was not happy about that, so it broke the sun7i GMAC.
Quoted 7 lines
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 <[email protected]>
I guess this function will soon go away with introduction of clock and pinctrl driver.
Best regards,
Jernej
Quoted 42 lines
--- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/board.c +0
-1@@ -333,7 +333,6 @@ void board_init_f(ulong dummy)clock_init ();timer_init ();gpio_init (); -eth_init_board ();spl_init ();preloader_console_init ();board/sunxi/board.c +3
-0@@ -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 ; }Signature · 1 line
2.35.1
Re: [PATCH 1/2] sunxi: Fix old GMAC pinmux setup
Quoted 11 lines · On Wed, 16 Mar 2022 17:55:16 +0100 Jernej Škrabec <[email protected]>…
Dne sreda, 16. marec 2022 ob 01:54:42 CET je Andre Przywara napisal(a):
Quoted 10 lines
Commit
5bc4cd05d7d4("sunxi: move non-essential code out ofs_init()") moved the call toeth_init_board()froms_init()intoboard_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 ineth_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.
Quoted 6 lines
Quoted 4 lines
This fixes Ethernet operation for the A20 SoCs, which broke in v2022.04-rc1, with the above mentioned commit.
Signed-off-by Andre Przywara <[email protected]>Reviewed-by Jernej Skrabec <[email protected]>
Thanks!
Quoted 2 lines
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
Quoted 48 lines
Best regards,
JernejQuoted 42 lines
--- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/board.c +0
-1@@ -333,7 +333,6 @@ void board_init_f(ulong dummy)clock_init ();timer_init ();gpio_init (); -eth_init_board ();spl_init ();preloader_console_init ();board/sunxi/board.c +3
-0@@ -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 ; }Signature · 1 line
2.35.1
Re: [PATCH 1/2] sunxi: Fix old GMAC pinmux setup
In reply to Andre PrzywaraAndre Przywara <[email protected]> [2022-03-16 00:54:42]:
Quoted 7 lines
Commit
5bc4cd05d7d4("sunxi: move non-essential code out ofs_init()") moved the call toeth_init_board()froms_init()intoboard_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 ineth_init_board()was not happy about that, so it broke the sun7i GMAC.
Quoted 5 lines
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.
Quoted 41 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/mach-sunxi/board.c | 1 - board/sunxi/board.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-sunxi/board.c +0
-1@@ -333,7 +333,6 @@ void board_init_f(ulong dummy)clock_init ();timer_init ();gpio_init (); -eth_init_board ();spl_init ();preloader_console_init ();board/sunxi/board.c +3
-0@@ -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 ; }Signature · 1 line
2.35.1
PATCH 2/2 sunxi: dts: Update RGMII phy-mode properties
In reply to Andre PrzywaraCommit 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.
--- 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(-)
arch/arm/dts/sun50i-a64-sopine-baseboard.dts +1 -1
@@ -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";
arch/arm/dts/sun50i-h5-nanopi-neo2.dts +1 -1
@@ -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"; };
arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts +1 -1
@@ -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"; };
arch/arm/dts/sun6i-a31-hummingbird.dts +1 -1
@@ -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>;
arch/arm/dts/sun7i-a20-bananapi-m1-plus.dts +1 -1
@@ -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";
arch/arm/dts/sun7i-a20-bananapi.dts +1 -1
@@ -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";
arch/arm/dts/sun7i-a20-bananapro.dts +1 -1
@@ -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";
arch/arm/dts/sun7i-a20-cubietruck.dts +1 -1
@@ -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 {
arch/arm/dts/sun7i-a20-olinuxino-lime2.dts +1 -1
@@ -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 {
arch/arm/dts/sun7i-a20-pcduino3-nano.dts +1 -1
@@ -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 {
arch/arm/dts/sun8i-a83t-bananapi-m3.dts +1 -1
@@ -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";
arch/arm/dts/sun8i-a83t-cubietruck-plus.dts +1 -1
@@ -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"; };
arch/arm/dts/sun8i-h3-orangepi-plus.dts +1 -1
@@ -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"; };
arch/arm/dts/sunxi-bananapi-m2-plus.dtsi +1 -1
@@ -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"; };
Signature · 1 line
2.35.1
Re: [PATCH 2/2] sunxi: dts: Update RGMII phy-mode properties
Quoted 7 lines · Andre Przywara
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.
Quoted 6 lines
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 <[email protected]>
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