upstream u-boot with additional patches for our devices/boards:
https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ;
Gbit ethernet patch for some LIME2 revisions ;
with SPI flash support
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
700 B
37 lines
700 B
/*
|
|
* Copyright (C) 2017 Microchip
|
|
* Wenyou Yang <wenyou.yang@microchip.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <environment.h>
|
|
#include <i2c_eeprom.h>
|
|
#include <netdev.h>
|
|
|
|
int at91_set_ethaddr(int offset)
|
|
{
|
|
const int ETH_ADDR_LEN = 6;
|
|
unsigned char ethaddr[ETH_ADDR_LEN];
|
|
const char *ETHADDR_NAME = "ethaddr";
|
|
struct udevice *dev;
|
|
int ret;
|
|
|
|
if (env_get(ETHADDR_NAME))
|
|
return 0;
|
|
|
|
ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &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;
|
|
}
|
|
|