According to iMX6DQRM chapter 46 (On-Chip OTP Controller), the UID field is located at offsets 0x410 and 0x420 from the base address of the OCOTP. That is: OTP Bank0 Word1 - contains the first word of the UID OTP Bank0 Word2 - contains the second word of the UID.
md.l 21bc410
021bc410: d72d7372 d72d7372 d72d7372 d72d7372 rs-.rs-.rs-.rs-.
021bc420: 906709d4 906709d4 906709d4 906709d4 | ..g...g...g...g. |
Comparing to the read information under Linux shell:
cat /proc/cpuinfo
.........
Serial : 906709d4d72d7372
The value is identical from uboot and linux kernel reading back.
Xia,
When I read the SJC_CHALL / UNIQUE_ID this way on my WandBoard Quad, I just get zeros:
cat /proc/cpuinfo
...........
Serial : 0000000000000000
But, it works from u-boot, so I guess there must be a kernel mod required to access this from user space?
I think it is enabled in my Yocto recipe for the kernel build, as the defconfig file contains this setting:
\Yocto\fsl-community-bsp\sources\meta-fsl-arm\recipes-kernel\linux\linux-imx-3.0.35\mx6q\defconfig |
CONFIG_FSL_OTP=y
But, I have tried this on several different linux distros including Ubuntu, Yocto and Android and I always get just zeros.
Do you have any idea why?
Thanks, Clay
OTP fuses can also be read from /sys/fsl_otp/HW_OCOTP_CFG0, /sys/fsl_otp/HW_OCOTP_CFG1.
This is what I figured out while trying to find out why /proc/cpuinfo gives zeroes:
- the contents of /proc/cpuinfo are generated by c_show in arch/arm/kernel/setup.c.
- c_show takes global values system_serial_high and system_serial_low.
- these two are in turn set in arch/arm/kernel/atags_parse.c, from a tag structure (atag) with ATAG_SERIAL identifier.
- ATAGs are passed to the kernel by the bootloader.
- u-boot has ATAG support in arch/arm/lib/bootm.c, in this case if CONFIG_SERIAL_TAG is defined, setup_serial_tag exists and calls get_board_serial to get the serial number.
- unfortunately, get_board_serial is not implemented for i.MX6.
It looks like support for this was dropped at some point, perhaps with a change in how the serial number is retrieved and passed on.