From: Mike Frysinger Date: Fri, 10 Feb 2012 16:49:24 -0500 Subject: [U-Boot] [PATCH v2 1/2] da850evm: add support to read mac address from SPI flash In-Reply-To: <1328854945-18593-2-git-send-email-manjunath.hadli@ti.com> References: <1328854945-18593-1-git-send-email-manjunath.hadli@ti.com> <1328854945-18593-2-git-send-email-manjunath.hadli@ti.com> Message-ID: <201202101649.26779.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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: