[U-Boot] [PATCH 24/28] SPEAr : Network support configuration
Vipin KUMAR
vipin.kumar at st.com
Wed Jul 14 07:10:00 CEST 2010
From: Vipin KUMAR <vipin.kumar at st.com>
This patch implements the review feedbacks provided by Ben according to which
board_eth_init routine should not return -1. Instead, it should handle the
errors itself (by printing error banner / somethign else)
For more info
http://lists.denx.de/pipermail/u-boot/2010-May/071357.html
Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
---
board/spear/spear300/spear300.c | 7 ++++---
board/spear/spear310/spear310.c | 21 ++++++++++-----------
board/spear/spear320/spear320.c | 8 ++++----
board/spear/spear600/spear600.c | 7 ++++---
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index 3f7ccb8..d9f9aca 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -61,9 +61,10 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis)
{
+ int ret = 0;
#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
-#else
- return -1;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0)
+ ret++;
#endif
+ return ret;
}
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index f74bbac..9543b19 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -63,27 +63,26 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis)
{
int ret = 0;
-
#if defined(CONFIG_DESIGNWARE_ETH)
- if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0)
- ret += -1;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0)
+ ret++;
#endif
#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) < 0)
- ret += -1;
+ CONFIG_MACB0_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(1, (void *)CONFIG_SYS_MACB1_BASE,
- CONFIG_MACB1_PHY) < 0)
- ret += -1;
+ CONFIG_MACB1_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(2, (void *)CONFIG_SYS_MACB2_BASE,
- CONFIG_MACB2_PHY) < 0)
- ret += -1;
+ CONFIG_MACB2_PHY) >= 0)
+ ret++;
if (macb_eth_initialize(3, (void *)CONFIG_SYS_MACB3_BASE,
- CONFIG_MACB3_PHY) < 0)
- ret += -1;
+ CONFIG_MACB3_PHY) >= 0)
+ ret++;
#endif
return ret;
}
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index adddfd1..77f3bc5 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -64,13 +64,13 @@ int board_eth_init(bd_t *bis)
{
int ret = 0;
#if defined(CONFIG_DESIGNWARE_ETH)
- if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) < 0)
- ret += -1;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0)
+ ret++;
#endif
#if defined(CONFIG_MACB)
if (macb_eth_initialize(0, (void *)CONFIG_SYS_MACB0_BASE,
- CONFIG_MACB0_PHY) < 0)
- ret += -1;
+ CONFIG_MACB0_PHY) >= 0)
+ ret++;
#endif
return ret;
}
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c
index 5a32b7f..ec10396 100644
--- a/board/spear/spear600/spear600.c
+++ b/board/spear/spear600/spear600.c
@@ -56,9 +56,10 @@ int board_nand_init(struct nand_chip *nand)
int board_eth_init(bd_t *bis)
{
+ int ret = 0;
#if defined(CONFIG_DESIGNWARE_ETH)
- return designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY);
-#else
- return -1;
+ if (designware_initialize(0, CONFIG_SPEAR_ETHBASE, CONFIG_DW0_PHY) >= 0)
+ ret++;
#endif
+ return ret;
}
--
1.6.0.2
More information about the U-Boot
mailing list