소스 검색

net: Move enetaddr env access code to env config instead of net config

In order that we can use eth_env_* even when CONFIG_NET isn't set, move
these functions to environment code from net code.

This fixes failures such as:

  board/ti/am335x/built-in.o: In function `board_late_init':
  board/ti/am335x/board.c:752: undefined reference to `eth_env_set_enetaddr'
  u-boot/board/ti/am335x/board.c:766: undefined reference to `eth_env_set_enetaddr'

which caters for use cases such as:

commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment
variable")

when Ethernet is required in Linux, but not U-Boot.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Alex Kiernan 6 년 전
부모
커밋
9925f1dbc3
66개의 변경된 파일97개의 추가작업 그리고 33개의 파일을 삭제
  1. 1 0
      arch/arm/cpu/arm926ejs/spear/spr_misc.c
  2. 1 0
      arch/arm/mach-davinci/misc.c
  3. 1 0
      arch/arm/mach-omap2/utils.c
  4. 1 0
      arch/powerpc/cpu/mpc85xx/fdt.c
  5. 1 0
      board/BuR/common/common.c
  6. 1 0
      board/CZ.NIC/turris_omnia/turris_omnia.c
  7. 1 0
      board/LaCie/net2big_v2/net2big_v2.c
  8. 1 0
      board/LaCie/netspace_v2/netspace_v2.c
  9. 1 0
      board/amlogic/khadas-vim/khadas-vim.c
  10. 1 0
      board/amlogic/libretech-cc/libretech-cc.c
  11. 1 0
      board/amlogic/odroid-c2/odroid-c2.c
  12. 1 0
      board/amlogic/p212/p212.c
  13. 1 0
      board/atmel/common/mac_eeprom.c
  14. 1 0
      board/buffalo/lsxl/lsxl.c
  15. 1 0
      board/compulab/cl-som-am57x/eth.c
  16. 1 0
      board/compulab/cl-som-imx7/cl-som-imx7.c
  17. 1 0
      board/compulab/cm_fx6/cm_fx6.c
  18. 1 0
      board/compulab/cm_t335/cm_t335.c
  19. 1 0
      board/compulab/cm_t35/cm_t35.c
  20. 1 0
      board/compulab/cm_t3517/cm_t3517.c
  21. 1 0
      board/compulab/cm_t54/cm_t54.c
  22. 1 0
      board/davinci/da8xxevm/da850evm.c
  23. 1 0
      board/dhelectronics/dh_imx6/dh_imx6.c
  24. 1 0
      board/gateworks/gw_ventana/gw_ventana.c
  25. 1 0
      board/ge/mx53ppd/mx53ppd.c
  26. 1 0
      board/kosagi/novena/novena.c
  27. 1 0
      board/logicpd/zoom1/zoom1.c
  28. 1 0
      board/phytec/pcm051/board.c
  29. 1 0
      board/phytec/phycore_rk3288/phycore-rk3288.c
  30. 1 0
      board/raspberrypi/rpi/rpi.c
  31. 1 0
      board/renesas/alt/alt.c
  32. 1 0
      board/renesas/blanche/blanche.c
  33. 1 0
      board/renesas/gose/gose.c
  34. 1 0
      board/renesas/koelsch/koelsch.c
  35. 1 0
      board/renesas/lager/lager.c
  36. 1 0
      board/renesas/sh7752evb/sh7752evb.c
  37. 1 0
      board/renesas/sh7753evb/sh7753evb.c
  38. 1 0
      board/renesas/sh7757lcr/sh7757lcr.c
  39. 1 0
      board/renesas/silk/silk.c
  40. 1 0
      board/renesas/stout/stout.c
  41. 1 0
      board/rockchip/tinker_rk3288/tinker-rk3288.c
  42. 1 0
      board/samtec/vining_2000/vining_2000.c
  43. 1 0
      board/samtec/vining_fpga/socfpga.c
  44. 1 0
      board/siemens/common/factoryset.c
  45. 1 0
      board/siemens/pxm2/board.c
  46. 1 0
      board/silica/pengwyn/board.c
  47. 1 0
      board/technologic/ts4800/ts4800.c
  48. 1 0
      board/theobroma-systems/puma_rk3399/puma-rk3399.c
  49. 1 0
      board/ti/am43xx/board.c
  50. 1 0
      board/ti/ti814x/evm.c
  51. 1 0
      board/ti/ti816x/evm.c
  52. 1 0
      board/timll/devkit8000/devkit8000.c
  53. 1 0
      board/toradex/common/tdx-common.c
  54. 1 0
      cmd/elf.c
  55. 1 0
      cmd/ethsw.c
  56. 30 0
      cmd/nvedit.c
  57. 1 0
      drivers/net/cpsw-common.c
  58. 1 0
      drivers/net/fec_mxc.c
  59. 1 0
      drivers/net/fsl_mcdmafec.c
  60. 1 0
      drivers/net/mcffec.c
  61. 1 0
      drivers/net/ne2000_base.c
  62. 1 0
      drivers/net/sh_eth.c
  63. 1 0
      drivers/usb/gadget/ether.c
  64. 4 0
      include/environment.h
  65. 0 3
      include/net.h
  66. 1 30
      net/eth_common.c

+ 1 - 0
arch/arm/cpu/arm926ejs/spear/spr_misc.c

@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <i2c.h>
 #include <net.h>
 #include <linux/mtd/st_smi.h>

+ 1 - 0
arch/arm/mach-davinci/misc.c

@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <i2c.h>
 #include <net.h>
 #include <asm/arch/hardware.h>

+ 1 - 0
arch/arm/mach-omap2/utils.c

@@ -5,6 +5,7 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 #include <common.h>
+#include <environment.h>
 #include <asm/setup.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/omap_common.h>

+ 1 - 0
arch/powerpc/cpu/mpc85xx/fdt.c

@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/processor.h>

+ 1 - 0
board/BuR/common/common.c

@@ -11,6 +11,7 @@
  */
 #include <version.h>
 #include <common.h>
+#include <environment.h>
 #include <errno.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>

+ 1 - 0
board/CZ.NIC/turris_omnia/turris_omnia.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <i2c.h>
 #include <miiphy.h>
 #include <netdev.h>

+ 1 - 0
board/LaCie/net2big_v2/net2big_v2.c

@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <i2c.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>

+ 1 - 0
board/LaCie/netspace_v2/netspace_v2.c

@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>

+ 1 - 0
board/amlogic/khadas-vim/khadas-vim.c

@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
 #include <asm/arch/mem.h>

+ 1 - 0
board/amlogic/libretech-cc/libretech-cc.c

@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
 #include <asm/arch/sm.h>

+ 1 - 0
board/amlogic/odroid-c2/odroid-c2.c

@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
 #include <asm/arch/sm.h>

+ 1 - 0
board/amlogic/p212/p212.c

@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <asm/io.h>
 #include <asm/arch/gxbb.h>
 #include <asm/arch/sm.h>

+ 1 - 0
board/atmel/common/mac_eeprom.c

@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
 

+ 1 - 0
board/buffalo/lsxl/lsxl.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <net.h>
 #include <malloc.h>
 #include <netdev.h>

+ 1 - 0
board/compulab/cl-som-am57x/eth.c

@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpsw.h>
+#include <environment.h>
 #include <miiphy.h>
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>

+ 1 - 0
board/compulab/cl-som-imx7/cl-som-imx7.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <mmc.h>
 #include <phy.h>
 #include <netdev.h>

+ 1 - 0
board/compulab/cm_fx6/cm_fx6.c

@@ -12,6 +12,7 @@
 #include <ahci.h>
 #include <dm.h>
 #include <dwc_ahsata.h>
+#include <environment.h>
 #include <fsl_esdhc.h>
 #include <miiphy.h>
 #include <mtd_node.h>

+ 1 - 0
board/compulab/cm_t335/cm_t335.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <cpsw.h>

+ 1 - 0
board/compulab/cm_t35/cm_t35.c

@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <status_led.h>
 #include <netdev.h>
 #include <net.h>

+ 1 - 0
board/compulab/cm_t3517/cm_t3517.c

@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <status_led.h>
 #include <net.h>
 #include <netdev.h>

+ 1 - 0
board/compulab/cm_t54/cm_t54.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <fdt_support.h>
 #include <usb.h>
 #include <mmc.h>

+ 1 - 0
board/davinci/da8xxevm/da850evm.c

@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <i2c.h>
 #include <net.h>
 #include <netdev.h>

+ 1 - 0
board/dhelectronics/dh_imx6/dh_imx6.c

@@ -19,6 +19,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/sata.h>
+#include <environment.h>
 #include <errno.h>
 #include <fsl_esdhc.h>
 #include <fuse.h>

+ 1 - 0
board/gateworks/gw_ventana/gw_ventana.c

@@ -22,6 +22,7 @@
 #include <asm/setup.h>
 #include <dm.h>
 #include <dm/platform_data/serial_mxc.h>
+#include <environment.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <fdt_support.h>

+ 1 - 0
board/ge/mx53ppd/mx53ppd.c

@@ -20,6 +20,7 @@
 #include <linux/errno.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/mx5_video.h>
+#include <environment.h>
 #include <netdev.h>
 #include <i2c.h>
 #include <mmc.h>

+ 1 - 0
board/kosagi/novena/novena.c

@@ -21,6 +21,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/video.h>
+#include <environment.h>
 #include <fsl_esdhc.h>
 #include <i2c.h>
 #include <input.h>

+ 1 - 0
board/logicpd/zoom1/zoom1.c

@@ -16,6 +16,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <twl4030.h>

+ 1 - 0
board/phytec/pcm051/board.c

@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>

+ 1 - 0
board/phytec/phycore_rk3288/phycore-rk3288.c

@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <i2c.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>

+ 1 - 0
board/raspberrypi/rpi/rpi.c

@@ -8,6 +8,7 @@
 #include <inttypes.h>
 #include <config.h>
 #include <dm.h>
+#include <environment.h>
 #include <efi_loader.h>
 #include <fdt_support.h>
 #include <fdt_simplefb.h>

+ 1 - 0
board/renesas/alt/alt.c

@@ -10,6 +10,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/blanche/blanche.c

@@ -12,6 +12,7 @@
 #include <netdev.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/gose/gose.c

@@ -10,6 +10,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/koelsch/koelsch.c

@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/lager/lager.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>

+ 1 - 0
board/renesas/sh7752evb/sh7752evb.c

@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/sh7753evb/sh7753evb.c

@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/sh7757lcr/sh7757lcr.c

@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <asm/processor.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/silk/silk.c

@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/renesas/stout/stout.c

@@ -14,6 +14,7 @@
 #include <netdev.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
+#include <environment.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>

+ 1 - 0
board/rockchip/tinker_rk3288/tinker-rk3288.c

@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
 

+ 1 - 0
board/samtec/vining_2000/vining_2000.c

@@ -18,6 +18,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <linux/sizes.h>
 #include <common.h>
+#include <environment.h>
 #include <fsl_esdhc.h>
 #include <mmc.h>
 #include <i2c.h>

+ 1 - 0
board/samtec/vining_fpga/socfpga.c

@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/io.h>
 #include <asm/gpio.h>

+ 1 - 0
board/siemens/common/factoryset.c

@@ -9,6 +9,7 @@
 #if !defined(CONFIG_SPL_BUILD)
 
 #include <common.h>
+#include <environment.h>
 #include <i2c.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>

+ 1 - 0
board/siemens/pxm2/board.c

@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>

+ 1 - 0
board/silica/pengwyn/board.c

@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/ddr_defs.h>

+ 1 - 0
board/technologic/ts4800/ts4800.c

@@ -17,6 +17,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/mx5_video.h>
+#include <environment.h>
 #include <mmc.h>
 #include <input.h>
 #include <fsl_esdhc.h>

+ 1 - 0
board/theobroma-systems/puma_rk3399/puma-rk3399.c

@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <misc.h>
 #include <spl.h>
 #include <syscon.h>

+ 1 - 0
board/ti/am43xx/board.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <i2c.h>
 #include <linux/errno.h>
 #include <spl.h>

+ 1 - 0
board/ti/ti814x/evm.c

@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpsw.h>
+#include <environment.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>

+ 1 - 0
board/ti/ti816x/evm.c

@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <spl.h>
 #include <netdev.h>
 #include <asm/cache.h>

+ 1 - 0
board/timll/devkit8000/devkit8000.c

@@ -18,6 +18,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <ns16550.h>
 #include <twl4030.h>
 #include <asm/io.h>

+ 1 - 0
board/toradex/common/tdx-common.c

@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <g_dnl.h>
 #include <linux/libfdt.h>
 

+ 1 - 0
cmd/elf.c

@@ -16,6 +16,7 @@
 #include <common.h>
 #include <command.h>
 #include <elf.h>
+#include <environment.h>
 #include <net.h>
 #include <vxworks.h>
 #ifdef CONFIG_X86

+ 1 - 0
cmd/ethsw.c

@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <errno.h>
 #include <env_flags.h>
 #include <ethsw.h>

+ 30 - 0
cmd/nvedit.c

@@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong default_val)
 	return value;
 }
 
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr)
+{
+	char *end;
+	int i;
+
+	for (i = 0; i < 6; ++i) {
+		enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
+		if (addr)
+			addr = (*end) ? end + 1 : end;
+	}
+}
+
+int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr)
+{
+	eth_parse_enetaddr(env_get(name), enetaddr);
+	return is_valid_ethaddr(enetaddr);
+}
+
+int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr)
+{
+	char buf[ARP_HLEN_ASCII + 1];
+
+	if (eth_env_get_enetaddr(name, (uint8_t *)buf))
+		return -EEXIST;
+
+	sprintf(buf, "%pM", enetaddr);
+
+	return env_set(name, buf);
+}
+
 #ifndef CONFIG_SPL_BUILD
 static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {

+ 1 - 0
drivers/net/cpsw-common.c

@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <fdt_support.h>
 #include <asm/io.h>
 #include <cpsw.h>

+ 1 - 0
drivers/net/fec_mxc.c

@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <miiphy.h>

+ 1 - 0
drivers/net/fsl_mcdmafec.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <command.h>
 #include <config.h>

+ 1 - 0
drivers/net/mcffec.c

@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 
 #include <command.h>

+ 1 - 0
drivers/net/ne2000_base.c

@@ -74,6 +74,7 @@ Add SNMP
 
 #include <common.h>
 #include <command.h>
+#include <environment.h>
 #include <net.h>
 #include <malloc.h>
 #include <linux/compiler.h>

+ 1 - 0
drivers/net/sh_eth.c

@@ -11,6 +11,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <environment.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>

+ 1 - 0
drivers/usb/gadget/ether.c

@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <console.h>
+#include <environment.h>
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/usb/ch9.h>

+ 4 - 0
include/environment.h

@@ -314,6 +314,10 @@ int env_load(void);
  */
 int env_save(void);
 
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
+int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
+int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);
+
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */

+ 0 - 3
include/net.h

@@ -238,9 +238,6 @@ void eth_try_another(int first_restart);	/* Change the device */
 void eth_set_current(void);		/* set nterface to ethcur var */
 
 int eth_get_dev_index(void);		/* get the device index */
-void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
-int eth_env_get_enetaddr(const char *name, uchar *enetaddr);
-int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);
 
 /**
  * eth_env_set_enetaddr_by_index() - set the MAC address environment variable

+ 1 - 30
net/eth_common.c

@@ -8,40 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <environment.h>
 #include <miiphy.h>
 #include <net.h>
 #include "eth_internal.h"
 
-void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
-{
-	char *end;
-	int i;
-
-	for (i = 0; i < 6; ++i) {
-		enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
-		if (addr)
-			addr = (*end) ? end + 1 : end;
-	}
-}
-
-int eth_env_get_enetaddr(const char *name, uchar *enetaddr)
-{
-	eth_parse_enetaddr(env_get(name), enetaddr);
-	return is_valid_ethaddr(enetaddr);
-}
-
-int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
-{
-	char buf[ARP_HLEN_ASCII + 1];
-
-	if (eth_env_get_enetaddr(name, (uchar *)buf))
-		return -EEXIST;
-
-	sprintf(buf, "%pM", enetaddr);
-
-	return env_set(name, buf);
-}
-
 int eth_env_get_enetaddr_by_index(const char *base_name, int index,
 				 uchar *enetaddr)
 {