i.MX6 SX OTP MAC

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX6 SX OTP MAC

446 Views
Contributor III

I have a simple script I've been using to program the OTP MAC registers, worked fine on the current boards. Just got new rev of boards and now MAC2 will not program, always shows as 0x0; MAC0/MAC1 program just fine. Any idea's?

root@cpng:~# la /sys/fsl_otp/HW_OCOTP_MAC*
-rw------- 1 root root 4096 Oct 5 11:13 /sys/fsl_otp/HW_OCOTP_MAC0
-rw------- 1 root root 4096 Oct 5 11:13 /sys/fsl_otp/HW_OCOTP_MAC1
-rw------- 1 root root 4096 Oct 5 11:13 /sys/fsl_otp/HW_OCOTP_MAC2
root@cpng:~# cat /sys/fsl_otp/HW_OCOTP_MAC*
0x4b007053
0x7054001f
0x0
root@cpng:~# cat macaddr

#!/bin/sh

if [ "$1" = "" ]
then
    echo "Usage: macaddr <colon seperated MAC address>"
    exit 1
fi

mac_addr0=$1

# get each byte of MAC address 0
mac0_byte0=`echo ${mac_addr0} | cut -d: -f6`
mac0_byte1=`echo ${mac_addr0} | cut -d: -f5`
mac0_byte2=`echo ${mac_addr0} | cut -d: -f4`
mac0_byte3=`echo ${mac_addr0} | cut -d: -f3`
mac0_byte4=`echo ${mac_addr0} | cut -d: -f2`
mac0_byte5=`echo ${mac_addr0} | cut -d: -f1`

# if they passed a second MAC address, use it
if [ "$2" != "" ]
then
    mac_addr1=$2

    # get each byte of MAC address 1
    mac1_byte0=`echo ${mac_addr1} | cut -d: -f6`
    mac1_byte1=`echo ${mac_addr1} | cut -d: -f5`
    mac1_byte2=`echo ${mac_addr1} | cut -d: -f4`
    mac1_byte3=`echo ${mac_addr1} | cut -d: -f3`
    mac1_byte4=`echo ${mac_addr1} | cut -d: -f2`
    mac1_byte5=`echo ${mac_addr1} | cut -d: -f1`

else
    # if not, use MAC address 0 and increment byte0
    mac1_byte0=`printf %X $((0x$mac0_byte0 + 1))`
    mac1_byte1=$mac0_byte1
    mac1_byte2=$mac0_byte2
    mac1_byte3=$mac0_byte3
    mac1_byte4=$mac0_byte4
    mac1_byte5=$mac0_byte5
fi

# mash it all together into 3 32-bit values
MAC0=${mac0_byte3}${mac0_byte2}${mac0_byte1}${mac0_byte0}
MAC1=${mac1_byte1}${mac1_byte0}${mac0_byte5}${mac0_byte4}
MAC2=${mac1_byte5}${mac1_byte4}${mac1_byte3}${mac1_byte2}

echo MAC0 = $MAC0
echo -n $MAC0 > /sys/fsl_otp/HW_OCOTP_MAC0
echo MAC1 = $MAC1
echo -n $MAC1 > /sys/fsl_otp/HW_OCOTP_MAC1
echo MAC2 = $MAC2
echo -n $MAC2 > /sys/fsl_otp/HW_OCOTP_MAC2

exit 0

Labels (2)
0 Kudos
4 Replies

144 Views
Contributor III

Ok, new round of boards, same old problem: I cannot program MAC2!

So I put several debug statements in this time, the process of programming MAC0 and MAC1 appears exactly the same as MAC2, but MAC2 either does not program or gets programmed with 0x00000000!

I added a dump of the lock register, the lock bits for the MAC region are NOT set:

root@NEBULA001F4B007043:~# ./macaddr 00:1f:4b:00:70:4e
MAC0 = 4b00704e

drivers/char/fsl_otp.c-fsl_otp_store() index = 34, buf = "4b00704e", value = 0x4B00704E
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x20820002 from lock register 0xA11C0400
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x00000000 from ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x3E770022 to ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x4B00704E to data register 0xA11C0020

MAC1 = 704f001f

drivers/char/fsl_otp.c-fsl_otp_store() index = 35, buf = "704f001f", value = 0x704F001F
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x20820002 from lock register 0xA11C0400
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x00000022 from ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x3E770023 to ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x704F001F to data register 0xA11C0020

MAC2 = 001f4b00

drivers/char/fsl_otp.c-fsl_otp_store() index = 36, buf = "001f4b00", value = 0x001F4B00
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x20820002 from lock register 0xA11C0400
drivers/char/fsl_otp.c-imx6_otp_write_bits() reading data = 0x00000023 from ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x3E770024 to ctrl register 0xA11C0004
drivers/char/fsl_otp.c-imx6_otp_write_bits() writing data = 0x001F4B00 to data register 0xA11C0020

root@NEBULA001F4B007043:~# cat /sys/fsl_otp/HW_OCOTP_MAC?
drivers/char/fsl_otp.c-fsl_otp_show() reading data = 0x4B00704E from register 0xA11C0620
0x4b00704e
drivers/char/fsl_otp.c-fsl_otp_show() reading data = 0x704F001F from register 0xA11C0630
0x704f001
fdrivers/char/fsl_otp.c-fsl_otp_show() reading data = 0x00000000 from register 0xA11C0640
0x0
root@NEBULA001F4B007043:~#

0 Kudos

144 Views
Contributor III

Is no one else having any OTP issues?

0 Kudos

144 Views
NXP TechSupport
NXP TechSupport

Please make sure that the fuses are not locked with MAC_ADDR_LOCK bits.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

144 Views
Contributor III

Thanks...shouldn't that lock all MAC ADDR OTP's? MAC0 and MAC1 program fine, it's only MAC2 that will not take the value I write to it.

0 Kudos