diff options
author | Tom Rini <trini@konsulko.com> | 2020-10-05 10:54:27 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-05 10:54:27 -0400 |
commit | caebff09efe8c061b4d99b82262c67fb2db9bbcf (patch) | |
tree | 24fcdb0737bea1d87c0a36f7eb371017af83e5c2 /board | |
parent | 17e76b33cc0ec2eb2c519b66b6f6c491718e8046 (diff) | |
parent | 01c35f269f21398fa9d1db1b90b73f7e95a3bf22 (diff) | |
download | u-boot-caebff09efe8c061b4d99b82262c67fb2db9bbcf.tar.gz |
Merge tag 'u-boot-atmel-2021.01-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel into nextWIP/05Oct2020-next
First set of u-boot-atmel features for 2021.01 cycle:
This feature set includes a new CPU driver for at91 family, new driver
for PIT64B hardware timer, support for new at91 family SoC named sama7g5
which adds: clock support, including conversion of the clock tree to
CCF; SoC support in mach-at91, pinctrl and mmc drivers update. The
feature set also includes updates for mmc driver and some other minor
fixes and features regarding building without the old Atmel PIT and the
possibility to read a secondary MAC address from a second i2c EEPROM.
Diffstat (limited to 'board')
-rw-r--r-- | board/atmel/common/mac_eeprom.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c index 2205dd30f8..a723ba723c 100644 --- a/board/atmel/common/mac_eeprom.c +++ b/board/atmel/common/mac_eeprom.c @@ -36,3 +36,36 @@ int at91_set_ethaddr(int offset) return 0; } + +/* this function will set eth1addr from a second eeprom, if available */ +int at91_set_eth1addr(int offset) +{ + const int ETH_ADDR_LEN = 6; + unsigned char ethaddr[ETH_ADDR_LEN]; + /* configure eth1addr for second interface */ + const char *ETHADDR_NAME = "eth1addr"; + struct udevice *dev; + int ret; + + if (env_get(ETHADDR_NAME)) + return 0; + + /* first eeprom is retrieved, this is for the first interface */ + ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev); + if (ret) + return ret; + + /* attempt to obtain a second eeprom device */ + ret = uclass_next_device(&dev); + if (ret) + return ret; + + ret = i2c_eeprom_read(dev, offset, ethaddr, 6); + if (ret) + return ret; + + if (is_valid_ethaddr(ethaddr)) + eth_env_set_enetaddr(ETHADDR_NAME, ethaddr); + + return 0; +} |