drivers/net/: get mac address from environment
The environment is the canonical storage location of the mac address, so we're killing off the global data location and moving everything to querying the env directly. The drivers that get converted here: 3c589 4xx_enet dc2114x dm9000x enc28j60 fsl_mcdmafec ks8695eth mcffec rtl8019 rtl8169 s3c4510b_eth xilinx_emac xilinx_emaclite Signed-off-by: Mike Frysinger <vapier@gentoo.org> CC: Ben Warren <biggerbadderben@gmail.com> CC: Rolf Offermanns <rof@sysgo.de> CC: Stefan Roese <sr@denx.de> CC: Sascha Hauer <saschahauer@web.de> CC: TsiChung Liew <Tsi-Chung.Liew@freescale.com> CC: Greg Ungerer <greg.ungerer@opengear.com> CC: Xue Ligong <lgxue@hotmail.com> CC: Masami Komiya <mkomiya@sonare.it> CC: Curt Brune <curt@cucy.com> CC: Michal SIMEK <monstr@monstr.eu>
This commit is contained in:
parent
b6b4625d17
commit
d3f871482f
@ -259,10 +259,13 @@ static void el_reset(bd_t *bd)
|
|||||||
|
|
||||||
/* set mac addr */
|
/* set mac addr */
|
||||||
{
|
{
|
||||||
unsigned char *mac_addr = bd->bi_enetaddr;
|
uchar mac_addr[6];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
el_get_mac_addr( mac_addr );
|
if (!eth_getenv_enetaddr("ethaddr", mac_addr)) {
|
||||||
|
el_get_mac_addr(mac_addr);
|
||||||
|
eth_setenv_enetaddr("ethaddr", mac_addr);
|
||||||
|
}
|
||||||
|
|
||||||
GO_WINDOW(2);
|
GO_WINDOW(2);
|
||||||
VX_BUSY_WAIT;
|
VX_BUSY_WAIT;
|
||||||
|
@ -1927,24 +1927,22 @@ int ppc_4xx_eth_initialize (bd_t * bis)
|
|||||||
memcpy(ethaddr[eth_num], "\0\0\0\0\0\0", 6);
|
memcpy(ethaddr[eth_num], "\0\0\0\0\0\0", 6);
|
||||||
|
|
||||||
for (eth_num = 0; eth_num < LAST_EMAC_NUM; eth_num++) {
|
for (eth_num = 0; eth_num < LAST_EMAC_NUM; eth_num++) {
|
||||||
|
int ethaddr_idx = eth_num + CONFIG_EMAC_NR_START;
|
||||||
switch (eth_num) {
|
switch (eth_num) {
|
||||||
default: /* fall through */
|
default: /* fall through */
|
||||||
case 0:
|
case 0:
|
||||||
memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
|
eth_getenv_enetaddr("ethaddr", ethaddr[ethaddr_idx]);
|
||||||
bis->bi_enetaddr, 6);
|
|
||||||
hw_addr[eth_num] = 0x0;
|
hw_addr[eth_num] = 0x0;
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_HAS_ETH1
|
#ifdef CONFIG_HAS_ETH1
|
||||||
case 1:
|
case 1:
|
||||||
memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
|
eth_getenv_enetaddr("eth1addr", ethaddr[ethaddr_idx]);
|
||||||
bis->bi_enet1addr, 6);
|
|
||||||
hw_addr[eth_num] = 0x100;
|
hw_addr[eth_num] = 0x100;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_HAS_ETH2
|
#ifdef CONFIG_HAS_ETH2
|
||||||
case 2:
|
case 2:
|
||||||
memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
|
eth_getenv_enetaddr("eth2addr", ethaddr[ethaddr_idx]);
|
||||||
bis->bi_enet2addr, 6);
|
|
||||||
#if defined(CONFIG_460GT)
|
#if defined(CONFIG_460GT)
|
||||||
hw_addr[eth_num] = 0x300;
|
hw_addr[eth_num] = 0x300;
|
||||||
#else
|
#else
|
||||||
@ -1954,8 +1952,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_HAS_ETH3
|
#ifdef CONFIG_HAS_ETH3
|
||||||
case 3:
|
case 3:
|
||||||
memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
|
eth_getenv_enetaddr("eth3addr", ethaddr[ethaddr_idx]);
|
||||||
bis->bi_enet3addr, 6);
|
|
||||||
#if defined(CONFIG_460GT)
|
#if defined(CONFIG_460GT)
|
||||||
hw_addr[eth_num] = 0x400;
|
hw_addr[eth_num] = 0x400;
|
||||||
#else
|
#else
|
||||||
|
@ -752,11 +752,14 @@ static void update_srom(struct eth_device *dev, bd_t *bis)
|
|||||||
0x0000, 0x0000, 0x0000, 0x0000, /* 38 */
|
0x0000, 0x0000, 0x0000, 0x0000, /* 38 */
|
||||||
0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
|
0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
|
||||||
};
|
};
|
||||||
|
uchar enetaddr[6];
|
||||||
|
|
||||||
/* Ethernet Addr... */
|
/* Ethernet Addr... */
|
||||||
eeprom[0x0a] = ((bis->bi_enetaddr[1] & 0xff) << 8) | (bis->bi_enetaddr[0] & 0xff);
|
if (!eth_getenv_enetaddr("ethaddr", enetaddr))
|
||||||
eeprom[0x0b] = ((bis->bi_enetaddr[3] & 0xff) << 8) | (bis->bi_enetaddr[2] & 0xff);
|
return;
|
||||||
eeprom[0x0c] = ((bis->bi_enetaddr[5] & 0xff) << 8) | (bis->bi_enetaddr[4] & 0xff);
|
eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
|
||||||
|
eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
|
||||||
|
eeprom[0x0c] = (enetaddr[5] << 8) | enetaddr[4];
|
||||||
|
|
||||||
for (i=0; i<0x40; i++) {
|
for (i=0; i<0x40; i++) {
|
||||||
write_srom(dev, DE4X5_APROM, i, eeprom[i]);
|
write_srom(dev, DE4X5_APROM, i, eeprom[i]);
|
||||||
|
@ -287,6 +287,7 @@ eth_init(bd_t * bd)
|
|||||||
int i, oft, lnk;
|
int i, oft, lnk;
|
||||||
u8 io_mode;
|
u8 io_mode;
|
||||||
struct board_info *db = &dm9000_info;
|
struct board_info *db = &dm9000_info;
|
||||||
|
uchar enetaddr[6];
|
||||||
|
|
||||||
DM9000_DBG("eth_init()\n");
|
DM9000_DBG("eth_init()\n");
|
||||||
|
|
||||||
@ -345,32 +346,19 @@ eth_init(bd_t * bd)
|
|||||||
DM9000_iow(DM9000_ISR, ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS);
|
DM9000_iow(DM9000_ISR, ISR_ROOS | ISR_ROS | ISR_PTS | ISR_PRS);
|
||||||
|
|
||||||
/* Set Node address */
|
/* Set Node address */
|
||||||
|
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
|
||||||
#if !defined(CONFIG_AT91SAM9261EK)
|
#if !defined(CONFIG_AT91SAM9261EK)
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i);
|
enetaddr[i] = read_srom_word(i);
|
||||||
|
eth_setenv_enetaddr("ethaddr", enetaddr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_zero_ether_addr(bd->bi_enetaddr) ||
|
|
||||||
is_multicast_ether_addr(bd->bi_enetaddr)) {
|
|
||||||
/* try reading from environment */
|
|
||||||
u8 i;
|
|
||||||
char *s, *e;
|
|
||||||
s = getenv ("ethaddr");
|
|
||||||
for (i = 0; i < 6; ++i) {
|
|
||||||
bd->bi_enetaddr[i] = s ?
|
|
||||||
simple_strtoul (s, &e, 16) : 0;
|
|
||||||
if (s)
|
|
||||||
s = (*e) ? e + 1 : e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", bd->bi_enetaddr[0],
|
printf("MAC: %pM\n", enetaddr);
|
||||||
bd->bi_enetaddr[1], bd->bi_enetaddr[2], bd->bi_enetaddr[3],
|
|
||||||
bd->bi_enetaddr[4], bd->bi_enetaddr[5]);
|
|
||||||
|
|
||||||
/* fill device MAC address registers */
|
/* fill device MAC address registers */
|
||||||
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
|
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
|
||||||
DM9000_iow(oft, bd->bi_enetaddr[i]);
|
DM9000_iow(oft, enetaddr[i]);
|
||||||
for (i = 0, oft = 0x16; i < 8; i++, oft++)
|
for (i = 0, oft = 0x16; i < 8; i++, oft++)
|
||||||
DM9000_iow(oft, 0xff);
|
DM9000_iow(oft, 0xff);
|
||||||
|
|
||||||
|
@ -330,6 +330,7 @@ static int rxResetCounter = 0;
|
|||||||
int eth_init (bd_t * bis)
|
int eth_init (bd_t * bis)
|
||||||
{
|
{
|
||||||
unsigned char estatVal;
|
unsigned char estatVal;
|
||||||
|
uchar enetaddr[6];
|
||||||
|
|
||||||
/* configure GPIO */
|
/* configure GPIO */
|
||||||
(*((volatile unsigned long *) IO1DIR)) |= ENC_SPI_SLAVE_CS;
|
(*((volatile unsigned long *) IO1DIR)) |= ENC_SPI_SLAVE_CS;
|
||||||
@ -351,7 +352,8 @@ int eth_init (bd_t * bis)
|
|||||||
|
|
||||||
/* initialize controller */
|
/* initialize controller */
|
||||||
encReset ();
|
encReset ();
|
||||||
encInit (bis->bi_enetaddr);
|
eth_getenv_enetaddr("ethaddr", enetaddr);
|
||||||
|
encInit (enetaddr);
|
||||||
|
|
||||||
m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_RXEN); /* enable receive */
|
m_nic_bfs (CTL_REG_ECON1, ENC_ECON1_RXEN); /* enable receive */
|
||||||
|
|
||||||
|
@ -369,6 +369,7 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
|
|||||||
struct fec_info_dma *info = dev->priv;
|
struct fec_info_dma *info = dev->priv;
|
||||||
volatile fecdma_t *fecp = (fecdma_t *) (info->iobase);
|
volatile fecdma_t *fecp = (fecdma_t *) (info->iobase);
|
||||||
int i;
|
int i;
|
||||||
|
uchar enetaddr[6];
|
||||||
|
|
||||||
#ifdef ET_DEBUG
|
#ifdef ET_DEBUG
|
||||||
printf("fec_init: iobase 0x%08x ...\n", info->iobase);
|
printf("fec_init: iobase 0x%08x ...\n", info->iobase);
|
||||||
@ -397,11 +398,11 @@ static int fec_init(struct eth_device *dev, bd_t * bd)
|
|||||||
fecp->eir = 0xffffffff;
|
fecp->eir = 0xffffffff;
|
||||||
|
|
||||||
/* Set station address */
|
/* Set station address */
|
||||||
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
|
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE)
|
||||||
fec_set_hwaddr(fecp, bd->bi_enetaddr);
|
eth_getenv_enetaddr("ethaddr", enetaddr);
|
||||||
} else {
|
else
|
||||||
fec_set_hwaddr(fecp, bd->bi_enet1addr);
|
eth_getenv_enetaddr("eth1addr", enetaddr);
|
||||||
}
|
fec_set_hwaddr(fecp, enetaddr);
|
||||||
|
|
||||||
/* Set Opcode/Pause Duration Register */
|
/* Set Opcode/Pause Duration Register */
|
||||||
fecp->opd = 0x00010020;
|
fecp->opd = 0x00010020;
|
||||||
|
@ -150,13 +150,7 @@ void eth_reset(bd_t *bd)
|
|||||||
ks8695_write(KS8695_LAN_DMA_RX, 0x71);
|
ks8695_write(KS8695_LAN_DMA_RX, 0x71);
|
||||||
ks8695_write(KS8695_LAN_DMA_RX_START, 0x1);
|
ks8695_write(KS8695_LAN_DMA_RX_START, 0x1);
|
||||||
|
|
||||||
printf("KS8695 ETHERNET: ");
|
printf("KS8695 ETHERNET: %pM\n", eth_mac);
|
||||||
for (i = 0; (i < 5); i++) {
|
|
||||||
bd->bi_enetaddr[i] = eth_mac[i];
|
|
||||||
printf("%02x:", eth_mac[i]);
|
|
||||||
}
|
|
||||||
bd->bi_enetaddr[i] = eth_mac[i];
|
|
||||||
printf("%02x\n", eth_mac[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -416,7 +416,7 @@ int fec_init(struct eth_device *dev, bd_t * bd)
|
|||||||
struct fec_info_s *info = dev->priv;
|
struct fec_info_s *info = dev->priv;
|
||||||
volatile fec_t *fecp = (fec_t *) (info->iobase);
|
volatile fec_t *fecp = (fec_t *) (info->iobase);
|
||||||
int i;
|
int i;
|
||||||
u8 *ea = NULL;
|
uchar ea[6];
|
||||||
|
|
||||||
fecpin_setclear(dev, 1);
|
fecpin_setclear(dev, 1);
|
||||||
|
|
||||||
@ -444,25 +444,25 @@ int fec_init(struct eth_device *dev, bd_t * bd)
|
|||||||
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
|
if ((u32) fecp == CONFIG_SYS_FEC0_IOBASE) {
|
||||||
#ifdef CONFIG_SYS_FEC1_IOBASE
|
#ifdef CONFIG_SYS_FEC1_IOBASE
|
||||||
volatile fec_t *fecp1 = (fec_t *) (CONFIG_SYS_FEC1_IOBASE);
|
volatile fec_t *fecp1 = (fec_t *) (CONFIG_SYS_FEC1_IOBASE);
|
||||||
ea = &bd->bi_enet1addr[0];
|
eth_getenv_enetaddr("eth1addr", ea);
|
||||||
fecp1->palr =
|
fecp1->palr =
|
||||||
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
||||||
fecp1->paur = (ea[4] << 24) | (ea[5] << 16);
|
fecp1->paur = (ea[4] << 24) | (ea[5] << 16);
|
||||||
#endif
|
#endif
|
||||||
ea = &bd->bi_enetaddr[0];
|
eth_getenv_enetaddr("ethaddr", ea);
|
||||||
fecp->palr =
|
fecp->palr =
|
||||||
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
||||||
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
|
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_SYS_FEC0_IOBASE
|
#ifdef CONFIG_SYS_FEC0_IOBASE
|
||||||
volatile fec_t *fecp0 = (fec_t *) (CONFIG_SYS_FEC0_IOBASE);
|
volatile fec_t *fecp0 = (fec_t *) (CONFIG_SYS_FEC0_IOBASE);
|
||||||
ea = &bd->bi_enetaddr[0];
|
eth_getenv_enetaddr("ethaddr", ea);
|
||||||
fecp0->palr =
|
fecp0->palr =
|
||||||
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
||||||
fecp0->paur = (ea[4] << 24) | (ea[5] << 16);
|
fecp0->paur = (ea[4] << 24) | (ea[5] << 16);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SYS_FEC1_IOBASE
|
#ifdef CONFIG_SYS_FEC1_IOBASE
|
||||||
ea = &bd->bi_enet1addr[0];
|
eth_getenv_enetaddr("eth1addr", ea);
|
||||||
fecp->palr =
|
fecp->palr =
|
||||||
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
(ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
||||||
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
|
fecp->paur = (ea[4] << 24) | (ea[5] << 16);
|
||||||
|
@ -91,6 +91,7 @@ void eth_halt (void)
|
|||||||
|
|
||||||
int eth_init (bd_t * bd)
|
int eth_init (bd_t * bd)
|
||||||
{
|
{
|
||||||
|
uchar enetaddr[6];
|
||||||
eth_reset ();
|
eth_reset ();
|
||||||
put_reg (RTL8019_COMMAND, RTL8019_PAGE0STOP);
|
put_reg (RTL8019_COMMAND, RTL8019_PAGE0STOP);
|
||||||
put_reg (RTL8019_DATACONFIGURATION, 0x48);
|
put_reg (RTL8019_DATACONFIGURATION, 0x48);
|
||||||
@ -105,12 +106,13 @@ int eth_init (bd_t * bd)
|
|||||||
put_reg (RTL8019_INTERRUPTSTATUS, 0xff);
|
put_reg (RTL8019_INTERRUPTSTATUS, 0xff);
|
||||||
put_reg (RTL8019_INTERRUPTMASK, 0x11); /*b; */
|
put_reg (RTL8019_INTERRUPTMASK, 0x11); /*b; */
|
||||||
put_reg (RTL8019_COMMAND, RTL8019_PAGE1STOP);
|
put_reg (RTL8019_COMMAND, RTL8019_PAGE1STOP);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS0, bd->bi_enetaddr[0]);
|
eth_getenv_enetaddr("ethaddr", enetaddr);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS1, bd->bi_enetaddr[1]);
|
put_reg (RTL8019_PHYSICALADDRESS0, enetaddr[0]);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS2, bd->bi_enetaddr[2]);
|
put_reg (RTL8019_PHYSICALADDRESS1, enetaddr[1]);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS3, bd->bi_enetaddr[3]);
|
put_reg (RTL8019_PHYSICALADDRESS2, enetaddr[2]);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS4, bd->bi_enetaddr[4]);
|
put_reg (RTL8019_PHYSICALADDRESS3, enetaddr[3]);
|
||||||
put_reg (RTL8019_PHYSICALADDRESS5, bd->bi_enetaddr[5]);
|
put_reg (RTL8019_PHYSICALADDRESS4, enetaddr[4]);
|
||||||
|
put_reg (RTL8019_PHYSICALADDRESS5, enetaddr[5]);
|
||||||
put_reg (RTL8019_MULTIADDRESS0, 0x00);
|
put_reg (RTL8019_MULTIADDRESS0, 0x00);
|
||||||
put_reg (RTL8019_MULTIADDRESS1, 0x00);
|
put_reg (RTL8019_MULTIADDRESS1, 0x00);
|
||||||
put_reg (RTL8019_MULTIADDRESS2, 0x00);
|
put_reg (RTL8019_MULTIADDRESS2, 0x00);
|
||||||
|
@ -750,7 +750,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
|
|||||||
|
|
||||||
/* Get MAC address. FIXME: read EEPROM */
|
/* Get MAC address. FIXME: read EEPROM */
|
||||||
for (i = 0; i < MAC_ADDR_LEN; i++)
|
for (i = 0; i < MAC_ADDR_LEN; i++)
|
||||||
bis->bi_enetaddr[i] = dev->enetaddr[i] = RTL_R8(MAC0 + i);
|
dev->enetaddr[i] = RTL_R8(MAC0 + i);
|
||||||
|
|
||||||
#ifdef DEBUG_RTL8169
|
#ifdef DEBUG_RTL8169
|
||||||
printf("chipset = %d\n", tpc->chipset);
|
printf("chipset = %d\n", tpc->chipset);
|
||||||
|
@ -100,7 +100,7 @@ int eth_init(bd_t *bis)
|
|||||||
ETH *eth = &m_eth;
|
ETH *eth = &m_eth;
|
||||||
|
|
||||||
/* store our MAC address */
|
/* store our MAC address */
|
||||||
eth->m_mac = bis->bi_enetaddr;
|
eth_getenv_enetaddr("ethaddr", eth->m_mac);
|
||||||
|
|
||||||
/* setup DBMA and MAC */
|
/* setup DBMA and MAC */
|
||||||
PUT_REG( REG_BDMARXCON, ETH_BRxRS); /* reset BDMA RX machine */
|
PUT_REG( REG_BDMARXCON, ETH_BRxRS); /* reset BDMA RX machine */
|
||||||
|
@ -296,7 +296,7 @@ typedef struct __ETH {
|
|||||||
TX_FrameDescriptor *m_baseTX_FD; /* pointer to base TX frame descriptor */
|
TX_FrameDescriptor *m_baseTX_FD; /* pointer to base TX frame descriptor */
|
||||||
RX_FrameDescriptor *m_curRX_FD; /* pointer to current RX frame descriptor */
|
RX_FrameDescriptor *m_curRX_FD; /* pointer to current RX frame descriptor */
|
||||||
RX_FrameDescriptor *m_baseRX_FD; /* pointer to base RX frame descriptor */
|
RX_FrameDescriptor *m_baseRX_FD; /* pointer to base RX frame descriptor */
|
||||||
u8 *m_mac; /* pointer to our MAC address */
|
u8 m_mac[6]; /* pointer to our MAC address */
|
||||||
} ETH;
|
} ETH;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,6 +166,7 @@ void eth_halt(void)
|
|||||||
|
|
||||||
int eth_init(bd_t * bis)
|
int eth_init(bd_t * bis)
|
||||||
{
|
{
|
||||||
|
uchar enetaddr[6];
|
||||||
u32 helpreg;
|
u32 helpreg;
|
||||||
debug ("EMAC Initialization Started\n\r");
|
debug ("EMAC Initialization Started\n\r");
|
||||||
|
|
||||||
@ -200,15 +201,16 @@ int eth_init(bd_t * bis)
|
|||||||
helpreg &= ~(XEM_ECR_XMIT_ENABLE_MASK | XEM_ECR_RECV_ENABLE_MASK);
|
helpreg &= ~(XEM_ECR_XMIT_ENABLE_MASK | XEM_ECR_RECV_ENABLE_MASK);
|
||||||
out_be32 (emac.baseaddress + XEM_ECR_OFFSET, helpreg);
|
out_be32 (emac.baseaddress + XEM_ECR_OFFSET, helpreg);
|
||||||
|
|
||||||
if (!getenv("ethaddr")) {
|
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
|
||||||
memcpy(bis->bi_enetaddr, emacaddr, ENET_ADDR_LENGTH);
|
memcpy(enetaddr, emacaddr, ENET_ADDR_LENGTH);
|
||||||
|
eth_setenv_enetaddr("ethaddr", enetaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the device station address high and low registers */
|
/* Set the device station address high and low registers */
|
||||||
helpreg = (bis->bi_enetaddr[0] << 8) | bis->bi_enetaddr[1];
|
helpreg = (enetaddr[0] << 8) | enetaddr[1];
|
||||||
out_be32 (emac.baseaddress + XEM_SAH_OFFSET, helpreg);
|
out_be32 (emac.baseaddress + XEM_SAH_OFFSET, helpreg);
|
||||||
helpreg = (bis->bi_enetaddr[2] << 24) | (bis->bi_enetaddr[3] << 16) |
|
helpreg = (enetaddr[2] << 24) | (enetaddr[3] << 16) |
|
||||||
(bis->bi_enetaddr[4] << 8) | bis->bi_enetaddr[5];
|
(enetaddr[4] << 8) | enetaddr[5];
|
||||||
out_be32 (emac.baseaddress + XEM_SAL_OFFSET, helpreg);
|
out_be32 (emac.baseaddress + XEM_SAL_OFFSET, helpreg);
|
||||||
|
|
||||||
helpreg = XEM_ECR_UNICAST_ENABLE_MASK | XEM_ECR_BROAD_ENABLE_MASK |
|
helpreg = XEM_ECR_UNICAST_ENABLE_MASK | XEM_ECR_BROAD_ENABLE_MASK |
|
||||||
|
@ -140,12 +140,15 @@ void eth_halt (void)
|
|||||||
|
|
||||||
int eth_init (bd_t * bis)
|
int eth_init (bd_t * bis)
|
||||||
{
|
{
|
||||||
|
uchar enetaddr[6];
|
||||||
|
|
||||||
debug ("EmacLite Initialization Started\n");
|
debug ("EmacLite Initialization Started\n");
|
||||||
memset (&emaclite, 0, sizeof (xemaclite));
|
memset (&emaclite, 0, sizeof (xemaclite));
|
||||||
emaclite.baseaddress = XILINX_EMACLITE_BASEADDR;
|
emaclite.baseaddress = XILINX_EMACLITE_BASEADDR;
|
||||||
|
|
||||||
if (!getenv("ethaddr")) {
|
if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
|
||||||
memcpy(bis->bi_enetaddr, emacaddr, ENET_ADDR_LENGTH);
|
memcpy(enetaddr, emacaddr, ENET_ADDR_LENGTH);
|
||||||
|
eth_setenv_enetaddr("ethaddr", enetaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -154,7 +157,7 @@ int eth_init (bd_t * bis)
|
|||||||
/* Restart PING TX */
|
/* Restart PING TX */
|
||||||
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET, 0);
|
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET, 0);
|
||||||
/* Copy MAC address */
|
/* Copy MAC address */
|
||||||
xemaclite_alignedwrite (bis->bi_enetaddr,
|
xemaclite_alignedwrite (enetaddr,
|
||||||
emaclite.baseaddress, ENET_ADDR_LENGTH);
|
emaclite.baseaddress, ENET_ADDR_LENGTH);
|
||||||
/* Set the length */
|
/* Set the length */
|
||||||
out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH);
|
out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH);
|
||||||
@ -167,7 +170,7 @@ int eth_init (bd_t * bis)
|
|||||||
#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
|
#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
|
||||||
/* The same operation with PONG TX */
|
/* The same operation with PONG TX */
|
||||||
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, 0);
|
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET, 0);
|
||||||
xemaclite_alignedwrite (bis->bi_enetaddr, emaclite.baseaddress +
|
xemaclite_alignedwrite (enetaddr, emaclite.baseaddress +
|
||||||
XEL_BUFFER_OFFSET, ENET_ADDR_LENGTH);
|
XEL_BUFFER_OFFSET, ENET_ADDR_LENGTH);
|
||||||
out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH);
|
out_be32 (emaclite.baseaddress + XEL_TPLR_OFFSET, ENET_ADDR_LENGTH);
|
||||||
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET,
|
out_be32 (emaclite.baseaddress + XEL_TSR_OFFSET + XEL_BUFFER_OFFSET,
|
||||||
|
Loading…
Reference in New Issue
Block a user