The NXP i.MX6QP CPU provides a set of one-time programmable bits (eFuses) structured as 16 banks. Each bank is composed of eight words of 32 bits each.
|These bits can be blown just once. Programming them is an irreversible operation.
You can manage the OTP driver support through the kernel configuration options:
Freescale On-Chip OTP Memory Support (CONFIG_FSL_OTP)
This option gives you read-only access to the OTP bits and is enabled as built-in on the ConnectCore 6 Plus SBC kernel configuration file.
Writing support for Freescale On-Chip OTP Memory (CONFIG_FSL_OTP_WRITE)
This option is disabled on the kernel configuration file for security reasons and gives you write access to the OTP bits.
The OTP memory driver is located at:
Freescale On-Chip OTP driver
Device tree bindings
The i.MX6QP OTP memory driver device tree binding is documented at Documentation/devicetree/bindings/nvmem/imx-ocotp.txt.
compatible = "fsl,imx6q-ocotp", "syscon";
reg = <0x021bc000 0x4000>;
clocks = <&clks IMX6QDL_CLK_IIM>;
OTP user space usage
The OTP words are accessible through the sysfs at /sys/fsl_otp.
Use the cat command to read each word:
~# cat HW_OCOTP_MAC1 0x450
In order to program a word to the OTP bits, you must enable the kernel option CONFIG_FSL_OTP_WRITE.
|Programming the OTP bits is an irreversible operation that could potentially brick your module. Do not program the OTP bits unless you are sure of what you are doing. For more information, see the ConnectCore for i.MX6 Hardware Reference Manual.
The OTP words can be programmed using echo command followed by a 32-bits hexadecimal number prefixed by 0x:
~# echo 0xBA987654 > HW_OCOTP_MAC0
Blowing an OTP bit means converting it from 0 to 1.
A bit that has been blown and has the value 1 cannot be programmed back to 0.
A word can be written several times, but only the bits that are 0 can be changed to 1.
The LOCK word allows you to lock write access to groups of words.
The HW_OCOTP_MAC0 and HW_OCOTP_MAC1 words are reserved by Digi to program the module’s Hardware ID. (MAC addresses are programmed in the U-Boot environment.)