Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Joe Hershberger
On Fri, Sep 13, 2019 at 9:31 AM Simon Glass  wrote:
>
> Hi Ondřej,
>
> On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> >
> > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > This function fits better with the network subsystem, so move it.
> > > > > >
> > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > fixes the issue.
> > > > > >
> > > > > >   LD  u-boot
> > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > `eth_parse_enetaddr'
> > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > >
> > > > >
> > > > > Which board is this please?
> > > >
> > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > CONFIG_NET.
> > > >
> > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > disabled, this
> > > > function will not be available to nvedit.c.
> > > >
> > > > The board doesn't really matter.
> > >
> > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > I think the board does matter. There might be something else I am
> > > missing but I cannot see it at present.
> > >
> > > Would you like to send a patch?
> >
> > I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> > back.
> >
> > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > is disabled in u-boot. It determines the stable MAC address to use for 
> > ethernet
> > interfaces described in DT for Linux to use.
> >
> > See fdt_fixup_ethernet() that does that.
> >
> > That feature is independent of the whole network stack and network drivers
> > in u-boot.
>
> So you are saying that you should be able to read the MAC address,
> etc. with CONFIG_NET disabled?
>
> I was certainly not aware of that.
>
> Joe do you have any thoughts here?

I think this case makes sense... It's essentially a valid type to want
to parse even if not using networking.

It seems it should be in lib/net_utils.c, which always builds.

Cheers,
-Joe

> Regards,
> SImon
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Tom Rini
On Fri, Sep 13, 2019 at 04:34:45PM +0200, Ondřej Jirman wrote:
> On Fri, Sep 13, 2019 at 08:25:09AM -0600, Simon Glass wrote:
> > Hi Ondřej,
> > 
> > On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> > >
> > > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > > Hi,
> > > >
> > > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  
> > > > > > wrote:
> > > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > > This function fits better with the network subsystem, so move 
> > > > > > > > it.
> > > > > > >
> > > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > > fixes the issue.
> > > > > > >
> > > > > > >   LD  u-boot
> > > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > > `eth_parse_enetaddr'
> > > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > > >
> > > > > >
> > > > > > Which board is this please?
> > > > >
> > > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > > CONFIG_NET.
> > > > >
> > > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > > disabled, this
> > > > > function will not be available to nvedit.c.
> > > > >
> > > > > The board doesn't really matter.
> > > >
> > > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > > I think the board does matter. There might be something else I am
> > > > missing but I cannot see it at present.
> > > >
> > > > Would you like to send a patch?
> > >
> > > I'd like to send a patch to revert this change and move 
> > > eth_parse_enetaddr back.
> > >
> > > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > > is disabled in u-boot. It determines the stable MAC address to use for 
> > > ethernet
> > > interfaces described in DT for Linux to use.
> > >
> > > See fdt_fixup_ethernet() that does that.
> > >
> > > That feature is independent of the whole network stack and network drivers
> > > in u-boot.
> > 
> > So you are saying that you should be able to read the MAC address,
> > etc. with CONFIG_NET disabled?
> 
> MAC address is not read from network device, it's generated from
> serial ID of the SoC and then patched into DTB for later use by Linux.
> 
> The process doesn't involve anything related to the net subsystem
> of u-boot.

Agreed, it sounds like this is more of a generic use function than a
network function as there's a lot of platforms where the MAC is
generated in a similar fashion.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Ondřej Jirman
On Fri, Sep 13, 2019 at 08:25:09AM -0600, Simon Glass wrote:
> Hi Ondřej,
> 
> On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
> >
> > On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > > Hi,
> > > > >
> > > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > > >
> > > > > > Hello,
> > > > > >
> > > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > > This function fits better with the network subsystem, so move it.
> > > > > >
> > > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > > fixes the issue.
> > > > > >
> > > > > >   LD  u-boot
> > > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > > `eth_parse_enetaddr'
> > > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > > >
> > > > >
> > > > > Which board is this please?
> > > >
> > > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > > CONFIG_NET.
> > > >
> > > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > > disabled, this
> > > > function will not be available to nvedit.c.
> > > >
> > > > The board doesn't really matter.
> > >
> > > The offending call is in setup_environment() in board/sunxi/board.c so
> > > I think the board does matter. There might be something else I am
> > > missing but I cannot see it at present.
> > >
> > > Would you like to send a patch?
> >
> > I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> > back.
> >
> > The call eth_env_set_enetaddr() is correct and should succeed even if net
> > is disabled in u-boot. It determines the stable MAC address to use for 
> > ethernet
> > interfaces described in DT for Linux to use.
> >
> > See fdt_fixup_ethernet() that does that.
> >
> > That feature is independent of the whole network stack and network drivers
> > in u-boot.
> 
> So you are saying that you should be able to read the MAC address,
> etc. with CONFIG_NET disabled?

MAC address is not read from network device, it's generated from
serial ID of the SoC and then patched into DTB for later use by Linux.

The process doesn't involve anything related to the net subsystem
of u-boot.

regards,
o.

> 
> I was certainly not aware of that.
> 
> Joe do you have any thoughts here?

> Regards,
> SImon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-13 Thread Simon Glass
Hi Ondřej,

On Thu, 12 Sep 2019 at 17:39, Ondřej Jirman  wrote:
>
> On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> > Hi,
> >
> > On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> > >
> > > Hi,
> > >
> > > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > > Hi,
> > > >
> > > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > > This function fits better with the network subsystem, so move it.
> > > > >
> > > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > > fixes the issue.
> > > > >
> > > > >   LD  u-boot
> > > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > > `eth_parse_enetaddr'
> > > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > > make: *** [Makefile:148: sub-make] Error 2
> > > > >
> > > >
> > > > Which board is this please?
> > >
> > > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > > CONFIG_NET.
> > >
> > > The issue is that by moving eth_parse_enetaddr to net/ if net is 
> > > disabled, this
> > > function will not be available to nvedit.c.
> > >
> > > The board doesn't really matter.
> >
> > The offending call is in setup_environment() in board/sunxi/board.c so
> > I think the board does matter. There might be something else I am
> > missing but I cannot see it at present.
> >
> > Would you like to send a patch?
>
> I'd like to send a patch to revert this change and move eth_parse_enetaddr 
> back.
>
> The call eth_env_set_enetaddr() is correct and should succeed even if net
> is disabled in u-boot. It determines the stable MAC address to use for 
> ethernet
> interfaces described in DT for Linux to use.
>
> See fdt_fixup_ethernet() that does that.
>
> That feature is independent of the whole network stack and network drivers
> in u-boot.

So you are saying that you should be able to read the MAC address,
etc. with CONFIG_NET disabled?

I was certainly not aware of that.

Joe do you have any thoughts here?

Regards,
SImon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-12 Thread Ondřej Jirman
On Thu, Sep 12, 2019 at 01:28:10PM -0600, Simon Glass wrote:
> Hi,
> 
> On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
> >
> > Hi,
> >
> > On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > > Hi,
> > >
> > > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > > >
> > > > Hello,
> > > >
> > > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > > This function fits better with the network subsystem, so move it.
> > > >
> > > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > > fixes the issue.
> > > >
> > > >   LD  u-boot
> > > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > > `eth_parse_enetaddr'
> > > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > > make: *** [Makefile:148: sub-make] Error 2
> > > >
> > >
> > > Which board is this please?
> >
> > It's orangepi_pc_defconfig with some menuconfig changes to disable 
> > CONFIG_NET.
> >
> > The issue is that by moving eth_parse_enetaddr to net/ if net is disabled, 
> > this
> > function will not be available to nvedit.c.
> >
> > The board doesn't really matter.
> 
> The offending call is in setup_environment() in board/sunxi/board.c so
> I think the board does matter. There might be something else I am
> missing but I cannot see it at present.
> 
> Would you like to send a patch?

I'd like to send a patch to revert this change and move eth_parse_enetaddr back.

The call eth_env_set_enetaddr() is correct and should succeed even if net
is disabled in u-boot. It determines the stable MAC address to use for ethernet
interfaces described in DT for Linux to use.

See fdt_fixup_ethernet() that does that.

That feature is independent of the whole network stack and network drivers
in u-boot.

regards,
o.

> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-12 Thread Simon Glass
Hi,

On Thu, 12 Sep 2019 at 12:28, Ondřej Jirman  wrote:
>
> Hi,
>
> On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> > Hi,
> >
> > On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> > >
> > > Hello,
> > >
> > > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > > This function fits better with the network subsystem, so move it.
> > >
> > > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > > fixes the issue.
> > >
> > >   LD  u-boot
> > > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > > `eth_parse_enetaddr'
> > > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > > make: *** [Makefile:148: sub-make] Error 2
> > >
> >
> > Which board is this please?
>
> It's orangepi_pc_defconfig with some menuconfig changes to disable CONFIG_NET.
>
> The issue is that by moving eth_parse_enetaddr to net/ if net is disabled, 
> this
> function will not be available to nvedit.c.
>
> The board doesn't really matter.

The offending call is in setup_environment() in board/sunxi/board.c so
I think the board does matter. There might be something else I am
missing but I cannot see it at present.

Would you like to send a patch?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-12 Thread Ondřej Jirman
Hi,

On Thu, Sep 12, 2019 at 12:22:15PM -0600, Simon Glass wrote:
> Hi,
> 
> On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
> >
> > Hello,
> >
> > On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > > This function fits better with the network subsystem, so move it.
> >
> > Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> > fixes the issue.
> >
> >   LD  u-boot
> > cmd/built-in.o: In function `eth_env_get_enetaddr':
> > u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to 
> > `eth_parse_enetaddr'
> > make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> > make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> > make: *** [Makefile:148: sub-make] Error 2
> >
> 
> Which board is this please?

It's orangepi_pc_defconfig with some menuconfig changes to disable CONFIG_NET.

The issue is that by moving eth_parse_enetaddr to net/ if net is disabled, this
function will not be available to nvedit.c.

The board doesn't really matter.

regards,
o.

> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-12 Thread Simon Glass
Hi,

On Thu, 12 Sep 2019 at 10:59, Ondřej Jirman  wrote:
>
> Hello,
>
> On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> > This function fits better with the network subsystem, so move it.
>
> Unfortunately, this breaks builds without CONFIG_NET. Reverting it
> fixes the issue.
>
>   LD  u-boot
> cmd/built-in.o: In function `eth_env_get_enetaddr':
> u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to `eth_parse_enetaddr'
> make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
> make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
> make: *** [Makefile:148: sub-make] Error 2
>

Which board is this please?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-09-12 Thread Ondřej Jirman
Hello,

On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> This function fits better with the network subsystem, so move it.

Unfortunately, this breaks builds without CONFIG_NET. Reverting it
fixes the issue.

  LD  u-boot
cmd/built-in.o: In function `eth_env_get_enetaddr':
u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to `eth_parse_enetaddr'
make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
make: *** [Makefile:148: sub-make] Error 2

regards,
o.

> Signed-off-by: Simon Glass 
> Suggested-by: Joe Hershberger 
> ---
> 
> Changes in v2:
> - Add new patch to move eth_parse_enetaddr() to net.c/h
> 
>  cmd/nvedit.c  | 12 
>  include/environment.h |  2 --
>  include/net.h | 11 +++
>  net/net.c | 12 
>  4 files changed, 23 insertions(+), 14 deletions(-)
> 
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index 751b77d0e9..01110e9b3a 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -358,18 +358,6 @@ 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, , 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);
> diff --git a/include/environment.h b/include/environment.h
> index 77915f459e..0de9d3fc60 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -325,8 +325,6 @@ int env_erase(void);
>   */
>  void env_fix_drivers(void);
>  
> -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
> -
>  #endif /* DO_DEPS_ONLY */
>  
>  #endif /* _ENVIRONMENT_H_ */
> diff --git a/include/net.h b/include/net.h
> index 0262175c81..a54d5eeac5 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -875,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char 
> *devstring);
>  
>  /**/
>  
> +/**
> + * eth_parse_enetaddr() - Parse a MAC address
> + *
> + * Convert a string MAC address
> + *
> + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 
> 2-digit
> + *   hex value
> + * @enetaddr: Place to put MAC address (6 bytes)
> + */
> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
> +
>  #endif /* __NET_H__ */
> diff --git a/net/net.c b/net/net.c
> index 1a175c4597..f0a3996cd6 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1614,3 +1614,15 @@ ushort env_get_vlan(char *var)
>  {
>   return string_to_vlan(env_get(var));
>  }
> +
> +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, , 16) : 0;
> + if (addr)
> + addr = (*end) ? end + 1 : end;
> + }
> +}
> -- 
> 2.22.0.709.g102302147b-goog
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-08-13 Thread Tom Rini
On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:

> This function fits better with the network subsystem, so move it.
> 
> Signed-off-by: Simon Glass 
> Suggested-by: Joe Hershberger 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-08-02 Thread Joe Hershberger
On Thu, Aug 1, 2019 at 10:57 AM Simon Glass  wrote:
>
> This function fits better with the network subsystem, so move it.
>
> Signed-off-by: Simon Glass 
> Suggested-by: Joe Hershberger 

Acked-by :Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

2019-08-01 Thread Simon Glass
This function fits better with the network subsystem, so move it.

Signed-off-by: Simon Glass 
Suggested-by: Joe Hershberger 
---

Changes in v2:
- Add new patch to move eth_parse_enetaddr() to net.c/h

 cmd/nvedit.c  | 12 
 include/environment.h |  2 --
 include/net.h | 11 +++
 net/net.c | 12 
 4 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 751b77d0e9..01110e9b3a 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -358,18 +358,6 @@ 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, , 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);
diff --git a/include/environment.h b/include/environment.h
index 77915f459e..0de9d3fc60 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -325,8 +325,6 @@ int env_erase(void);
  */
 void env_fix_drivers(void);
 
-void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
-
 #endif /* DO_DEPS_ONLY */
 
 #endif /* _ENVIRONMENT_H_ */
diff --git a/include/net.h b/include/net.h
index 0262175c81..a54d5eeac5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -875,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char 
*devstring);
 
 /**/
 
+/**
+ * eth_parse_enetaddr() - Parse a MAC address
+ *
+ * Convert a string MAC address
+ *
+ * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit
+ * hex value
+ * @enetaddr: Place to put MAC address (6 bytes)
+ */
+void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
+
 #endif /* __NET_H__ */
diff --git a/net/net.c b/net/net.c
index 1a175c4597..f0a3996cd6 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1614,3 +1614,15 @@ ushort env_get_vlan(char *var)
 {
return string_to_vlan(env_get(var));
 }
+
+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, , 16) : 0;
+   if (addr)
+   addr = (*end) ? end + 1 : end;
+   }
+}
-- 
2.22.0.709.g102302147b-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot