[PATCH 2/3] arm: mvebu: Espressobin: move network setup into a separate function

Stefan Roese sr at denx.de
Mon Sep 18 08:47:55 CEST 2023


On 9/14/23 12:16, Robert Marko wrote:
> Currently, Esspresobin switch is being setup directly in last_stage_init()
> which makes it hard to add support for any other board to be setup.
> 
> So, lets just move the switch setup code to a separate function and call it
> if compatible matches, there should be no functional change.
> 
> Signed-off-by: Robert Marko <robert.marko at sartura.hr>

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 16 +++++++++++-----
>   1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index da325e8c75..6527155c6e 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -300,15 +300,11 @@ static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr,
>   	return 0;
>   }
>   
> -/* Bring-up board-specific network stuff */
> -int last_stage_init(void)
> +static int espressobin_last_stage_init(void)
>   {
>   	struct udevice *bus;
>   	ofnode node;
>   
> -	if (!of_machine_is_compatible("globalscale,espressobin"))
> -		return 0;
> -
>   	node = ofnode_by_compatible(ofnode_null(), "marvell,orion-mdio");
>   	if (!ofnode_valid(node) ||
>   	    uclass_get_device_by_ofnode(UCLASS_MDIO, node, &bus) ||
> @@ -356,6 +352,16 @@ int last_stage_init(void)
>   
>   	return 0;
>   }
> +
> +/* Bring-up board-specific network stuff */
> +int last_stage_init(void)
> +{
> +
> +	if (of_machine_is_compatible("globalscale,espressobin"))
> +		return espressobin_last_stage_init();
> +
> +	return 0;
> +}
>   #endif
>   
>   #ifdef CONFIG_OF_BOARD_SETUP

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de


More information about the U-Boot mailing list