diff mbox series

[v1] sunxi: board: Move USB ethernet initialization to board_late_init()

Message ID 20201208154531.55150-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit 92600edb431b03df7149ee30c1508bbc3b5ebb43
Delegated to: Andre Przywara
Headers show
Series [v1] sunxi: board: Move USB ethernet initialization to board_late_init() | expand

Commit Message

Andy Shevchenko Dec. 8, 2020, 3:45 p.m. UTC
For the sake of consistency (*) and order of initialization, i.e.
after we have got the ethernet address, interrupt and timer initialized,
try to initialize USB ethernet gadget.

*) for example, zynqmp uses same order.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/arm/Kconfig    | 1 +
 board/sunxi/board.c | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Andre Przywara Dec. 8, 2020, 5:14 p.m. UTC | #1
On 08/12/2020 15:45, Andy Shevchenko wrote:
> For the sake of consistency (*) and order of initialization, i.e.
> after we have got the ethernet address, interrupt and timer initialized,
> try to initialize USB ethernet gadget.
> 
> *) for example, zynqmp uses same order.

Looks alright, but we need some testing, to check for possible side
effects. (It's those seemingly innocent changes that tend to break things).
Will get back to you later.

Cheers,
Andre

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/arm/Kconfig    | 1 +
>  board/sunxi/board.c | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 5903c093705a..3d9be8a7507e 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1045,6 +1045,7 @@ config ARCH_SUNXI
>  	select SPL_USE_TINY_PRINTF
>  	select USE_PREBOOT
>  	select SYS_RELOC_GD_ENV_ADDR
> +	imply BOARD_LATE_INIT
>  	imply CMD_DM
>  	imply CMD_GPT
>  	imply CMD_UBI if MTD_RAW_NAND
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 708a27ed78e9..77e464718846 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -890,6 +890,11 @@ int misc_init_r(void)
>  
>  	setup_environment(gd->fdt_blob);
>  
> +	return 0;
> +}
> +
> +int board_late_init(void)
> +{
>  #ifdef CONFIG_USB_ETHER
>  	usb_ether_init();
>  #endif
>
Andy Shevchenko Dec. 8, 2020, 5:23 p.m. UTC | #2
On Tue, Dec 8, 2020 at 7:14 PM André Przywara <andre.przywara@arm.com> wrote:
> On 08/12/2020 15:45, Andy Shevchenko wrote:
> > For the sake of consistency (*) and order of initialization, i.e.
> > after we have got the ethernet address, interrupt and timer initialized,
> > try to initialize USB ethernet gadget.
> >
> > *) for example, zynqmp uses same order.
>
> Looks alright, but we need some testing, to check for possible side
> effects. (It's those seemingly innocent changes that tend to break things).

Right. I made a patch purely based on reading the U-Boot initialization code.

> Will get back to you later.

Take your time and thanks!
Andre Przywara Jan. 8, 2021, 10:07 p.m. UTC | #3
On 08/12/2020 15:45, Andy Shevchenko wrote:

Hi,

> For the sake of consistency (*) and order of initialization, i.e.
> after we have got the ethernet address, interrupt and timer initialized,
> try to initialize USB ethernet gadget.
> 
> *) for example, zynqmp uses same order.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>

I tried on: Pine64-LTS, Pine H64, OrangePi Zero, Banana Pi M1. Could do
TFTP correctly. Also compared the MAC addresses before and after.

I will queue this for the merge window, to get some more exposure.

Cheers,
Andre

> ---
>  arch/arm/Kconfig    | 1 +
>  board/sunxi/board.c | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 5903c093705a..3d9be8a7507e 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1045,6 +1045,7 @@ config ARCH_SUNXI
>  	select SPL_USE_TINY_PRINTF
>  	select USE_PREBOOT
>  	select SYS_RELOC_GD_ENV_ADDR
> +	imply BOARD_LATE_INIT
>  	imply CMD_DM
>  	imply CMD_GPT
>  	imply CMD_UBI if MTD_RAW_NAND
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 708a27ed78e9..77e464718846 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -890,6 +890,11 @@ int misc_init_r(void)
>  
>  	setup_environment(gd->fdt_blob);
>  
> +	return 0;
> +}
> +
> +int board_late_init(void)
> +{
>  #ifdef CONFIG_USB_ETHER
>  	usb_ether_init();
>  #endif
>
diff mbox series

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5903c093705a..3d9be8a7507e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1045,6 +1045,7 @@  config ARCH_SUNXI
 	select SPL_USE_TINY_PRINTF
 	select USE_PREBOOT
 	select SYS_RELOC_GD_ENV_ADDR
+	imply BOARD_LATE_INIT
 	imply CMD_DM
 	imply CMD_GPT
 	imply CMD_UBI if MTD_RAW_NAND
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 708a27ed78e9..77e464718846 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -890,6 +890,11 @@  int misc_init_r(void)
 
 	setup_environment(gd->fdt_blob);
 
+	return 0;
+}
+
+int board_late_init(void)
+{
 #ifdef CONFIG_USB_ETHER
 	usb_ether_init();
 #endif