summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/davinci/common/misc.h1
-rw-r--r--board/davinci/dvevm/dvevm.c3
-rw-r--r--board/davinci/schmoogie/schmoogie.c3
-rw-r--r--board/davinci/sffsdr/sffsdr.c3
-rw-r--r--board/davinci/sonata/sonata.c3
-rw-r--r--cpu/arm926ejs/davinci/cpu.c12
-rw-r--r--drivers/net/davinci_emac.c70
-rw-r--r--include/configs/davinci_dvevm.h1
-rw-r--r--include/configs/davinci_schmoogie.h1
-rw-r--r--include/configs/davinci_sffsdr.h1
-rw-r--r--include/configs/davinci_sonata.h1
-rw-r--r--include/netdev.h1
-rw-r--r--net/eth.c4
13 files changed, 41 insertions, 63 deletions
diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 316159a2f7..dc3cc41330 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -22,7 +22,6 @@
#ifndef __MISC_H
#define __MISC_H
-extern int eth_hw_init(void);
int dvevm_read_mac_address(uint8_t *buf);
void dv_configure_mac_address(uint8_t *rom_enetaddr);
diff --git a/board/davinci/dvevm/dvevm.c b/board/davinci/dvevm/dvevm.c
index 8f386331e6..98937a9620 100644
--- a/board/davinci/dvevm/dvevm.c
+++ b/board/davinci/dvevm/dvevm.c
@@ -73,9 +73,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"));
diff --git a/board/davinci/schmoogie/schmoogie.c b/board/davinci/schmoogie/schmoogie.c
index 6e0f591335..19c95809aa 100644
--- a/board/davinci/schmoogie/schmoogie.c
+++ b/board/davinci/schmoogie/schmoogie.c
@@ -130,8 +130,5 @@ int misc_init_r(void)
forceenv("serial#", (char *)&tmp[0]);
}
- if (!eth_hw_init())
- printf("ethernet init failed!\n");
-
return(0);
}
diff --git a/board/davinci/sffsdr/sffsdr.c b/board/davinci/sffsdr/sffsdr.c
index 7f4ee361bb..c24b9e188c 100644
--- a/board/davinci/sffsdr/sffsdr.c
+++ b/board/davinci/sffsdr/sffsdr.c
@@ -143,8 +143,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);
}
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c
index a0bea05177..7f9d9bba3d 100644
--- a/board/davinci/sonata/sonata.c
+++ b/board/davinci/sonata/sonata.c
@@ -70,8 +70,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);
}
diff --git a/cpu/arm926ejs/davinci/cpu.c b/cpu/arm926ejs/davinci/cpu.c
index 29aead6f4f..390cab8a20 100644
--- a/cpu/arm926ejs/davinci/cpu.c
+++ b/cpu/arm926ejs/davinci/cpu.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/arch/hardware.h>
@@ -129,3 +130,14 @@ int print_cpuinfo(void)
#endif
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int cpu_eth_init(bd_t *bis)
+{
+#if defined(CONFIG_DRIVER_TI_EMAC)
+ davinci_emac_initialize();
+#endif
+ return 0;
+}
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index f5cec0547c..fa8cee4d2e 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -40,17 +40,12 @@
#include <command.h>
#include <net.h>
#include <miiphy.h>
+#include <malloc.h>
#include <asm/arch/emac_defs.h>
unsigned int emac_dbg = 0;
#define debug_emac(fmt,args...) if (emac_dbg) printf(fmt,##args)
-/* Internal static functions */
-static int davinci_eth_hw_init (void);
-static int davinci_eth_open (void);
-static int davinci_eth_close (void);
-static int davinci_eth_send_packet (volatile void *packet, int length);
-static int davinci_eth_rcv_packet (void);
static void davinci_eth_mdio_enable(void);
static int gen_init_phy(int phy_addr);
@@ -58,38 +53,10 @@ static int gen_is_phy_connected(int phy_addr);
static int gen_get_link_speed(int phy_addr);
static int gen_auto_negotiate(int phy_addr);
-/* Wrappers exported to the U-Boot proper */
-int eth_hw_init(void)
-{
- return(davinci_eth_hw_init());
-}
-
-int eth_init(bd_t * bd)
-{
- return(davinci_eth_open());
-}
-
-void eth_halt(void)
-{
- davinci_eth_close();
-}
-
-int eth_send(volatile void *packet, int length)
-{
- return(davinci_eth_send_packet(packet, length));
-}
-
-int eth_rx(void)
-{
- return(davinci_eth_rcv_packet());
-}
-
void eth_mdio_enable(void)
{
davinci_eth_mdio_enable();
}
-/* End of wrappers */
-
static u_int8_t davinci_eth_mac_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -279,17 +246,11 @@ static int davinci_mii_phy_write(char *devname, unsigned char addr, unsigned cha
return(davinci_eth_phy_write(addr, reg, value) ? 0 : 1);
}
-int davinci_eth_miiphy_initialize(bd_t *bis)
-{
- miiphy_register(phy.name, davinci_mii_phy_read, davinci_mii_phy_write);
-
- return(1);
-}
#endif
/* Eth device open */
-static int davinci_eth_open(void)
+static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
{
dv_reg_p addr;
u_int32_t clkdiv, cnt;
@@ -441,7 +402,7 @@ static void davinci_eth_ch_teardown(int ch)
}
/* Eth device close */
-static int davinci_eth_close(void)
+static void davinci_eth_close(struct eth_device *dev)
{
debug_emac("+ emac_close\n");
@@ -453,7 +414,6 @@ static int davinci_eth_close(void)
adap_ewrap->EWCTL = 0;
debug_emac("- emac_close\n");
- return(1);
}
static int tx_send_loop = 0;
@@ -462,7 +422,8 @@ static int tx_send_loop = 0;
* This function sends a single packet on the network and returns
* positive number (number of bytes transmitted) or negative for error
*/
-static int davinci_eth_send_packet (volatile void *packet, int length)
+static int davinci_eth_send_packet (struct eth_device *dev,
+ volatile void *packet, int length)
{
int ret_status = -1;
@@ -509,7 +470,7 @@ static int davinci_eth_send_packet (volatile void *packet, int length)
/*
* This function handles receipt of a packet from the network
*/
-static int davinci_eth_rcv_packet (void)
+static int davinci_eth_rcv_packet (struct eth_device *dev)
{
volatile emac_desc *rx_curr_desc;
volatile emac_desc *curr_desc;
@@ -580,11 +541,27 @@ static int davinci_eth_rcv_packet (void)
* 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)
+int davinci_emac_initialize(void)
{
u_int32_t phy_id;
u_int16_t tmp;
int i;
+ struct eth_device *dev;
+
+ dev = malloc(sizeof *dev);
+
+ if (dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof *dev);
+
+ dev->iobase = 0;
+ dev->init = davinci_eth_open;
+ dev->halt = davinci_eth_close;
+ dev->send = davinci_eth_send_packet;
+ dev->recv = davinci_eth_rcv_packet;
+
+ eth_register(dev);
davinci_eth_mdio_enable();
@@ -643,5 +620,6 @@ static int davinci_eth_hw_init(void)
printf("Ethernet PHY: %s\n", phy.name);
+ miiphy_register(phy.name, davinci_mii_phy_read, davinci_mii_phy_write);
return(1);
}
diff --git a/include/configs/davinci_dvevm.h b/include/configs/davinci_dvevm.h
index 6c5d065088..96b6afc351 100644
--- a/include/configs/davinci_dvevm.h
+++ b/include/configs/davinci_dvevm.h
@@ -109,6 +109,7 @@
#define CONFIG_BOOTP_DNS2
#define CONFIG_BOOTP_SEND_HOSTNAME
#define CONFIG_NET_RETRY_COUNT 10
+#define CONFIG_NET_MULTI
/*=====================*/
/* Flash & Environment */
/*=====================*/
diff --git a/include/configs/davinci_schmoogie.h b/include/configs/davinci_schmoogie.h
index 6612cb3cbb..9cb9838b5a 100644
--- a/include/configs/davinci_schmoogie.h
+++ b/include/configs/davinci_schmoogie.h
@@ -77,6 +77,7 @@
#define CONFIG_BOOTP_SEND_HOSTNAME
#define CONFIG_NET_RETRY_COUNT 10
#define CONFIG_OVERWRITE_ETHADDR_ONCE
+#define CONFIG_NET_MULTI
/*=====================*/
/* Flash & Environment */
/*=====================*/
diff --git a/include/configs/davinci_sffsdr.h b/include/configs/davinci_sffsdr.h
index 6c1dc117de..a47620fca8 100644
--- a/include/configs/davinci_sffsdr.h
+++ b/include/configs/davinci_sffsdr.h
@@ -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
diff --git a/include/configs/davinci_sonata.h b/include/configs/davinci_sonata.h
index 893729c6f2..82901b3933 100644
--- a/include/configs/davinci_sonata.h
+++ b/include/configs/davinci_sonata.h
@@ -109,6 +109,7 @@
#define CONFIG_BOOTP_DNS2
#define CONFIG_BOOTP_SEND_HOSTNAME
#define CONFIG_NET_RETRY_COUNT 10
+#define CONFIG_NET_MULTI
/*=====================*/
/* Flash & Environment */
/*=====================*/
diff --git a/include/netdev.h b/include/netdev.h
index 4f2b23a5a0..df3bc6341f 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -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 davinci_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);
diff --git a/net/eth.c b/net/eth.c
index 8940ebf117..eb218b63e0 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -504,7 +504,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)
@@ -525,9 +524,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