ARM: mxs: read correct values when setting up MAC
Subsystems (3)
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
Currently, the MAC address from the second ethernet is generated from the crypto-key (and not a customer reg) because of a wrong index to the ocotp array.
---
This looks clearly wrong to me; probably ocotp was a u8 somewhen in the process? I wonder how it works for these boards. Am I missing something?
arch/arm/mach-mxs/mach-m28evk.c | 2 +- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-mxs/mach-m28evk.c +1 -1
@@ -258,7 +258,7 @@ static int __init m28evk_fec_get_mac(void)* so hard-code DENX OUI (C0:E5:4E) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i]; mx28_fec_pdata[i].mac[0 ] =0xC0 ; mx28_fec_pdata[i].mac[1 ] =0xE5 ; mx28_fec_pdata[i].mac[2 ] =0x4E ;
arch/arm/mach-mxs/mach-mx28evk.c +1 -1
@@ -285,7 +285,7 @@ static int __init mx28evk_fec_get_mac(void)* so hard-code Freescale OUI (00:04:9f) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i]; mx28_fec_pdata[i].mac[0 ] =0x00 ; mx28_fec_pdata[i].mac[1 ] =0x04 ; mx28_fec_pdata[i].mac[2 ] =0x9f ;
Signature · 1 line
1.7.2.5
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
Quoted 9 lines · Wolfram Sang
Currently, the MAC address from the second ethernet is generated from the crypto-key (and not a customer reg) because of a wrong index to the ocotp array.
Signed-off-by Wolfram Sang <[email protected]>Cc Shawn Guo <[email protected]>Cc Stefano Babic <[email protected]>---
Hi Wolfram,
Quoted 2 lines
This looks clearly wrong to me; probably ocotp was a u8 somewhen in the process? I wonder how it works for these boards. Am I missing something?
Maybe you're right, but let's check with the manual:
Quoted 10 lines
arch/arm/mach-mxs/mach-m28evk.c | 2 +- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-mxs/mach-m28evk.c +0
-0
arch/arm/mach-mxs/mach-m28evk.c static int __init m28evk_fec_get_mac(void) · line 261
Quoted 5 lines
arch/arm/mach-mxs/mach-m28evk.c +1
-1@@ -258,7 +258,7 @@ static int __init m28evk_fec_get_mac(void)* so hard-code DENX OUI (C0:E5:4E) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i];
I can read that HW_OCOTP_CUST0 has the phisycal address 0x8002_C020h, and HW_OCOTP_CUST1 ist at 8002_C030h. So the two registers are not consecutive and there are some reserved fields between the two registers
- this is the reason for the i * 4.
HW_OCOTP_CRYPTO0 is at 8002_C060h, so it is not true that the address is currently read from the crypto-key. At least, this is my interpretation...
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 =====================================================================
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
Quoted 15 lines
arch/arm/mach-mxs/mach-m28evk.c static int __init m28evk_fec_get_mac(void) · line 261
Quoted 9 lines
arch/arm/mach-mxs/mach-m28evk.c +1
-1@@ -258,7 +258,7 @@ static int __init m28evk_fec_get_mac(void)* so hard-code DENX OUI (C0:E5:4E) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i];I can read that
HW_OCOTP_CUST0has the phisycal address 0x8002_C020h, andHW_OCOTP_CUST1ist at 8002_C030h. So the two registers are not consecutive and there are some reserved fields between the two registers
- this is the reason for the i * 4.
Quoted 2 lines
HW_OCOTP_CRYPTO0is at 8002_C060h, so it is not true that the address is currently read from the crypto-key. At least, this is my interpretation...
Ah, that explains... that you probably never tested the code? What about this in ocotp.c?
75 for (i = 0; i < OCOTP_WORD_COUNT; i++)
76 ocotp_words[i] = __raw_readl(ocotp_base + OCOTP_WORD_OFFSET +
77 i * 0x10);
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120125/63b98517/attachment.sig>
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
Quoted 12 lines · Wolfram Sang
Quoted 12 lines
Quoted 6 lines
---
a/arch/arm/mach-mxs/mach-m28evk.c+++b/arch/arm/mach-mxs/mach-m28evk.c@@ -258,7 +258,7 @@ static int__initm28evk_fec_get_mac(void)* so hard-code DENX OUI
(C0:E5:4E) here. */ for (i = 0; i < 2; i++) { - val = ocotp[i
* 4]; + val = ocotp[i];I can read that
HW_OCOTP_CUST0has the phisycal address 0x8002_C020h, andHW_OCOTP_CUST1ist at 8002_C030h. So the two registers are not consecutive and there are some reserved fields between the two registers - this is the reason for the i * 4.
Quoted 5 lines
Quoted 3 lines
HW_OCOTP_CRYPTO0is at 8002_C060h, so it is not true that the address is currently read from the crypto-key. At least, this is my interpretation...Ah, that explains... that you probably never tested the code?
..and that I don't remember very well...
Quoted 5 lines
What about this in
ocotp.c?75 for (i = 0; i <
OCOTP_WORD_COUNT; i++) 76
ocotp_words[i] =__raw_readl(ocotp_base + OCOTP_WORD_OFFSET + 77 i * 0x10);
You are right - and thanks for fixing it !
Stefano
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 =====================================================================
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
In reply to Wolfram SangQuoted 8 lines · Wolfram Sang
Currently, the MAC address from the second ethernet is generated from the crypto-key (and not a customer reg) because of a wrong index to the ocotp array.
Signed-off-by Wolfram Sang <[email protected]>Cc Shawn Guo <[email protected]>Cc Stefano Babic <[email protected]>---
Ping.
Quoted 37 lines
This looks clearly wrong to me; probably ocotp was a u8 somewhen in the process? I wonder how it works for these boards. Am I missing something?
arch/arm/mach-mxs/mach-m28evk.c | 2 +- arch/arm/mach-mxs/mach-mx28evk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-mxs/mach-m28evk.c +1
-1@@ -258,7 +258,7 @@ static int __init m28evk_fec_get_mac(void)* so hard-code DENX OUI (C0:E5:4E) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i]; mx28_fec_pdata[i].mac[0 ] =0xC0 ; mx28_fec_pdata[i].mac[1 ] =0xE5 ; mx28_fec_pdata[i].mac[2 ] =0x4E ;arch/arm/mach-mxs/mach-mx28evk.c +1
-1@@ -285,7 +285,7 @@ static int __init mx28evk_fec_get_mac(void)* so hard-code Freescale OUI (00:04:9f) here. */ for (i =0 ; i <2 ; i++) { - val = ocotp[i *4 ]; + val = ocotp[i]; mx28_fec_pdata[i].mac[0 ] =0x00 ; mx28_fec_pdata[i].mac[1 ] =0x04 ; mx28_fec_pdata[i].mac[2 ] =0x9f ;Signature · 1 line
1.7.2.5
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120131/57fff6c3/attachment.sig>
PATCH 1/1 ARM: mxs: read correct values when setting up MAC
Quoted 5 lines · Wolfram Sang
Quoted 4 lines · Wolfram Sang
Currently, the MAC address from the second ethernet is generated from the crypto-key (and not a customer reg) because of a wrong index to the ocotp array.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Wolfram Sang <[email protected]>Cc Shawn Guo <[email protected]>Cc Stefano Babic <[email protected]>---
Ping.
Just applied, thanks.
Signature · 2 lines
Regards, Shawn