Skip to contentSkip to conversation

Davinci Ethernet driver cleanup

PATCH New Ben Warren 3 participants 17 messages Apr 28, 2009 – May 12, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ben Warren

author
#0 lore raw

cover Davinci Ethernet driver cleanup

Hello,

This patch set is an untested attempt at cleaning up the Davinci Ethernet driver. Since I don't have any real hardware, I've tried to keep the logical flow as similar to the original as possible and haven't touched any of the hardware access code. If anybody's able to test it, please do so.

Testing consists of 'MAKEALL ARM9' using ELDK 4.1

thanks,
Ben

author
#1 lore raw

PATCH 1/3 Moved Davinci Ethernet driver to drivers/net

The driver has been renamed dm644x_emac.c

---
 cpu/arm926ejs/davinci/Makefile                     |    2 +-
 drivers/net/Makefile                               |    1 +
 .../davinci/ether.c => drivers/net/dm644x_emac.c   |    0 
 3 files changed, 2 insertions(+), 1 deletions(-)
 rename cpu/arm926ejs/davinci/ether.c => drivers/net/dm644x_emac.c (100%)
cpu/arm926ejs/davinci/Makefile +1 -1
index ed24e65..d77aa46 100644
@@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(SOC).a
 
-COBJS	= timer.o ether.o lxt972.o dp83848.o
+COBJS	= timer.o lxt972.o dp83848.o
 SOBJS	= lowlevel_init.o reset.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
drivers/net/Makefile +1 -0
index a360a50..26f1ea6 100644
@@ -64,6 +64,7 @@ COBJS-$(CONFIG_SH_ETHER) += sh_eth.o
 COBJS-$(CONFIG_DRIVER_SMC91111) += smc91111.o
 COBJS-$(CONFIG_DRIVER_SMC911X) += smc911x.o
 COBJS-$(CONFIG_TIGON3) += tigon3.o bcm570x_autoneg.o 5701rls.o
+COBJS-$(CONFIG_DRIVER_TI_EMAC) += dm644x_emac.o
 COBJS-$(CONFIG_TSEC_ENET) += tsec.o
 COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o
 COBJS-$(CONFIG_ULI526X) += uli526x.o
drivers/net/dm644x_emac.c renamed from cpu/arm926ejs/davinci/ether.c +0 -0
similarity index 100%
rename from cpu/arm926ejs/davinci/ether.c
rename to drivers/net/dm644x_emac.c
Signature · 1 line
1.5.6.3
author
#2 lore raw

PATCH 2/3 Initial cleanup of Davinci Ethernet driver

Removed pointless #ifdefs
Moved functions around in file in preparation for switch to newer API

---
 drivers/net/dm644x_emac.c |  146 +++++++++++++++++++++------------------------
 1 files changed, 69 insertions(+), 77 deletions(-)
drivers/net/dm644x_emac.c +69 -77
index f6f81df..f5cec05 100644
@@ -42,10 +42,6 @@
 #include <miiphy.h>
 #include <asm/arch/emac_defs.h>
 
-#ifdef CONFIG_DRIVER_TI_EMAC
-
-#ifdef CONFIG_CMD_NET
-
 unsigned int	emac_dbg = 0;
 #define debug_emac(fmt,args...)	if (emac_dbg) printf(fmt,##args)
 
@@ -291,77 +287,6 @@ int davinci_eth_miiphy_initialize(bd_t *bis)
 }
 #endif
 
-/*
- * This function initializes the emac hardware. It does NOT initialize
- * EMAC modules power or pin multiplexors, that is done by board_init()
- * much earlier in bootup process. Returns 1 on success, 0 otherwise.
- */
-static int davinci_eth_hw_init(void)
-{
-	u_int32_t	phy_id;
-	u_int16_t	tmp;
-	int		i;
-
-	davinci_eth_mdio_enable();
-
-	for (i = 0; i < 256; i++) {
-		if (adap_mdio->ALIVE)
-			break;
-		udelay(10);
-	}
-
-	if (i >= 256) {
-		printf("No ETH PHY detected!!!\n");
-		return(0);
-	}
-
-	/* Find if a PHY is connected and get it's address */
-	if (!davinci_eth_phy_detect())
-		return(0);
-
-	/* Get PHY ID and initialize phy_ops for a detected PHY */
-	if (!davinci_eth_phy_read(active_phy_addr, PHY_PHYIDR1, &tmp)) {
-		active_phy_addr = 0xff;
-		return(0);
-	}
-
-	phy_id = (tmp << 16) & 0xffff0000;
-
-	if (!davinci_eth_phy_read(active_phy_addr, PHY_PHYIDR2, &tmp)) {
-		active_phy_addr = 0xff;
-		return(0);
-	}
-
-	phy_id |= tmp & 0x0000ffff;
-
-	switch (phy_id) {
-		case PHY_LXT972:
-			sprintf(phy.name, "LXT972 @ 0x%02x", active_phy_addr);
-			phy.init = lxt972_init_phy;
-			phy.is_phy_connected = lxt972_is_phy_connected;
-			phy.get_link_speed = lxt972_get_link_speed;
-			phy.auto_negotiate = lxt972_auto_negotiate;
-			break;
-		case PHY_DP83848:
-			sprintf(phy.name, "DP83848 @ 0x%02x", active_phy_addr);
-			phy.init = dp83848_init_phy;
-			phy.is_phy_connected = dp83848_is_phy_connected;
-			phy.get_link_speed = dp83848_get_link_speed;
-			phy.auto_negotiate = dp83848_auto_negotiate;
-			break;
-		default:
-			sprintf(phy.name, "GENERIC @ 0x%02x", active_phy_addr);
-			phy.init = gen_init_phy;
-			phy.is_phy_connected = gen_is_phy_connected;
-			phy.get_link_speed = gen_get_link_speed;
-			phy.auto_negotiate = gen_auto_negotiate;
-	}
-
-	printf("Ethernet PHY: %s\n", phy.name);
-
-	return(1);
-}
-
 
 /* Eth device open */
 static int davinci_eth_open(void)
@@ -650,6 +575,73 @@ static int davinci_eth_rcv_packet (void)
 	return (0);
 }
 
-#endif /* CONFIG_CMD_NET */
+/*
+ * This function initializes the emac hardware. It does NOT initialize
+ * EMAC modules power or pin multiplexors, that is done by board_init()
+ * much earlier in bootup process. Returns 1 on success, 0 otherwise.
+ */
+static int davinci_eth_hw_init(void)
+{
+	u_int32_t	phy_id;
+	u_int16_t	tmp;
+	int		i;
+
+	davinci_eth_mdio_enable();
+
+	for (i = 0; i < 256; i++) {
+		if (adap_mdio->ALIVE)
+			break;
+		udelay(10);
+	}
+
+	if (i >= 256) {
+		printf("No ETH PHY detected!!!\n");
+		return(0);
+	}
+
+	/* Find if a PHY is connected and get it's address */
+	if (!davinci_eth_phy_detect())
+		return(0);
+
+	/* Get PHY ID and initialize phy_ops for a detected PHY */
+	if (!davinci_eth_phy_read(active_phy_addr, PHY_PHYIDR1, &tmp)) {
+		active_phy_addr = 0xff;
+		return(0);
+	}
 
-#endif /* CONFIG_DRIVER_TI_EMAC */
+	phy_id = (tmp << 16) & 0xffff0000;
+
+	if (!davinci_eth_phy_read(active_phy_addr, PHY_PHYIDR2, &tmp)) {
+		active_phy_addr = 0xff;
+		return(0);
+	}
+
+	phy_id |= tmp & 0x0000ffff;
+
+	switch (phy_id) {
+		case PHY_LXT972:
+			sprintf(phy.name, "LXT972 @ 0x%02x", active_phy_addr);
+			phy.init = lxt972_init_phy;
+			phy.is_phy_connected = lxt972_is_phy_connected;
+			phy.get_link_speed = lxt972_get_link_speed;
+			phy.auto_negotiate = lxt972_auto_negotiate;
+			break;
+		case PHY_DP83848:
+			sprintf(phy.name, "DP83848 @ 0x%02x", active_phy_addr);
+			phy.init = dp83848_init_phy;
+			phy.is_phy_connected = dp83848_is_phy_connected;
+			phy.get_link_speed = dp83848_get_link_speed;
+			phy.auto_negotiate = dp83848_auto_negotiate;
+			break;
+		default:
+			sprintf(phy.name, "GENERIC @ 0x%02x", active_phy_addr);
+			phy.init = gen_init_phy;
+			phy.is_phy_connected = gen_is_phy_connected;
+			phy.get_link_speed = gen_get_link_speed;
+			phy.auto_negotiate = gen_auto_negotiate;
+	}
+
+	printf("Ethernet PHY: %s\n", phy.name);
+
+	return(1);
+}
Signature · 1 line
1.5.6.3
author
#3 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Added CONFIG_NET_MULTI to all Davinci boards Removed all calls to Davinci network driver from board code Added cpu_eth_init() to cpu/arm926ejs/cpu.c

---
 board/davinci/common/misc.h         |    1 -
 board/davinci/dvevm/dvevm.c         |    3 -
 board/davinci/schmoogie/schmoogie.c |    3 -
 board/davinci/sffsdr/sffsdr.c       |    3 -
 board/davinci/sonata/sonata.c       |    3 -
 cpu/arm926ejs/cpu.c                 |   13 ++++++
 drivers/net/dm644x_emac.c           |   70 ++++++++++++-----------------------
 include/configs/davinci_dvevm.h     |    1 +
 include/configs/davinci_schmoogie.h |    1 +
 include/configs/davinci_sffsdr.h    |    1 +
 include/configs/davinci_sonata.h    |    1 +
 include/netdev.h                    |    1 +
 net/eth.c                           |    4 --
 13 files changed, 42 insertions(+), 63 deletions(-)
board/davinci/common/misc.h +0 -1
index 4a57dbb..25b19b8 100644
@@ -23,7 +23,6 @@
 #define __MISC_H
 
 extern void timer_init(void);
-extern int eth_hw_init(void);
 
 void dv_display_clk_infos(void);
 int dvevm_read_mac_address(uint8_t *buf);
board/davinci/dvevm/dvevm.c +0 -3
index 22308de..9fdfa58 100644
@@ -76,9 +76,6 @@ int misc_init_r(void)
 	if (dvevm_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
 	setenv("videostd", ((video_mode & 0x80) ? "pal" : "ntsc"));
board/davinci/schmoogie/schmoogie.c +0 -3
index 433769a..738e9dd 100644
@@ -133,8 +133,5 @@ int misc_init_r(void)
 		forceenv("serial#", (char *)&tmp[0]);
 	}
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	return(0);
 }
board/davinci/sffsdr/sffsdr.c +0 -3
index e76f86d..45d0456 100644
@@ -146,8 +146,5 @@ int misc_init_r(void)
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("Ethernet init failed\n");
-
 	return(0);
 }
board/davinci/sonata/sonata.c +0 -3
index d56b443..73bd25f 100644
@@ -73,8 +73,5 @@ int misc_init_r(void)
 	if (dvevm_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	return(0);
 }
cpu/arm926ejs/cpu.c +13 -0
index 6307e33..d711b24 100644
@@ -31,6 +31,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <netdev.h>
 #include <arm926ejs.h>
 #include <asm/system.h>
 
@@ -80,3 +81,15 @@ static void cache_flush (void)
 
 	asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
 }
+
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}
drivers/net/dm644x_emac.c +24 -46

140 lines not on this page · raw message

include/configs/davinci_dvevm.h +1 -0
index fae430b..bc5ed5b 100644
@@ -108,6 +108,7 @@
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
 /*=====================*/
 /* Flash & Environment */
 /*=====================*/
include/configs/davinci_schmoogie.h +1 -0
index 923e477..97e3701 100644
@@ -76,6 +76,7 @@
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT	10
 #define CONFIG_OVERWRITE_ETHADDR_ONCE
+#define CONFIG_NET_MULTI
 /*=====================*/
 /* Flash & Environment */
 /*=====================*/
include/configs/davinci_sffsdr.h +1 -0
index 73a59db..160a0d6 100644
@@ -74,6 +74,7 @@
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT	10
 #define CONFIG_OVERWRITE_ETHADDR_ONCE
+#define CONFIG_NET_MULTI
 /* Flash & Environment */
 #undef CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_SYS_NO_FLASH
include/configs/davinci_sonata.h +1 -0
index 70d2c7d..95c5eba 100644
@@ -108,6 +108,7 @@
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #define CONFIG_NET_RETRY_COUNT	10
+#define CONFIG_NET_MULTI
 /*=====================*/
 /* Flash & Environment */
 /*=====================*/
include/netdev.h +1 -0
index 63cf730..17b9679 100644
@@ -44,6 +44,7 @@ int cpu_eth_init(bd_t *bis);
 int au1x00_enet_initialize(bd_t*);
 int bfin_EMAC_initialize(bd_t *bis);
 int dc21x4x_initialize(bd_t *bis);
+int dm644x_emac_initialize(void);
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
net/eth.c +0 -4
index 4bbf84b..caba80b 100644
@@ -505,7 +505,6 @@ extern int at91rm9200_miiphy_initialize(bd_t *bis);
 extern int emac4xx_miiphy_initialize(bd_t *bis);
 extern int mcf52x2_miiphy_initialize(bd_t *bis);
 extern int ns7520_miiphy_initialize(bd_t *bis);
-extern int davinci_eth_miiphy_initialize(bd_t *bis);
 
 
 int eth_initialize(bd_t *bis)
@@ -526,9 +525,6 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_DRIVER_NS7520_ETHERNET)
 	ns7520_miiphy_initialize(bis);
 #endif
-#if defined(CONFIG_DRIVER_TI_EMAC)
-	davinci_eth_miiphy_initialize(bis);
-#endif
 	return 0;
 }
 #endif
Signature · 1 line
1.5.6.3
#4 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Quoted 104 lines · Ben Warren

Added CONFIG_NET_MULTI to all Davinci boards Removed all calls to Davinci network driver from board code Added cpu_eth_init() to cpu/arm926ejs/cpu.c

---
 board/davinci/common/misc.h         |    1 -
 board/davinci/dvevm/dvevm.c         |    3 -
 board/davinci/schmoogie/schmoogie.c |    3 -
 board/davinci/sffsdr/sffsdr.c       |    3 -
 board/davinci/sonata/sonata.c       |    3 -
 cpu/arm926ejs/cpu.c                 |   13 ++++++
 drivers/net/dm644x_emac.c           |   70 ++++++++++++-----------------------
 include/configs/davinci_dvevm.h     |    1 +
 include/configs/davinci_schmoogie.h |    1 +
 include/configs/davinci_sffsdr.h    |    1 +
 include/configs/davinci_sonata.h    |    1 +
 include/netdev.h                    |    1 +
 net/eth.c                           |    4 --
 13 files changed, 42 insertions(+), 63 deletions(-)
board/davinci/common/misc.h +0 -1
index 4a57dbb..25b19b8 100644
@@ -23,7 +23,6 @@
 #define __MISC_H
 
 extern void timer_init(void);
-extern int eth_hw_init(void);
 
 void dv_display_clk_infos(void);
 int dvevm_read_mac_address(uint8_t *buf);
board/davinci/dvevm/dvevm.c +0 -3
index 22308de..9fdfa58 100644
@@ -76,9 +76,6 @@ int misc_init_r(void)
 	if (dvevm_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	i2c_read(0x39, 0x00, 1, &video_mode, 1);
 
 	setenv("videostd", ((video_mode & 0x80) ? "pal" : "ntsc"));
board/davinci/schmoogie/schmoogie.c +0 -3
index 433769a..738e9dd 100644
@@ -133,8 +133,5 @@ int misc_init_r(void)
 		forceenv("serial#", (char *)&tmp[0]);
 	}
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	return(0);
 }
board/davinci/sffsdr/sffsdr.c +0 -3
index e76f86d..45d0456 100644
@@ -146,8 +146,5 @@ int misc_init_r(void)
 	if (sffsdr_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("Ethernet init failed\n");
-
 	return(0);
 }
board/davinci/sonata/sonata.c +0 -3
index d56b443..73bd25f 100644
@@ -73,8 +73,5 @@ int misc_init_r(void)
 	if (dvevm_read_mac_address(eeprom_enetaddr))
 		dv_configure_mac_address(eeprom_enetaddr);
 
-	if (!eth_hw_init())
-		printf("ethernet init failed!\n");
-
 	return(0);
 }
cpu/arm926ejs/cpu.c +3 -0
index 6307e33..d711b24 100644
@@ -31,6 +31,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <netdev.h>
 #include <arm926ejs.h>
 #include <asm/system.h>
 
@@ -80,3 +81,15 @@ static void cache_flush (void)
 
 	asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
 }
+
+/*

cpu/arm926ejs/cpu.c static void cache_flush (void) · line 95

Quoted 10 lines
cpu/arm926ejs/cpu.c +10 -0
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}

please move this to the soc
arm926ejs/davinci/cpu.c

the cpu.c is destinated to be removed in most of the case or at least all the soc specific code

Best Regards,
J.

author
#5 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Hi J-C,

Jean-Christophe PLAGNIOL-VILLARD wrote:
<snip>

Quoted 15 lines

cpu/arm926ejs/cpu.c static void cache_flush (void) · line 95

Quoted 12 lines
cpu/arm926ejs/cpu.c +11 -0
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}

please move this to the soc
arm926ejs/davinci/cpu.c

Quoted 6 lines

the cpu.c is destinated to be removed in most of the case or at least all the soc specific code

Best Regards,
J.

There is currently no such file (not even in arm/next), or that's where this would have gone. This function needs to be in a source file that already has strongly-linked symbols or it won't override the weak version in net/eth.c. I'm certainly open to suggestions.

regards,
Ben

#6 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Quoted 22 lines · Ben Warren

Hi J-C,

Jean-Christophe PLAGNIOL-VILLARD wrote:
<snip>

Quoted 18 lines

cpu/arm926ejs/cpu.c static void cache_flush (void) · line 95

Quoted 12 lines
cpu/arm926ejs/cpu.c +11 -0
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}

please move this to the soc
arm926ejs/davinci/cpu.c

the cpu.c is destinated to be removed in most of the case or at least all the soc specific code

Quoted 7 lines
Quoted 3 lines

Best Regards,
J.

There is currently no such file (not even in arm/next), or that's where this would have gone. This function needs to be in a source file that already has strongly-linked symbols or it won't override the weak version in net/eth.c. I'm certainly open to suggestions.

or simply add an entry in the lds this will force the file to be evaluated first

Best Regards,
J.

author
#7 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Quoted 30 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 28 lines · Ben Warren

Hi J-C,

Jean-Christophe PLAGNIOL-VILLARD wrote:
<snip>

Quoted 23 lines

cpu/arm926ejs/cpu.c static void cache_flush (void) · line 95

Quoted 13 lines
cpu/arm926ejs/cpu.c +11 -0
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}

please move this to the soc
arm926ejs/davinci/cpu.c

the cpu.c is destinated to be removed in most of the case or at least all the soc specific code

Best Regards,
J.

Quoted 9 lines
Quoted 5 lines

There is currently no such file (not even in arm/next), or that's where this would have gone. This function needs to be in a source file that already has strongly-linked symbols or it won't override the weak version in net/eth.c. I'm certainly open to suggestions.

or simply add an entry in the lds this will force the file to be evaluated first

That's not a scalable solution and isn't how we did it with other controllers. If there's no file that's guaranteed to be included in all Davinci boards that will have this MAC, an alternative is to implement board_eth_init() on each board, but IMHO that's worse architecturally.

Quoted 3 lines

Best Regards,
J.

regards,
Ben

#8 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Quoted 34 lines · Ben Warren
Quoted 33 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 31 lines · Ben Warren

Hi J-C,

Jean-Christophe PLAGNIOL-VILLARD wrote:
<snip>

Quoted 15 lines

cpu/arm926ejs/cpu.c static void cache_flush (void) · line 95

Quoted 12 lines
cpu/arm926ejs/cpu.c +11 -0
+/*
+ *  * Initializes on-chip ethernet controllers.
+ *   * to override, implement board_eth_init()
+ *    */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+	dm644x_emac_initialize();
+#endif
+	return 0;
+}

please move this to the soc
arm926ejs/davinci/cpu.c

Quoted 6 lines

the cpu.c is destinated to be removed in most of the case or at least all the soc specific code

Best Regards,
J.

There is currently no such file (not even in arm/next), or that's where this would have gone. This function needs to be in a source file that already has strongly-linked symbols or it won't override the weak version in net/eth.c. I'm certainly open to suggestions.

Quoted 8 lines
Quoted 4 lines

or simply add an entry in the lds this will force the file to be evaluated first

That's not a scalable solution and isn't how we did it with other controllers. If there's no file that's guaranteed to be included in all Davinci boards that will have this MAC, an alternative is to implement board_eth_init() on each board, but IMHO that's worse architecturally.

maybe sync with David

as the clock function could be move to cpu.c it will have the stringly-link function

Best Regards,
J.

#9 lore raw

PATCH 3/3 Switched dm644x_emac Ethernet driver to use newer API

Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

as the clock function could be move to cpu.c it will have the stringly-link function

I'll stuff that in a new cpu.c file, but those
clock status display routines aren't mandatory.

#10 lore raw

PATCH 1/3 Moved Davinci Ethernet driver to drivers/net

In reply to Ben Warren
Quoted 1 line · Ben Warren

?The driver has been renamed dm644x_emac.c

Let me suggest "davinci_emac.c" ... the same controller is in some non-dm644x DaVinci silicon (like dm365), and a gigabit flavor is in the dm6467 chip.

Quoted 4 lines

?

(quoted diff) +1 -1
-COBJS??= timer.o ether.o lxt972.o dp83848.o
+COBJS??= timer.o lxt972.o dp83848.o

?SOBJS??= lowlevel_init.o reset.o

Given the recent cleanups in cpu/arm926ejs/davinci/Makefile, that won't quite apply. I suggest you pull some of the changes from arm-next.

Procedure note: this is exactly why Linux now has a shared "-next" tree ... to make sure interdependencies between development branches can be sorted out before the next merge window, so the merge window can be spent addressing more substantive issues (if any).

author
#11 lore raw

PATCH 1/3 Moved Davinci Ethernet driver to drivers/net

Quoted 11 lines · David Brownell
Quoted 2 lines · Ben Warren

The driver has been renamed dm644x_emac.c

Let me suggest "davinci_emac.c" ... the same controller is in some non-dm644x DaVinci silicon (like dm365), and a gigabit flavor is in the dm6467 chip.

OK. I named it this because the top of the file mentioned it was ripped off from 'dm644x_emac.c' (not Linux)

Quoted 10 lines

cpu/arm926ejs/davinci/Makefile include $(TOPDIR)/config.mk · line 31

Quoted 5 lines
cpu/arm926ejs/davinci/Makefile +1 -1
-COBJS  = timer.o ether.o lxt972.o dp83848.o
+COBJS  = timer.o lxt972.o dp83848.o
 SOBJS  = lowlevel_init.o reset.o

Given the recent cleanups in cpu/arm926ejs/davinci/Makefile, that won't quite apply. I suggest you pull some of the changes from arm-next.

OK, I'll look into that.

Quoted 7 lines

Procedure note: this is exactly why Linux now has a shared "-next" tree ... to make sure interdependencies between development branches can be sorted out before the next merge window, so the merge window can be spent addressing more substantive issues (if any).

Sounds good. I believe there is a 'next' branch on the U-boot mainline, and quite often we do use it, but probably should do so earlier in the process.

Thanks for the help and advice!
Ben

#12 lore raw

cover Davinci Ethernet driver cleanup

In reply to Ben Warren
Quoted 4 lines · Ben Warren

This patch set is an untested attempt at cleaning up the Davinci Ethernet driver. ?Since I don't have any real hardware, I've tried to keep the logical flow as similar to the original as possible and haven't touched any of the hardware access code. ?If anybody's able to test it, please do so.

FYI it passed sanity testing on a dm6446 evm, after updating the first patch to apply against more current cpu/.../davinci code.

- Dave

author
#13 lore raw

cover Davinci Ethernet driver cleanup

Quoted 8 lines · David Brownell
Quoted 5 lines · Ben Warren

This patch set is an untested attempt at cleaning up the Davinci Ethernet driver. Since I don't have any real hardware, I've tried to keep the logical flow as similar to the original as possible and haven't touched any of the hardware access code. If anybody's able to test it, please do so.

Quoted 7 lines

FYI it passed sanity testing on a dm6446 evm, after updating the first patch to apply against more current cpu/.../davinci code.

- Dave

Huh, how 'bout that. What a pleasant surprise!
Thanks a lot Dave.

regards,
Ben

#14 lore raw

cover Davinci Ethernet driver cleanup

In reply to Ben Warren
Quoted 8 lines · Ben Warren

Hello,

This patch set is an untested attempt at cleaning up the Davinci Ethernet driver. Since I don't have any real hardware, I've tried to keep the logical flow as similar to the original as possible and haven't touched any of the hardware access code. If anybody's able to test it, please do so.

Testing consists of 'MAKEALL ARM9' using ELDK 4.1

as this patch will impact a lot of new boards
I've in mind to apply it first and the new boards will use the NET_MULTI API

Best Regards,
J.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#16 lore raw

cover Davinci Ethernet driver cleanup

Hi Sandeep,

Quoted 6 lines · Sandeep

Ben,
DID anybody volunteer to test this or has it already been tested.
HAS the patch been applied to any branch yet. I still see the files in the /cpu/arm926ejs/davinci folder in the u-boot-net git.

I ask because I will need to add support for other DaVinci's to that driver.

Quoted 9 lines

And this patch that I submitted today
[PATCH] DaVinci Network Driver Updates

Is a precursor to that.

Thanks,
Sandeep

David Brownell tested the driver successfully. There has been a bunch of churn regarding the file structure of the Davinci code, and I'm waiting from arm/next to be pulled into main/next before re-basing these patches.

Maybe J-C can give us an idea of when we can expect such a thing...

regards,
Ben

#17 lore raw

cover Davinci Ethernet driver cleanup

Quoted 18 lines · Ben Warren

Hi Sandeep,

Quoted 6 lines · Sandeep

Ben,
DID anybody volunteer to test this or has it already been tested.
HAS the patch been applied to any branch yet. I still see the files in the /cpu/arm926ejs/davinci folder in the u-boot-net git.

I ask because I will need to add support for other DaVinci's to that driver.

Quoted 9 lines

And this patch that I submitted today
[PATCH] DaVinci Network Driver Updates

Is a precursor to that.

Thanks,
Sandeep

Quoted 6 lines

David Brownell tested the driver successfully. There has been a bunch of churn regarding the file structure of the Davinci code, and I'm waiting from arm/next to be pulled into main/next before re-basing these patches.

Maybe J-C can give us an idea of when we can expect such a thing...

It's plan for this WE

Best Regards,
J.