[U-Boot] [PATCH] ARM DaVinci: Remove duplicate code in cpu/arm926ejs/davinci/dp83848.c

Hugo Villeneuve hugo.villeneuve at lyrtech.com
Mon Sep 1 18:00:18 CEST 2008


ARM DaVinci: Remove duplicate code in cpu/arm926ejs/davinci/dp83848.c

Signed-off-by: Hugo Villeneuve <hugo.villeneuve at lyrtech.com>

---

Remove duplicate code in a if/else block in
cpu/arm926ejs/davinci/dp83848.c.

 cpu/arm926ejs/config.mk         |    2 +-
 cpu/arm926ejs/davinci/dp83848.c |   32 +++++++++-----------------------
 2 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/cpu/arm926ejs/config.mk b/cpu/arm926ejs/config.mk
index 8db4adb..fc54845 100644
--- a/cpu/arm926ejs/config.mk
+++ b/cpu/arm926ejs/config.mk
@@ -30,5 +30,5 @@ PLATFORM_CPPFLAGS += -march=armv4
 # Supply options according to compiler version
 #
 # =========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32)
 PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
diff --git a/cpu/arm926ejs/davinci/dp83848.c b/cpu/arm926ejs/davinci/dp83848.c
index 2aa9ef1..ef77ecb 100644
--- a/cpu/arm926ejs/davinci/dp83848.c
+++ b/cpu/arm926ejs/davinci/dp83848.c
@@ -64,29 +64,15 @@ int dp83848_get_link_speed(int phy_addr)
 		return(0);
 
 	/* Speed doesn't matter, there is no setting for it in EMAC... */
-	if (tmp & DP83848_SPEED) {
-		if (tmp & DP83848_DUPLEX) {
-			/* set DM644x EMAC for Full Duplex  */
-			emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE | EMAC_MACCONTROL_FULLDUPLEX_ENABLE;
-		} else {
-			/*set DM644x EMAC for Half Duplex  */
-			emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE;
-		}
-
-		return(1);
-	} else {
-		if (tmp & DP83848_DUPLEX) {
-			/* set DM644x EMAC for Full Duplex  */
-			emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE | EMAC_MACCONTROL_FULLDUPLEX_ENABLE;
-		} else {
-			/*set DM644x EMAC for Half Duplex  */
-			emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE;
-		}
-
-		return(1);
-	}
-
-	return(0);
+	if (tmp & DP83848_DUPLEX)
+		/* Set DM644x EMAC for Full Duplex */
+		emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE |
+			EMAC_MACCONTROL_FULLDUPLEX_ENABLE;
+	else
+		/* Set DM644x EMAC for Half Duplex */
+		emac->MACCONTROL = EMAC_MACCONTROL_MIIEN_ENABLE;
+
+	return(1);
 }
 
 


More information about the U-Boot mailing list