From: Wolfgang Denk Date: Tue, 02 Aug 2011 18:30:36 +0200 Subject: [U-Boot] [PATCH 09/12] da850: read MAC address from I2C EEPROM on AM18xx EVM In-Reply-To: <1312299792-16415-10-git-send-email-nagabhushana.netagunte@ti.com> References: <1312299792-16415-1-git-send-email-nagabhushana.netagunte@ti.com> <1312299792-16415-10-git-send-email-nagabhushana.netagunte@ti.com> Message-ID: <20110802163036.39B711208DCE@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear nagabhushana.netagunte at ti.com, In message <1312299792-16415-10-git-send-email-nagabhushana.netagunte@ti.com> you wrote: > From: Nagabhushana Netagunte > > The AM18xx EVM contains MAC address in I2C EEPROM compared > da850/omap-l138 Logic PD EVM which maintains in SPI flash. ... Sorry, I cannot parse this. Please reformulate. > if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { > - /* Set Ethernet MAC address from EEPROM */ > - ret = get_mac_addr_spi(addr); > - if (ret != 0) > - return -EINVAL; > + /* Read Ethernet MAC address from EEPROM */ > + if (dvevm_read_mac_address(addr)) { > + /* Set Ethernet MAC address from EEPROM */ > + davinci_sync_env_enetaddr(addr); > + } else { > + /* Set Ethernet MAC address from SPI flash */ > + ret = get_mac_addr_spi(addr); > + if (ret != 0) > + return -EINVAL; > + } This is a pretty bad idea, as it will slow down booting and may cause undefined behaviour if anybody decides to put an EEPROm on a board where you assume there is none. Please find a different way to test which board you have (or provide a separate configuration). Implement this test just once, in early init code, so that not each and every driver or feature as to test this himself again and again. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Spock, did you see the looks on their faces?" "Yes, Captain, a sort of vacant contentment."