Merge branch 'master' of jbe@octopus:/home/git/projects/u-boot-v2
This commit is contained in:
commit
d8eae58a2a
|
@ -236,13 +236,13 @@ int at91rm9200_miiphy_initialize(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int at91rm9200_get_mac_address(struct eth_device *eth, unsigned char *adr)
|
||||
static int at91rm9200_get_ethaddr(struct eth_device *eth, unsigned char *adr)
|
||||
{
|
||||
/* We have no eeprom */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int at91rm9200_set_mac_address(struct eth_device *eth, unsigned char *adr)
|
||||
static int at91rm9200_set_ethaddr(struct eth_device *eth, unsigned char *adr)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -271,8 +271,8 @@ static int at91rm9200_eth_init (struct device_d *dev)
|
|||
edev->send = at91rm9200_eth_send;
|
||||
edev->recv = at91rm9200_eth_rx;
|
||||
edev->halt = at91rm9200_eth_halt;
|
||||
edev->get_mac_address = at91rm9200_get_mac_address;
|
||||
edev->set_mac_address = at91rm9200_set_mac_address;
|
||||
edev->get_ethaddr = at91rm9200_get_ethaddr;
|
||||
edev->set_ethaddr = at91rm9200_set_ethaddr;
|
||||
|
||||
p_mac = AT91C_BASE_EMAC;
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ static u16 read_srom_word(struct dm9000_priv *priv, int offset)
|
|||
return (DM9000_ior(priv, DM9000_EPDRL) + (DM9000_ior(priv, DM9000_EPDRH) << 8));
|
||||
}
|
||||
|
||||
static int dm9000_get_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int dm9000_get_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
struct dm9000_priv *priv = (struct dm9000_priv *)edev->priv;
|
||||
int i;
|
||||
|
@ -442,12 +442,12 @@ static int dm9000_get_mac_address(struct eth_device *edev, unsigned char *adr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dm9000_set_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int dm9000_set_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
struct dm9000_priv *priv = (struct dm9000_priv *)edev->priv;
|
||||
int i, oft;
|
||||
|
||||
debug("dm9000_set_mac_address\n");
|
||||
debug("%s\n", __FUNCTION__);
|
||||
|
||||
for (i = 0, oft = 0x10; i < 6; i++, oft++)
|
||||
DM9000_iow(priv, oft, adr[i]);
|
||||
|
@ -499,8 +499,8 @@ static int dm9000_probe(struct device_d *dev)
|
|||
edev->send = dm9000_eth_send;
|
||||
edev->recv = dm9000_eth_rx;
|
||||
edev->halt = dm9000_eth_halt;
|
||||
edev->get_mac_address = dm9000_get_mac_address;
|
||||
edev->set_mac_address = dm9000_set_mac_address;
|
||||
edev->get_ethaddr = dm9000_get_ethaddr;
|
||||
edev->set_ethaddr = dm9000_set_ethaddr;
|
||||
|
||||
/* RESET device */
|
||||
dm9000_reset(priv);
|
||||
|
|
|
@ -210,13 +210,13 @@ static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec)
|
|||
}
|
||||
}
|
||||
|
||||
static int mpc5xxx_fec_get_hwaddr(struct eth_device *dev, unsigned char *mac)
|
||||
static int mpc5xxx_fec_get_ethaddr(struct eth_device *dev, unsigned char *mac)
|
||||
{
|
||||
/* no eeprom */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int mpc5xxx_fec_set_hwaddr(struct eth_device *dev, unsigned char *mac)
|
||||
static int mpc5xxx_fec_set_ethaddr(struct eth_device *dev, unsigned char *mac)
|
||||
{
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
uint8 currByte; /* byte for which to compute the CRC */
|
||||
|
@ -682,8 +682,8 @@ int mpc5xxx_fec_probe(struct device_d *dev)
|
|||
edev->send = mpc5xxx_fec_send,
|
||||
edev->recv = mpc5xxx_fec_recv,
|
||||
edev->halt = mpc5xxx_fec_halt,
|
||||
edev->get_mac_address = mpc5xxx_fec_get_hwaddr,
|
||||
edev->set_mac_address = mpc5xxx_fec_set_hwaddr,
|
||||
edev->get_ethaddr = mpc5xxx_fec_ethaddr,
|
||||
edev->set_ethaddr = mpc5xxx_fec_ethaddr,
|
||||
|
||||
fec->eth = (ethernet_regs *)dev->map_base;
|
||||
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
|
||||
|
|
|
@ -202,18 +202,18 @@ static void netx_eth_halt (struct eth_device *edev)
|
|||
{
|
||||
}
|
||||
|
||||
static int netx_eth_get_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int netx_eth_get_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
/* FIXME: get from crypto flash */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int netx_eth_set_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int netx_eth_set_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
struct netx_eth_priv *priv = (struct netx_eth_priv *)edev->priv;
|
||||
int xcno = priv->xcno;
|
||||
|
||||
debug("netx_eth_set_mac_address\n");
|
||||
debug("%s\n", __FUNCTION__);
|
||||
|
||||
/* set MAC address */
|
||||
XMAC_REG(xcno, XMAC_RPU_HOLD_PC) = RPU_HOLD_PC;
|
||||
|
@ -257,8 +257,8 @@ static int netx_eth_probe(struct device_d *dev)
|
|||
edev->send = netx_eth_send;
|
||||
edev->recv = netx_eth_rx;
|
||||
edev->halt = netx_eth_halt;
|
||||
edev->get_mac_address = netx_eth_get_mac_address;
|
||||
edev->set_mac_address = netx_eth_set_mac_address;
|
||||
edev->get_ethaddr = netx_eth_get_ethaddr;
|
||||
edev->set_ethaddr = netx_eth_set_ethaddr;
|
||||
|
||||
priv->miiphy.read = netx_miiphy_read;
|
||||
priv->miiphy.write = netx_miiphy_write;
|
||||
|
|
|
@ -424,7 +424,7 @@ static void smc911x_set_mac_csr(struct eth_device *edev, u8 reg, u32 data)
|
|||
smc911x_mac_wait_busy(priv);
|
||||
}
|
||||
|
||||
static int smc911x_get_mac_address(struct eth_device *edev, unsigned char *m)
|
||||
static int smc911x_get_ethaddr(struct eth_device *edev, unsigned char *m)
|
||||
{
|
||||
unsigned long addrh, addrl;
|
||||
|
||||
|
@ -445,7 +445,7 @@ static int smc911x_get_mac_address(struct eth_device *edev, unsigned char *m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int smc911x_set_mac_address(struct eth_device *edev, unsigned char *m)
|
||||
static int smc911x_set_ethaddr(struct eth_device *edev, unsigned char *m)
|
||||
{
|
||||
unsigned long addrh, addrl;
|
||||
|
||||
|
@ -719,8 +719,8 @@ static int smc911x_probe(struct device_d *dev)
|
|||
edev->send = smc911x_eth_send;
|
||||
edev->recv = smc911x_eth_rx;
|
||||
edev->halt = smc911x_eth_halt;
|
||||
edev->get_mac_address = smc911x_get_mac_address;
|
||||
edev->set_mac_address = smc911x_set_mac_address;
|
||||
edev->get_ethaddr = smc911x_get_ethaddr;
|
||||
edev->set_ethaddr = smc911x_set_ethaddr;
|
||||
|
||||
priv->miiphy.read = smc911x_phy_read;
|
||||
priv->miiphy.write = smc911x_phy_write;
|
||||
|
|
|
@ -63,12 +63,12 @@ void tap_eth_halt (struct eth_device *edev)
|
|||
/* nothing to do here */
|
||||
}
|
||||
|
||||
static int tap_get_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int tap_get_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int tap_set_mac_address(struct eth_device *edev, unsigned char *adr)
|
||||
static int tap_set_ethaddr(struct eth_device *edev, unsigned char *adr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ int tap_probe(struct device_d *dev)
|
|||
edev->send = tap_eth_send;
|
||||
edev->recv = tap_eth_rx;
|
||||
edev->halt = tap_eth_halt;
|
||||
edev->get_mac_address = tap_get_mac_address;
|
||||
edev->set_mac_address = tap_set_mac_address;
|
||||
edev->get_ethaddr = tap_get_ethaddr;
|
||||
edev->set_ethaddr = tap_set_ethaddr;
|
||||
|
||||
eth_register(edev);
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ struct eth_device {
|
|||
int (*send) (struct eth_device*, void *packet, int length);
|
||||
int (*recv) (struct eth_device*);
|
||||
void (*halt) (struct eth_device*);
|
||||
int (*get_mac_address) (struct eth_device*, unsigned char *adr);
|
||||
int (*set_mac_address) (struct eth_device*, unsigned char *adr);
|
||||
int (*get_ethaddr) (struct eth_device*, unsigned char *adr);
|
||||
int (*set_ethaddr) (struct eth_device*, unsigned char *adr);
|
||||
|
||||
struct eth_device *next;
|
||||
void *priv;
|
||||
|
@ -75,7 +75,7 @@ struct eth_device {
|
|||
struct param_d param_netmask;
|
||||
struct param_d param_gateway;
|
||||
struct param_d param_serverip;
|
||||
struct param_d param_mac;
|
||||
struct param_d param_ethaddr;
|
||||
|
||||
struct device_d *dev;
|
||||
};
|
||||
|
@ -88,7 +88,7 @@ void eth_try_another(int first_restart); /* Change the device */
|
|||
struct eth_device *eth_get_dev(void); /* get the current device MAC */
|
||||
struct eth_device *eth_get_dev_by_name(char *devname); /* get device */
|
||||
int eth_get_dev_index (void); /* get the device index */
|
||||
void eth_set_enetaddr(int num, char* a); /* Set new MAC address */
|
||||
void eth_set_ethaddr(int num, char* a); /* Set new MAC address */
|
||||
|
||||
int eth_open(void); /* open the device */
|
||||
int eth_send(void *packet, int length); /* Send a packet */
|
||||
|
@ -424,8 +424,8 @@ IPaddr_t getenv_IPaddr (char *);
|
|||
/* read a VLAN id from an environment variable */
|
||||
ushort getenv_VLAN(char *);
|
||||
|
||||
int string_to_enet_addr(const char *str, char *enetaddr);
|
||||
void enet_addr_to_string(const unsigned char *enetaddr, char *str);
|
||||
int string_to_ethaddr(const char *str, char *enetaddr);
|
||||
void ethaddr_to_string(const unsigned char *enetaddr, char *str);
|
||||
|
||||
/**********************************************************************/
|
||||
/* Network devices */
|
||||
|
|
16
net/eth.c
16
net/eth.c
|
@ -49,9 +49,9 @@ int eth_open(void)
|
|||
if (!eth_current)
|
||||
return 0;
|
||||
|
||||
string_to_enet_addr(dev_get_param(eth_current->dev, "mac"), mac);
|
||||
string_to_ethaddr(dev_get_param(eth_current->dev, "ethaddr"), mac);
|
||||
|
||||
eth_current->set_mac_address(eth_current, mac);
|
||||
eth_current->set_ethaddr(eth_current, mac);
|
||||
|
||||
eth_current->open(eth_current);
|
||||
|
||||
|
@ -90,26 +90,26 @@ int eth_register(struct eth_device *edev)
|
|||
unsigned char ethaddr_str[20];
|
||||
unsigned char ethaddr[6];
|
||||
|
||||
if (!edev->get_mac_address) {
|
||||
if (!edev->get_ethaddr) {
|
||||
printf("no get_mac_address found for current eth device\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
edev->param_ip.name = "ip";
|
||||
edev->param_mac.name = "mac";
|
||||
edev->param_ethaddr.name = "ethaddr";
|
||||
edev->param_gateway.name = "gateway";
|
||||
edev->param_netmask.name = "netmask";
|
||||
edev->param_serverip.name = "serverip";
|
||||
dev_add_param(dev, &edev->param_ip);
|
||||
dev_add_param(dev, &edev->param_mac);
|
||||
dev_add_param(dev, &edev->param_ethaddr);
|
||||
dev_add_param(dev, &edev->param_gateway);
|
||||
dev_add_param(dev, &edev->param_netmask);
|
||||
dev_add_param(dev, &edev->param_serverip);
|
||||
|
||||
if (edev->get_mac_address(edev, ethaddr) == 0) {
|
||||
enet_addr_to_string(ethaddr, ethaddr_str);
|
||||
if (edev->get_ethaddr(edev, ethaddr) == 0) {
|
||||
ethaddr_to_string(ethaddr, ethaddr_str);
|
||||
printf("got MAC address from EEPROM: %s\n",ethaddr_str);
|
||||
dev_set_param(dev, "mac", ethaddr_str);
|
||||
dev_set_param(dev, "ethaddr", ethaddr_str);
|
||||
// memcpy(edev->enetaddr, ethaddr, 6);
|
||||
}
|
||||
|
||||
|
|
11
net/net.c
11
net/net.c
|
@ -258,6 +258,11 @@ NetLoop(proto_t protocol)
|
|||
struct eth_device *eth_current = eth_get_current();
|
||||
IPaddr_t ip;
|
||||
|
||||
if (!eth_current) {
|
||||
printf("Current ethernet device not set!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ip = dev_get_param_ip(eth_current->dev, "ip");
|
||||
NetCopyIP(&NetOurIP, &ip);
|
||||
|
||||
|
@ -291,7 +296,7 @@ NetLoop(proto_t protocol)
|
|||
return -1;
|
||||
|
||||
restart:
|
||||
string_to_enet_addr(dev_get_param(eth_get_current()->dev, "mac"),
|
||||
string_to_ethaddr(dev_get_param(eth_get_current()->dev, "ethaddr"),
|
||||
NetOurEther);
|
||||
|
||||
NetState = NETLOOP_CONTINUE;
|
||||
|
@ -1569,7 +1574,7 @@ ushort getenv_VLAN(char *var)
|
|||
return (string_to_VLAN(getenv(var)));
|
||||
}
|
||||
|
||||
int string_to_enet_addr(const char *str, char *enetaddr)
|
||||
int string_to_ethaddr(const char *str, char *enetaddr)
|
||||
{
|
||||
ulong reg;
|
||||
char *e;
|
||||
|
@ -1589,7 +1594,7 @@ int string_to_enet_addr(const char *str, char *enetaddr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void enet_addr_to_string(const unsigned char *enetaddr, char *str)
|
||||
void ethaddr_to_string(const unsigned char *enetaddr, char *str)
|
||||
{
|
||||
sprintf (str, "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
|
||||
|
|
Loading…
Reference in New Issue