[U-Boot] [PATCH 11/15] MPC85xx: update uec to support up to 8 UECs in QE

Wolfgang Denk wd at denx.de
Wed May 20 21:42:35 CEST 2009


Dear Haiying Wang,

In message <1242837043-8243-11-git-send-email-Haiying.Wang at freescale.com> you wrote:
> Signed-off-by: Haiying Wang <Haiying.Wang at freescale.com>
> ---
>  cpu/mpc85xx/cpu.c |    6 +++++
>  cpu/mpc85xx/fdt.c |    4 ++-
>  drivers/qe/uec.c  |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  3 files changed, 74 insertions(+), 2 deletions(-)
> 
> diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
> index b812d88..eb2aeec 100644
> --- a/cpu/mpc85xx/cpu.c
> +++ b/cpu/mpc85xx/cpu.c
> @@ -399,6 +399,12 @@ int cpu_eth_init(bd_t *bis)
>  #if defined(CONFIG_UEC_ETH6)
>  	uec_initialize(5);
>  #endif
> +#if defined(CONFIG_UEC_ETH7)
> +	uec_initialize(6);
> +#endif
> +#if defined(CONFIG_UEC_ETH8)
> +	uec_initialize(7);
> +#endif

This cries for using a loop instead. There are several places that
contain similar code - would it make sense to initialize a variable
with a bit files of used interfaces, so we can do this in a simple
runtime loop?

>  #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
> -    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
> +    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\
> +    defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5) ||\
> +    defined(CONFIG_HAS_ETH6) || defined(CONFIG_HAS_ETH7)
>  	fdt_fixup_ethernet(blob);

Ditto here.

>  #ifdef CONFIG_UEC_ETH6
>  		uec_info = &eth6_uec_info;
>  #endif
> +	} else if (index == 6) {
> +#ifdef CONFIG_UEC_ETH7
> +		uec_info = &eth7_uec_info;
> +#endif
> +	} else if (index == 7) {
> +#ifdef CONFIG_UEC_ETH8
> +		uec_info = &eth8_uec_info;
> +#endif

And here again.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A morsel of genuine history is a  thing  so  rare  as  to  be  always
valuable.                                          - Thomas Jefferson


More information about the U-Boot mailing list