How to access the i.MX6 unique ID/serial number in Linux

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

How to access the i.MX6 unique ID/serial number in Linux

11,186 Views
compmas2
Contributor V

I am working with the 4.1.15 bsp release 1.1.1 for the i.MX6.  I am trying to obtain the unique ID/serial number that is available in the processor's fuses at address 0x410 and 0x420 in Linux.  I realize that I can enable the /sys/fsl_otp interface, but I don't want that exposed in production runtime images because accidental writes could cause the processor to stop functioning correctly.  What I would really like is for the /proc/cpuinfo output to populate the Serial line with the unique number from the fuses.

It appears u-boot is capable of passing the serial number off to the Linux kernel through ATAGS, but with the use of device trees now I don't know if this is possible anymore.  In u-boot, my board .h file has the "#define CONFIG_SERIAL_TAG" which is supposed to pass off CPU serial information to Linux.

Additionally it would be nice if the revision of the processor (fuse address 0x430[19:16]) could also be supported in the /proc/cpuinfo data too.

Does anyone have any idea why this doesn't work and how to fix this?

5 Replies

6,806 Views
b36401
NXP Employee
NXP Employee

You can read these fuses from sysfs:

# cat /sys/fsl_otp/HW_OCOTP_CFG0
0xd72d7394
# cat /sys/fsl_otp/HW_OCOTP_CFG1
0xf1361d4
#

Have a great day,
Victor

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

0 Kudos
Reply

6,806 Views
compmas2
Contributor V

Victor,

This is what I stated in the original post as something I was aware of but that I did not want to expose the fuses in my runtime environment because of the risk of setting fuses which could break functionality or prevent booting.  I am mainly looking for if there is a native way to pass the serial number from the bootloader to the Linux kernel so the kernel interfaces for obtaining the CPU serial number work.

- Matt

0 Kudos
Reply

6,806 Views
titggtu
Contributor II

Matthew, did you manage to get access to a unique processor ID from under the Linux kernel?  Would you share a solution to this problem?

0 Kudos
Reply

6,806 Views
compmas2
Contributor V

Alexey, I did not get the processor serial number passing through the kernel working without the fsl_otp driver enabled.  I ended up implementing my own serial numbering system used by my company for uniqueness.

0 Kudos
Reply

6,806 Views
titggtu
Contributor II

Thanks for the answer!

As a result of finding a solution to this problem, the following thought arose.
At the stage of loading in U-Boot, you can read the "unique ID" (addr. 0x021bc410, 0x021bc420 ) with the "md" command, and then put the result as a parameter in the *.dts file. After loading Linux, parameters from the *.dts file can be read from the path /sys/bus/soc/devices/soc0 /parameters, where they are stored as files.

0 Kudos
Reply