Reading i.MX6DQ UID (Unique ID) from fusemap

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading i.MX6DQ UID (Unique ID) from fusemap

Reading i.MX6DQ UID (Unique ID) from fusemap

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.

Comments

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.

%3CLINGO-SUB%20id%3D%22lingo-sub-1129021%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EReading%20i.MX6DQ%20UID%20(Unique%20ID)%20from%20fusemap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129021%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EAccording%20to%20iMX6DQRM%20chapter%2046%20(On-Chip%20OTP%20Controller)%2C%20the%20UID%20field%20is%20located%20at%20offsets%200x410%20and%200x420%20from%20the%20base%20address%20of%20the%20OCOTP.%26nbsp%3B%20That%20is%3A%20OTP%20Bank0%20Word1%20-%20contains%20the%20first%20word%20of%20the%20UID%20OTP%20Bank0%20Word2%20-%20contains%20the%20second%20word%20of%20the%20UID.%3C%2FP%3E%3CP%3Emd.l%2021bc410%3C%2FP%3E%3CP%3E021bc410%3A%20d72d7372%20d72d7372%20d72d7372%20d72d7372%26nbsp%3B%26nbsp%3B%26nbsp%3B%20rs-.rs-.rs-.rs-.%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E021bc420%3A%20906709d4%20906709d4%20906709d4%20906709d4%3C%2FTD%3E%3CTD%3E..g...g...g...g.%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3EComparing%20to%20the%20read%20information%20under%20Linux%20shell%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3Ecat%20%2Fproc%2Fcpuinfo%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E.........%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3ESerial%20%3A%20906709d4d72d7372%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3EThe%20value%20is%20identical%20from%20uboot%20and%20linux%20kernel%20reading%20back.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22mce_paste_marker%22%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129023%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Reading%20i.MX6DQ%20UID%20(Unique%20ID)%20from%20fusemap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129023%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EOTP%20fuses%20can%20also%20be%20read%20from%20%3CSTRONG%3E%2Fsys%2Ffsl_otp%2FHW_OCOTP_CFG0%3C%2FSTRONG%3E%2C%20%3CSTRONG%3E%2Fsys%2Ffsl_otp%2FHW_OCOTP_CFG1%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThis%20is%20what%20I%20figured%20out%20while%20trying%20to%20find%20out%20why%20%2Fproc%2Fcpuinfo%20gives%20zeroes%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20the%20contents%20of%20%2Fproc%2Fcpuinfo%20are%20generated%20by%20c_show%20in%20arch%2Farm%2Fkernel%2Fsetup.c.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20c_show%20takes%20global%20values%20system_serial_high%20and%20system_serial_low.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20these%20two%20are%20in%20turn%20set%20in%20arch%2Farm%2Fkernel%2Fatags_parse.c%2C%20from%20a%20tag%20structure%20(atag)%20with%20ATAG_SERIAL%20identifier.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20ATAGs%20are%20passed%20to%20the%20kernel%20by%20the%20bootloader.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20u-boot%20has%20ATAG%20support%20in%20arch%2Farm%2Flib%2Fbootm.c%2C%20in%20this%20case%20if%20CONFIG_SERIAL_TAG%20is%20defined%2C%20setup_serial_tag%20exists%20and%20calls%20get_board_serial%20to%20get%20the%20serial%20number.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E-%20unfortunately%2C%20%E2%80%8Bget_board_serial%20is%20not%20implemented%20for%20i.MX6.%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22color%3A%20%23000000%3B%20font-family%3A%20Calibri%2C%20Arial%2C%20Helvetica%2C%20sans-serif%3B%20font-size%3A%2016px%3B%22%3EIt%20looks%20like%20support%20for%20this%20was%20dropped%20at%20some%20point%2C%20perhaps%20with%20a%20change%20in%20how%20the%20serial%20number%20is%20retrieved%20and%20passed%20on.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129022%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Reading%20i.MX6DQ%20UID%20(Unique%20ID)%20from%20fusemap%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129022%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EXia%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EWhen%20I%20read%20the%20SJC_CHALL%20%2F%20UNIQUE_ID%20this%20way%20on%20my%20WandBoard%20Quad%2C%20I%20just%20get%20zeros%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Ecat%20%2Fproc%2Fcpuinfo%3C%2FP%3E%3CP%3E...........%3C%2FP%3E%3CP%3ESerial%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%200000000000000000%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EBut%2C%20it%20works%20from%20u-boot%2C%20so%20I%20guess%20there%20must%20be%20a%20kernel%20mod%20required%20to%20access%20this%20from%20user%20space%3F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20think%20it%20is%20enabled%20in%20my%20Yocto%20recipe%20for%20the%20kernel%20build%2C%20as%20the%20defconfig%20file%20contains%20this%20setting%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3C%2FTD%3E%3CTD%3E%5CYocto%5Cfsl-community-bsp%5Csources%5Cmeta-fsl-arm%5Crecipes-kernel%5Clinux%5Clinux-imx-3.0.35%5Cmx6q%5Cdefconfig%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CONFIG_FSL_OTP%3Dy%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EBut%2C%20I%20have%20tried%20this%20on%20several%20different%20linux%20distros%20including%20Ubuntu%2C%20Yocto%20and%20Android%20and%20I%20always%20get%20just%20zeros.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EDo%20you%20have%20any%20idea%20why%3F%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThanks%2C%20Clay%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎03-31-2013 08:05 PM
Updated by: