[U-Boot] [PATCH v3 08/19] SPEAr : Network support configured for spear SoCs

Ben Warren biggerbadderben at gmail.com
Mon May 10 22:20:42 CEST 2010


Hi Vipin,

Sorry for weighing in so late on this...

On 5/6/2010 4:18 AM, Vipin KUMAR wrote:
> Signed-off-by: Vipin Kumar<vipin.kumar at st.com>
> ---
>   arch/arm/include/asm/arch-spear/hardware.h |    1 +
>   board/spear/spear300/spear300.c            |   10 ++++++++++
>   board/spear/spear310/spear310.c            |   10 ++++++++++
>   board/spear/spear320/spear320.c            |   10 ++++++++++
>   board/spear/spear600/spear600.c            |   10 ++++++++++
>   include/configs/spear-common.h             |   14 ++++++++++++--
>   include/configs/spear3xx.h                 |    3 +++
>   7 files changed, 56 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-spear/hardware.h b/arch/arm/include/asm/arch-spear/hardware.h
> index 818f36c..39d64b6 100644
> --- a/arch/arm/include/asm/arch-spear/hardware.h
> +++ b/arch/arm/include/asm/arch-spear/hardware.h
> @@ -31,6 +31,7 @@
>   #define CONFIG_SPEAR_SYSCNTLBASE		(0xFCA00000)
>   #define CONFIG_SPEAR_TIMERBASE			(0xFC800000)
>   #define CONFIG_SPEAR_MISCBASE			(0xFCA80000)
> +#define CONFIG_SPEAR_ETHBASE			(0xE0800000)
>
>   #define CONFIG_SYS_NAND_CLE			(1<<  16)
>   #define CONFIG_SYS_NAND_ALE			(1<<  17)
> diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
> index 60ee544..774f466 100644
> --- a/board/spear/spear300/spear300.c
> +++ b/board/spear/spear300/spear300.c
> @@ -22,6 +22,7 @@
>    */
>
>   #include<common.h>
> +#include<netdev.h>
>   #include<nand.h>
>   #include<asm/io.h>
>   #include<asm/arch/hardware.h>
> @@ -56,3 +57,12 @@ int board_nand_init(struct nand_chip *nand)
>
>   	return -1;
>   }
> +
> +int board_eth_init(bd_t *bis)
> +{
> +#if defined(CONFIG_DESIGNWARE_ETH)
> +	return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
> +#else
> +	return -1;
> +#endif
> +}
>    
Returning -1 isn't really the right thing to do here.  I apologize that 
this is really confusing, and needs to be cleaned up.  Next release - I 
promise.  If you want to call cpu_eth_init() here, call it directly.  
Otherwise, return the number of devices found (0 or more).  If there's 
an error in designware_initialize(), you should handle it here, either 
by asserting, printing a failure banner, etc.

The original intent in net/eth.c was something like this:

     /* Try board-specific initialization first.  If it fails or isn't
      * present, try the cpu-specific initialization */
     if (board_eth_init(bis) *is weak* )
         cpu_eth_init(bis);

but the easiest way to check for weakness was to return -1.  This is of 
course an inappropriate number to use since it's the almost-universal 
return code for failure.

Again, sorry for bringing this up after so many of your iterations.

regards,
Ben




More information about the U-Boot mailing list