Patchwork [U-Boot] da850: read MAC address from I2C EEPROM on AM18xx EVM

login
register
mail settings
Submitter nagabhushana.netagunte@ti.com
Date July 28, 2011, 4:25 p.m.
Message ID <1311870338-18950-13-git-send-email-nagabhushana.netagunte@ti.com>
Download mbox | patch
Permalink /patch/107286/
State Changes Requested
Headers show

Comments

nagabhushana.netagunte@ti.com - July 28, 2011, 4:25 p.m.
From: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>

The AM18xx EVM contains MAC address in I2C EEPROM compared
da850/omap-l138 Logic PD EVM which maintains in SPI flash. So this
patch tries to read MAC address from I2C EEPROM, in failure case reads
from SPI flash assuming board to be da850/omap-l138 Logic PDS EVM.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
---
 board/davinci/da8xxevm/da850evm.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
Mike Frysinger - July 28, 2011, 6:31 p.m.
On Thu, Jul 28, 2011 at 09:25,  <nagabhushana.netagunte@wrote:
>        if (getenv("ethaddr") == NULL) {

this should get fixed to use the eth helper instead of poking the env
yourself.  see board/bf537-stamp/bf537-stamp.c as an example.
-mike
Mike Frysinger - July 29, 2011, 6:32 p.m.
On Thu, Jul 28, 2011 at 11:31, Mike Frysinger wrote:
> On Thu, Jul 28, 2011 at 09:25,  <nagabhushana.netagunte@wrote:
>>        if (getenv("ethaddr") == NULL) {
>
> this should get fixed to use the eth helper instead of poking the env
> yourself.  see board/bf537-stamp/bf537-stamp.c as an example.

actually, it looks like this patch is simply a fix for another patch
you just sent out.  please dont post buggy patches ... just squash the
two together.

also, if you're posting patch series, you need to have [#/#] markers
in the summary so that people can clearly see the order required for
merging.
-mike
nagabhushana.netagunte@ti.com - Aug. 1, 2011, 9:38 a.m.
Mike,
Thanks for your valuable comments; I will use the helper function you suggested.

-Nag
On Fri, Jul 29, 2011 at 00:01:39, Mike Frysinger wrote:
> On Thu, Jul 28, 2011 at 09:25,  <nagabhushana.netagunte@wrote:
> >        if (getenv("ethaddr") == NULL) {
> 
> this should get fixed to use the eth helper instead of poking the env yourself.  see board/bf537-stamp/bf537-stamp.c as an example.
> -mike
>
nagabhushana.netagunte@ti.com - Aug. 1, 2011, 9:50 a.m.
Hi Mike,
Thanks for your comments.

Since the earlier patch is about reading env variable value in SPI flash and
This patch concentrates on reading the same from I2C EEPROM, it will be better to have 2 different patches. Second patch is not to fix the first patch.

If you want them to sent after squashing, I can do that as well.

Regards,
Nag

On Sat, Jul 30, 2011 at 00:02:41, Mike Frysinger wrote:
> On Thu, Jul 28, 2011 at 11:31, Mike Frysinger wrote:
> > On Thu, Jul 28, 2011 at 09:25,  <nagabhushana.netagunte@wrote:
> >>        if (getenv("ethaddr") == NULL) {
> >
> > this should get fixed to use the eth helper instead of poking the env 
> > yourself.  see board/bf537-stamp/bf537-stamp.c as an example.
> 
> actually, it looks like this patch is simply a fix for another patch you just sent out.  please dont post buggy patches ... just squash the two together.
> 
> also, if you're posting patch series, you need to have [#/#] markers in the summary so that people can clearly see the order required for merging.
> -mike
>

Patch

diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index d99f1a0..fd05703 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -489,10 +489,16 @@  int misc_init_r(void)
 	printf("ARM Clock : %d Hz\n", clk_get(DAVINCI_ARM_CLKID));
 
 	if (getenv("ethaddr") == NULL) {
-		/* Set Ethernet MAC address from EEPROM */
-		ret = get_mac_addr(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(addr);
+			if (ret != 0)
+				return -EINVAL;
+		}
 
 		if (is_multicast_ether_addr(addr) || is_zero_ether_addr(addr)) {
 			printf("Invalid MAC address read.\n");