Skip to contentSkip to conversation

i.mx6:imx6q: allign MAC address with burned-in ordering

PATCH New Jason Liu 3 participants 3 messages Dec 19, 2011 – Dec 29, 2011

Subsystems (2)
lore
Share & tools
lore

Jason Liu

author
#0 lore raw

PATCH 1/1 i.mx6:imx6q: allign MAC address with burned-in ordering

For the i.mx6q, the burned-in MAC address will be the following odering,

fuse: 0x620[7:0] MAC_ADDR[7:0] ---> mac[5]
fuse: 0x620[15:8] MAC_ADDR[15:8] ---> mac[4]
fuse: 0x620[23:16] MAC_ADDR[23:16] ---> mac[3]
fuse: 0x620[31:24] MAC_ADDR[31:24] ---> mac[2]
fuse: 0x630[7:0] MAC_ADDR[39:32] ---> mac[1]
fuse: 0x630[15:8] MAC_ADDR[47:40] ---> mac[0]

This patch also fix the error caculation for the fuse bank[0] address

Cc Stefano Babic <[email protected]>
---
 arch/arm/cpu/armv7/mx6/soc.c             |   14 ++++++++------
 arch/arm/include/asm/arch-mx6/imx-regs.h |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +8 -6
index dff5e4e..bd59cf5 100644
@@ -70,13 +70,15 @@ void imx_get_mac_from_fuse(unsigned char *mac)
 	struct fuse_bank4_regs *fuse =
 			(struct fuse_bank4_regs *)bank->fuse_regs;
 
-	u32 mac_lo = readl(&fuse->mac_addr_low);
-	u32 mac_hi = readl(&fuse->mac_addr_high);
+	u32 value = readl(&fuse->mac_addr_high);
+	mac[0] = (value >> 8);
+	mac[1] = value ;
 
-	*(u32 *)mac = mac_lo;
-
-	mac[4] = mac_hi & 0xff;
-	mac[5] = (mac_hi >> 8) & 0xff;
+	value = readl(&fuse->mac_addr_low);
+	mac[2] = value >> 24 ;
+	mac[3] = value >> 16 ;
+	mac[4] = value >> 8 ;
+	mac[5] = value ;
 
 }
 #endif
arch/arm/include/asm/arch-mx6/imx-regs.h +1 -1
index 85d55b7..5fe9748 100644
@@ -214,7 +214,7 @@ struct iim_regs {
 	u32     crc_value;
 	u32     rsvd6[3];
 	u32     version;
-	u32     rsvd7[0xd8];
+	u32     rsvd7[0xdb];
 
 	struct fuse_bank {
 		u32	fuse_regs[0x20];
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 i.mx6:imx6q: allign MAC address with burned-in ordering

Stefano,

2011/12/19 Jason Liu <[email protected]>:

Quoted 49 lines

For the i.mx6q, the burned-in MAC address will be the following odering,

fuse: 0x620[7:0] ? MAC_ADDR[7:0] ? ? ---> mac[5]
fuse: 0x620[15:8] ?MAC_ADDR[15:8] ? ?---> mac[4]
fuse: 0x620[23:16] MAC_ADDR[23:16] ? ---> mac[3]
fuse: 0x620[31:24] MAC_ADDR[31:24] ? ---> mac[2]
fuse: 0x630[7:0] ? MAC_ADDR[39:32] ? ---> mac[1]
fuse: 0x630[15:8] ?MAC_ADDR[47:40] ? ---> mac[0]

This patch also fix the error caculation for the fuse bank[0] address

Cc Stefano Babic <[email protected]>

---
?arch/arm/cpu/armv7/mx6/soc.c ? ? ? ? ? ? | ? 14 ++++++++------ ?arch/arm/include/asm/arch-mx6/imx-regs.h | ? ?2 +- ?2 files changed, 9 insertions(+), 7 deletions(-)

arch/arm/cpu/armv7/mx6/soc.c +0 -0
index dff5e4e..bd59cf5 100644
@@ -70,13 +70,15 @@ void imx_get_mac_from_fuse(unsigned char *mac)

? ? ? ?struct fuse_bank4_regs *fuse =
? ? ? ? ? ? ? ? ? ? ? ?(struct fuse_bank4_regs *)bank->fuse_regs;

- ? ? ? u32 mac_lo = readl(&fuse->mac_addr_low);
- ? ? ? u32 mac_hi = readl(&fuse->mac_addr_high);
+ ? ? ? u32 value = readl(&fuse->mac_addr_high);
+ ? ? ? mac[0] = (value >> 8);
+ ? ? ? mac[1] = value ;

- ? ? ? *(u32 *)mac = mac_lo;
-
- ? ? ? mac[4] = mac_hi & 0xff;
- ? ? ? mac[5] = (mac_hi >> 8) & 0xff;
+ ? ? ? value = readl(&fuse->mac_addr_low);
+ ? ? ? mac[2] = value >> 24 ;
+ ? ? ? mac[3] = value >> 16 ;
+ ? ? ? mac[4] = value >> 8 ;
+ ? ? ? mac[5] = value ;

?}
?#endif

arch/arm/include/asm/arch-mx6/imx-regs.h +0 -0
index 85d55b7..5fe9748 100644

arch/arm/include/asm/arch-mx6/imx-regs.h struct iim_regs { · line 220

Quoted 8 lines
arch/arm/include/asm/arch-mx6/imx-regs.h +1 -1
@@ -214,7 +214,7 @@ struct iim_regs {
 ? ? ? ?u32 ? ? crc_value;
 ? ? ? ?u32 ? ? rsvd6[3];
 ? ? ? ?u32 ? ? version;
- ? ? ? u32 ? ? rsvd7[0xd8];
+ ? ? ? u32 ? ? rsvd7[0xdb];
 
 ? ? ? ?struct fuse_bank {
 ? ? ? ? ? ? ? ?u32 ? ? fuse_regs[0x20];

Ping. Any comments?

Quoted 8 lines

--
1.7.4.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 i.mx6:imx6q: allign MAC address with burned-in ordering

In reply to Jason Liu
Quoted 10 lines · Jason Liu

For the i.mx6q, the burned-in MAC address will be the following odering,

fuse: 0x620[7:0] MAC_ADDR[7:0] ---> mac[5]
fuse: 0x620[15:8] MAC_ADDR[15:8] ---> mac[4]
fuse: 0x620[23:16] MAC_ADDR[23:16] ---> mac[3]
fuse: 0x620[31:24] MAC_ADDR[31:24] ---> mac[2]
fuse: 0x630[7:0] MAC_ADDR[39:32] ---> mac[1]
fuse: 0x630[15:8] MAC_ADDR[47:40] ---> mac[0]

This patch also fix the error caculation for the fuse bank[0] address

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================