[U-Boot] [PATCH v2 1/2] da850evm: add support to read mac address from SPI flash

Mike Frysinger vapier at gentoo.org
Fri Feb 10 22:49:24 CET 2012


On Friday 10 February 2012 01:22:24 Manjunath Hadli wrote:
> --- a/board/davinci/da8xxevm/da850evm.c
> +++ b/board/davinci/da8xxevm/da850evm.c
> 
> +#define CFG_MAC_ADDR_SPI_BUS	0
> +#define CFG_MAC_ADDR_SPI_CS	0
> +#define CFG_MAC_ADDR_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
> +#define CFG_MAC_ADDR_SPI_MODE	SPI_MODE_3

these defines get used only once below, so doesn't seem terribly useful to have 
as defines.  up to you.

>  int misc_init_r(void)
>  {
>  	dspwake();
> +
> +#ifdef CONFIG_MAC_ADDR_IN_SPIFLASH
> +	uchar env_enetaddr[6];
> +	int enetaddr_found;
> +	int spi_mac_read;
> +	uchar buff[6];
> +
> +	enetaddr_found = eth_getenv_enetaddr("ethaddr", env_enetaddr);
> +	spi_mac_read = get_mac_addr(buff);

you always read the SPI flash even if the env is available.  that sounds like a 
waste of time to me.  i'd expect the logic to simply be:

	if (!eth_getenv_enetaddr("ethaddr", env_enetaddr)) {
		if (get_mac_addr(buff) == 0)
			eth_setenv_enetaddr("ethaddr", buff);
	}

no need to warn in misc_init_r() since your get_mac_addr() already issues a 
warning
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120210/729ea09a/attachment.pgp>


More information about the U-Boot mailing list