public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: mxs: fix mac address of second interface
@ 2015-08-15 22:16 Michael Heimpold
  2015-08-15 22:49 ` Marek Vasut
  2015-08-23 15:38 ` Stefano Babic
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Heimpold @ 2015-08-15 22:16 UTC (permalink / raw)
  To: u-boot

In the rare case that an overflow occurs, propagate it.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Marek Vasut <marex@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/cpu/arm926ejs/mxs/mxs.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
index b1d8721..42057ad 100644
--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -238,11 +238,19 @@ int cpu_eth_init(bd_t *bis)
 
 __weak void mx28_adjust_mac(int dev_id, unsigned char *mac)
 {
+	uint32_t data;
+
 	mac[0] = 0x00;
 	mac[1] = 0x04; /* Use FSL vendor MAC address by default */
 
-	if (dev_id == 1) /* Let MAC1 be MAC0 + 1 by default */
-		mac[5] += 1;
+	if (dev_id == 1) { /* Let MAC1 be MAC0 + 1 by default */
+		data = (mac[3] << 16) | (mac[4] << 8) | mac[5];
+		data++;
+
+		mac[3] = (data >> 16) & 0xff;
+		mac[4] = (data >> 8) & 0xff;
+		mac[5] = data & 0xff;
+	}
 }
 
 #ifdef	CONFIG_MX28_FEC_MAC_IN_OCOTP
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-23 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-15 22:16 [U-Boot] [PATCH] arm: mxs: fix mac address of second interface Michael Heimpold
2015-08-15 22:49 ` Marek Vasut
2015-08-17 18:51   ` Michael Heimpold
2015-08-17 20:55     ` Marek Vasut
2015-08-23 15:38 ` Stefano Babic
2015-08-23 20:24   ` Michael Heimpold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox