mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
rockchip: tinker: set ethaddr in late init
Set ethernet mac address in late init for Tinker Board, prevents getting a random mac address each boot. Read mac address from eeprom, first 6 bytes from m24c08@50. Same as /etc/init.d/rockchip.sh on Tinker OS. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8880efbd1f
commit
ecc3bd73b3
|
@ -67,3 +67,10 @@
|
||||||
&gpio8 {
|
&gpio8 {
|
||||||
u-boot,dm-pre-reloc;
|
u-boot,dm-pre-reloc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&i2c2 {
|
||||||
|
m24c08@50 {
|
||||||
|
compatible = "at,24c08", "i2c-eeprom";
|
||||||
|
reg = <0x50>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -5,3 +5,31 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <dm.h>
|
||||||
|
#include <i2c_eeprom.h>
|
||||||
|
#include <netdev.h>
|
||||||
|
|
||||||
|
static int get_ethaddr_from_eeprom(u8 *addr)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct udevice *dev;
|
||||||
|
|
||||||
|
ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return i2c_eeprom_read(dev, 0, addr, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rk_board_late_init(void)
|
||||||
|
{
|
||||||
|
u8 ethaddr[6];
|
||||||
|
|
||||||
|
if (get_ethaddr_from_eeprom(ethaddr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (is_valid_ethaddr(ethaddr))
|
||||||
|
eth_setenv_enetaddr("ethaddr", ethaddr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ CONFIG_CONSOLE_MUX=y
|
||||||
# CONFIG_DISPLAY_CPUINFO is not set
|
# CONFIG_DISPLAY_CPUINFO is not set
|
||||||
CONFIG_SPL_STACK_R=y
|
CONFIG_SPL_STACK_R=y
|
||||||
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
|
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
|
||||||
|
CONFIG_SPL_I2C_SUPPORT=y
|
||||||
# CONFIG_CMD_IMLS is not set
|
# CONFIG_CMD_IMLS is not set
|
||||||
CONFIG_CMD_GPT=y
|
CONFIG_CMD_GPT=y
|
||||||
CONFIG_CMD_MMC=y
|
CONFIG_CMD_MMC=y
|
||||||
|
@ -39,6 +40,8 @@ CONFIG_CLK=y
|
||||||
CONFIG_SPL_CLK=y
|
CONFIG_SPL_CLK=y
|
||||||
CONFIG_ROCKCHIP_GPIO=y
|
CONFIG_ROCKCHIP_GPIO=y
|
||||||
CONFIG_SYS_I2C_ROCKCHIP=y
|
CONFIG_SYS_I2C_ROCKCHIP=y
|
||||||
|
CONFIG_MISC=y
|
||||||
|
CONFIG_I2C_EEPROM=y
|
||||||
CONFIG_MMC_DW=y
|
CONFIG_MMC_DW=y
|
||||||
CONFIG_MMC_DW_ROCKCHIP=y
|
CONFIG_MMC_DW_ROCKCHIP=y
|
||||||
CONFIG_DM_ETH=y
|
CONFIG_DM_ETH=y
|
||||||
|
|
Loading…
Reference in New Issue
Block a user