[U-Boot] [PATCH v1 0/5] Build AM335x when CONFIG_NET isn't defined

Attempting to build AM335x without CONFIG_NET defined fails in assorted ways. This series fixes up those failures.
Alex Kiernan (5): Migrate CONFIG_DRIVER_TI_CPSW to Kconfig ti: am335x: Fix bootargs when building without NET usb: gadget: USB_ETHER requires network support ti: am335x: Fix build when networking is disabled net: Avoid build fail on am335x when NET is disabled
board/ti/am335x/board.c | 8 ++++---- cmd/nvedit.c | 30 ++++++++++++++++++++++++++++++ drivers/net/Kconfig | 8 ++++++++ drivers/usb/gadget/Kconfig | 1 + include/common.h | 4 ++++ include/configs/am335x_evm.h | 16 ++++++++++++++-- include/configs/am335x_shc.h | 1 - include/configs/am43xx_evm.h | 1 - include/configs/am57xx_evm.h | 1 - include/configs/bur_am335x_common.h | 1 - include/configs/cl-som-am57x.h | 1 - include/configs/cm_t43.h | 1 - include/configs/dra7xx_evm.h | 1 - include/configs/siemens-am33x-common.h | 1 - include/configs/ti814x_evm.h | 1 - include/configs/ti_am335x_common.h | 1 - include/net.h | 3 --- net/eth_common.c | 30 ------------------------------ scripts/config_whitelist.txt | 1 - 19 files changed, 61 insertions(+), 50 deletions(-)

This converts CONFIG_DRIVER_TI_CPSW to Kconfig
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com ---
drivers/net/Kconfig | 8 ++++++++ include/configs/am335x_shc.h | 1 - include/configs/am43xx_evm.h | 1 - include/configs/am57xx_evm.h | 1 - include/configs/bur_am335x_common.h | 1 - include/configs/cl-som-am57x.h | 1 - include/configs/cm_t43.h | 1 - include/configs/dra7xx_evm.h | 1 - include/configs/siemens-am33x-common.h | 1 - include/configs/ti814x_evm.h | 1 - include/configs/ti_am335x_common.h | 1 - scripts/config_whitelist.txt | 1 - 12 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f589978..920927c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -283,6 +283,14 @@ config SH_ETHER help This driver supports the Ethernet for Renesas SH and ARM SoCs.
+config DRIVER_TI_CPSW + bool "TI Common Platform Ethernet Switch" + select PHYLIB + default y if ARCH_OMAP2PLUS + help + This driver supports the TI three port switch gigabit ethernet + subsystem found in the TI SoCs. + config XILINX_AXIEMAC depends on DM_ETH && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP) select PHYLIB diff --git a/include/configs/am335x_shc.h b/include/configs/am335x_shc.h index 6fa117e..5314aba 100644 --- a/include/configs/am335x_shc.h +++ b/include/configs/am335x_shc.h @@ -251,7 +251,6 @@ #undef CONFIG_TIMER #endif
-#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 663f861..c1a6f00 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -221,7 +221,6 @@ #define CONFIG_NET_RETRY_COUNT 10 #endif
-#define CONFIG_DRIVER_TI_CPSW #define PHY_ANEG_TIMEOUT 8000 /* PHY needs longer aneg time at 1G */
#define CONFIG_SYS_RX_ETH_BUFFER 64 diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index c079a3a..7211cde 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -78,7 +78,6 @@ #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME #define CONFIG_NET_RETRY_COUNT 10 -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs longer aneg time at 1G */
diff --git a/include/configs/bur_am335x_common.h b/include/configs/bur_am335x_common.h index e8abe53..6f4c710 100644 --- a/include/configs/bur_am335x_common.h +++ b/include/configs/bur_am335x_common.h @@ -29,7 +29,6 @@ #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* UART0 */
/* Network defines */ -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define CONFIG_PHY_NATSEMI
diff --git a/include/configs/cl-som-am57x.h b/include/configs/cl-som-am57x.h index 596e060..4b2a0c3 100644 --- a/include/configs/cl-som-am57x.h +++ b/include/configs/cl-som-am57x.h @@ -81,7 +81,6 @@ /* USB Networking options */
/* CPSW Ethernet */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/include/configs/cm_t43.h b/include/configs/cm_t43.h index da78519..07395de 100644 --- a/include/configs/cm_t43.h +++ b/include/configs/cm_t43.h @@ -45,7 +45,6 @@ 50, 51, 52, 53, 54, 55, 56, 57, }
/* CPSW Ethernet support */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index e82de2a..13efc3e 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -97,7 +97,6 @@ #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME #define CONFIG_NET_RETRY_COUNT 10 -#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ #define CONFIG_MII /* Required in net/eth.c */ #define CONFIG_PHY_TI
diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h index b23e20a..dfa7114 100644 --- a/include/configs/siemens-am33x-common.h +++ b/include/configs/siemens-am33x-common.h @@ -192,7 +192,6 @@ # define CONFIG_ENV_SECT_SIZE (4 << 10) /* 4 KB sectors */ #endif /* SPI support */
-#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DEFAULT #define CONFIG_BOOTP_DNS2 diff --git a/include/configs/ti814x_evm.h b/include/configs/ti814x_evm.h index 2f9056c..55df77d 100644 --- a/include/configs/ti814x_evm.h +++ b/include/configs/ti814x_evm.h @@ -155,7 +155,6 @@ #endif
/* Ethernet */ -#define CONFIG_DRIVER_TI_CPSW #define CONFIG_MII #define CONFIG_BOOTP_DNS2 #define CONFIG_BOOTP_SEND_HOSTNAME diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h index 8251ceb..01002f4 100644 --- a/include/configs/ti_am335x_common.h +++ b/include/configs/ti_am335x_common.h @@ -36,7 +36,6 @@ #define CONFIG_MII /* Required in net/eth.c */ #endif
-#define CONFIG_DRIVER_TI_CPSW /* Driver for IP block */ /* * SPL related defines. The Public RAM memory map the ROM defines the * area between 0x402F0400 and 0x4030B800 as a download area and diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0c7db05..79ec1ca 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -411,7 +411,6 @@ CONFIG_DRIVER_NE2000_BASE CONFIG_DRIVER_NE2000_CCR CONFIG_DRIVER_NE2000_VAL CONFIG_DRIVER_SMC911X_BASE -CONFIG_DRIVER_TI_CPSW CONFIG_DRIVER_TI_EMAC CONFIG_DRIVER_TI_EMAC_RMII_NO_NEGOTIATE CONFIG_DRIVER_TI_EMAC_USE_RMII

On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan alex.kiernan@gmail.com wrote:
This converts CONFIG_DRIVER_TI_CPSW to Kconfig
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

If DHCP/PXE commands are disabled then the compilation fails due to bootargs attempting to use them:
include/config_distro_bootcmd.h:319:2: error: expected ‘}’ before ‘BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE’
Ensure that if the command aren't enabled, we don't try and use them.
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com ---
include/configs/am335x_evm.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 158b7d4..e8b4125 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -74,14 +74,26 @@ #define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \ #devtypel #instance " "
+#if CONFIG_IS_ENABLED(CMD_PXE) +# define BOOT_TARGET_PXE(func) func(PXE, pxe, na) +#else +# define BOOT_TARGET_PXE(func) +#endif + +#if CONFIG_IS_ENABLED(CMD_DHCP) +# define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na) +#else +# define BOOT_TARGET_DHCP(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ func(LEGACY_MMC, legacy_mmc, 0) \ func(MMC, mmc, 1) \ func(LEGACY_MMC, legacy_mmc, 1) \ func(NAND, nand, 0) \ - func(PXE, pxe, na) \ - func(DHCP, dhcp, na) + BOOT_TARGET_PXE(func) \ + BOOT_TARGET_DHCP(func)
#include <config_distro_bootcmd.h>

On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan alex.kiernan@gmail.com wrote:
If DHCP/PXE commands are disabled then the compilation fails due to bootargs attempting to use them:
include/config_distro_bootcmd.h:319:2: error: expected ‘}’ before ‘BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE’
Ensure that if the command aren't enabled, we don't try and use them.
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

In order to compile the USB Ethernet gadget support we require that NET is enabled, add that dependency here.
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com ---
drivers/usb/gadget/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 6825e6b..26b4d12 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -158,6 +158,7 @@ endif # USB_GADGET_DOWNLOAD
config USB_ETHER bool "USB Ethernet Gadget" + depends on NET default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral

On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan alex.kiernan@gmail.com wrote:
In order to compile the USB Ethernet gadget support we require that NET is enabled, add that dependency here.
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

When compiling without CONFIG_CLOCK_SYNTHESIZER (which is implied by CONFIG_DRIVER_TI_CPSW for am335x_evm), exclude the network setup for AM335x-ICEv2 to avoid link time failures:
board/ti/am335x/board.c:683: undefined reference to `setup_clock_synthesizer'
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com ---
board/ti/am335x/board.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index f802657..5709afb 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -563,8 +563,8 @@ void sdram_init(void) } #endif
-#if !defined(CONFIG_SPL_BUILD) || \ - (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) +#if defined(CONFIG_CLOCK_SYNTHESIZER) && (!defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))) static void request_and_set_gpio(int gpio, char *name, int val) { int ret; @@ -621,8 +621,8 @@ int board_init(void) gpmc_init(); #endif
-#if !defined(CONFIG_SPL_BUILD) || \ - (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) +#if defined(CONFIG_CLOCK_SYNTHESIZER) && (!defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))) if (board_is_icev2()) { int rv; u32 reg;

Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") adds support for Ethernet in Linux, but not U-Boot.
Ensure that we can do this even when U-Boot is compiled without network support.
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com ---
cmd/nvedit.c | 30 ++++++++++++++++++++++++++++++ include/common.h | 4 ++++ include/net.h | 3 --- net/eth_common.c | 30 ------------------------------ 4 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4cb25b8..4008de1 100644 --- a/cmd/nvedit.c +++ b/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, 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); +} + #ifndef CONFIG_SPL_BUILD static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/include/common.h b/include/common.h index 3087505..b7280eb 100644 --- a/include/common.h +++ b/include/common.h @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, const void *addr) return env_set_hex(varname, (ulong)addr); }
+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); + #ifdef CONFIG_AUTO_COMPLETE int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); #endif diff --git a/include/net.h b/include/net.h index 455b48f..c339b9d 100644 --- a/include/net.h +++ b/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 diff --git a/net/eth_common.c b/net/eth_common.c index 66d0d22..cb7f029 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -12,36 +12,6 @@ #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) {

On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan alex.kiernan@gmail.com wrote:
Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") adds support for Ethernet in Linux, but not U-Boot.
Ensure that we can do this even when U-Boot is compiled without network support.
Please improve this commit log. It should have a subject that says what it does (Move enetaddr env access code to env config instead of net config) Then talk about why you are doing it in the body (i.e. the current subject).
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com
cmd/nvedit.c | 30 ++++++++++++++++++++++++++++++ include/common.h | 4 ++++ include/net.h | 3 --- net/eth_common.c | 30 ------------------------------ 4 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4cb25b8..4008de1 100644 --- a/cmd/nvedit.c +++ b/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, 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);
+}
#ifndef CONFIG_SPL_BUILD static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/include/common.h b/include/common.h index 3087505..b7280eb 100644 --- a/include/common.h +++ b/include/common.h @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, const void *addr) return env_set_hex(varname, (ulong)addr); }
+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);
Please move this to include/environment.h
#ifdef CONFIG_AUTO_COMPLETE int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); #endif diff --git a/include/net.h b/include/net.h index 455b48f..c339b9d 100644 --- a/include/net.h +++ b/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
diff --git a/net/eth_common.c b/net/eth_common.c index 66d0d22..cb7f029 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -12,36 +12,6 @@ #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) { -- 2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Thu, Mar 29, 2018 at 4:53 PM, Joe Hershberger joe.hershberger@ni.com wrote:
On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan alex.kiernan@gmail.com wrote:
Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment variable") adds support for Ethernet in Linux, but not U-Boot.
Ensure that we can do this even when U-Boot is compiled without network support.
Please improve this commit log. It should have a subject that says what it does (Move enetaddr env access code to env config instead of net config) Then talk about why you are doing it in the body (i.e. the current subject).
Signed-off-by: Alex Kiernan alex.kiernan@gmail.com
cmd/nvedit.c | 30 ++++++++++++++++++++++++++++++ include/common.h | 4 ++++ include/net.h | 3 --- net/eth_common.c | 30 ------------------------------ 4 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4cb25b8..4008de1 100644 --- a/cmd/nvedit.c +++ b/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, 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);
+}
#ifndef CONFIG_SPL_BUILD static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { diff --git a/include/common.h b/include/common.h index 3087505..b7280eb 100644 --- a/include/common.h +++ b/include/common.h @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, const void *addr) return env_set_hex(varname, (ulong)addr); }
+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);
Please move this to include/environment.h
Will do, thanks for the feedback.
participants (3)
-
Alex Kiernan
-
Joe Hershberger
-
Joe Hershberger