Skip to content

Commit

Permalink
Fix the mac address can only set one time at the first time the SD ca…
Browse files Browse the repository at this point in the history
…rd is insert into Banana Pi.

Change the status led to the right PIN PH24.

Signed-off-by: Tony Zhang <[email protected]>
  • Loading branch information
Tony-HIT committed Sep 28, 2014
1 parent 9b6b718 commit 80eb21e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions board/sunxi/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,34 @@ int misc_init_r(void)
eth_setenv_enetaddr("ethaddr", mac_addr);
}
}
#ifdef CONFIG_BANANAPI
else {
unsigned char *p;
p = getenv("ethaddr");
uint32_t reg_val = readl(SUNXI_SID_BASE);

if (reg_val) {
uint8_t mac_addr[6];
int i;

mac_addr[0] = 0x02; /* Non OUI / registered MAC address */
mac_addr[1] = (reg_val >> 0) & 0xff;
reg_val = readl(SUNXI_SID_BASE + 0x0c);
mac_addr[2] = (reg_val >> 24) & 0xff;
mac_addr[3] = (reg_val >> 16) & 0xff;
mac_addr[4] = (reg_val >> 8) & 0xff;
mac_addr[5] = (reg_val >> 0) & 0xff;

for(i = 0; i < 6; i ++)
{
if(mac_addr[i] != *(p + i)){
eth_setenv_enetaddr("ethaddr", mac_addr);
break;
}
}
}
}
#endif

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions boards.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ Active arm armv7 sunxi - sunxi
Active arm armv7 sunxi - sunxi Auxtek-T003 sun5i:AUXTEK_T003,SPL,AXP152_POWER,STATUSLED=34 -
Active arm armv7 sunxi - sunxi Auxtek-T004 sun5i:AUXTEK_T004,SPL,AXP152_POWER,STATUSLED=34 -
Active arm armv7 sunxi - sunxi ba10_tv_box sun4i:BA10_TV_BOX,SPL,SUNXI_EMAC -
Active arm armv7 sunxi - sunxi Bananapi sun7i:BANANAPI,SPL,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),STATUSLED=244,STATUSLED1=245,FAST_MBUS -
Active arm armv7 sunxi - sunxi Bananapi_FEL sun7i:BANANAPI,SPL_FEL,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),STATUSLED=244,STATUSLED1=245,FAST_MBUS -
Active arm armv7 sunxi - sunxi Bananapi sun7i:BANANAPI,SPL,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),STATUSLED=248,FAST_MBUS -
Active arm armv7 sunxi - sunxi Bananapi_FEL sun7i:BANANAPI,SPL_FEL,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),STATUSLED=248,FAST_MBUS -
Active arm armv7 sunxi - sunxi Coby_MID7042 sun4i:COBY_MID7042,SPL -
Active arm armv7 sunxi - sunxi Coby_MID8042 sun4i:COBY_MID8042,SPL -
Active arm armv7 sunxi - sunxi Coby_MID9742 sun4i:COBY_MID9742,SPL -
Expand Down

0 comments on commit 80eb21e

Please sign in to comment.