Below is u-boot patch for Banana Pi. In boards.cfg, modified the STATUSLED to 248 to fit the user defined led on Banana Pi. In boards.c, in original code the uboot will set the mac address only once when the board is first boot up. Then if we insert the SD card into another board, the mac address will not change, and remain the same mac address with the last board. So we need check the mac address every time, in case of we change the SD card into another board.
>From 80eb21ef267321caed79927f914ec26a9a1d385b Mon Sep 17 00:00:00 2001 From: Tony Zhang <[email protected]> Date: Sun, 28 Sep 2014 16:05:00 +0800 Subject: [PATCH] Fix the mac address can only set one time at the first time the SD card is insert into Banana Pi. Change the status led to the right PIN PH24. Signed-off-by: Tony Zhang <[email protected]> --- board/sunxi/board.c | 28 ++++++++++++++++++++++++++++ boards.cfg | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 0f37d8d..a3ba4da 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -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; } diff --git a/boards.cfg b/boards.cfg index ebac426..a9e98c1 100644 --- a/boards.cfg +++ b/boards.cfg @@ -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 - -- 1.7.9.5 Tony Zhang -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
