2 * Copyright (C) 2017 Microchip
3 * Wenyou Yang <wenyou.yang@microchip.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <i2c_eeprom.h>
13 int at91_set_ethaddr(int offset)
15 const int ETH_ADDR_LEN = 6;
16 unsigned char ethaddr[ETH_ADDR_LEN];
17 const char *ETHADDR_NAME = "ethaddr";
21 if (env_get(ETHADDR_NAME))
24 ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
28 ret = i2c_eeprom_read(dev, offset, ethaddr, 6);
32 if (is_valid_ethaddr(ethaddr))
33 eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);