tinker-rk3288.c 596 B

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2016 Rockchip Electronics Co., Ltd
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <env.h>
  8. #include <i2c_eeprom.h>
  9. #include <netdev.h>
  10. static int get_ethaddr_from_eeprom(u8 *addr)
  11. {
  12. int ret;
  13. struct udevice *dev;
  14. ret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);
  15. if (ret)
  16. return ret;
  17. return i2c_eeprom_read(dev, 0, addr, 6);
  18. }
  19. int rk3288_board_late_init(void)
  20. {
  21. u8 ethaddr[6];
  22. if (get_ethaddr_from_eeprom(ethaddr))
  23. return 0;
  24. if (is_valid_ethaddr(ethaddr))
  25. eth_env_set_enetaddr("ethaddr", ethaddr);
  26. return 0;
  27. }