From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 10 May 2010 13:20:42 -0700 Subject: [U-Boot] [PATCH v3 08/19] SPEAr : Network support configured for spear SoCs In-Reply-To: <1273144741-32010-9-git-send-email-vipin.kumar@st.com> References: <1273144741-32010-1-git-send-email-vipin.kumar@st.com> <1273144741-32010-2-git-send-email-vipin.kumar@st.com> <1273144741-32010-3-git-send-email-vipin.kumar@st.com> <1273144741-32010-4-git-send-email-vipin.kumar@st.com> <1273144741-32010-5-git-send-email-vipin.kumar@st.com> <1273144741-32010-6-git-send-email-vipin.kumar@st.com> <1273144741-32010-7-git-send-email-vipin.kumar@st.com> <1273144741-32010-8-git-send-email-vipin.kumar@st.com> <1273144741-32010-9-git-send-email-vipin.kumar@st.com> Message-ID: <4BE86A9A.7080207@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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 > +#include > #include > #include > #include > @@ -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