diff mbox series

[1/2] sunxi: Fix old GMAC pinmux setup

Message ID 20220316005443.16260-2-andre.przywara@arm.com
State Accepted
Commit e943753dc2e3cc10669f1b38ad068eaa0ba77731
Delegated to: Andre Przywara
Headers show
Series sunxi: Fix Ethernet on mostly A20 boards | expand

Commit Message

Andre Przywara March 16, 2022, 12:54 a.m. UTC
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(-)

Comments

Jernej Škrabec March 16, 2022, 4:55 p.m. UTC | #1
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
> 
>
Andre Przywara March 16, 2022, 5:04 p.m. UTC | #2
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
> > 
> >   
> 
>
Petr Štetiar March 21, 2022, 2:17 p.m. UTC | #3
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
diff mbox series

Patch

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;
 }