One-Time Programmable (OTP)
The NXP i.MX6 CPU provides a set of one-time programmable bits (e-fuses) structured as 16 banks. Each bank is composed of eight words of 32 bits each.
These 4096 reserved bits can be blown just once. Programming them is an irreversible operation.
Kernel configuration
You can manage the OTP driver support through the kernel configuration options:
- Freescale On-Chip OTP Memory Support (CONFIG_FSL_OTP)
This option is enabled as built-in on the default ConnectCore 6 SBC kernel configuration file and gives you read-only access to the OTP bits.
- Writing support for Freescale On-Chip OTP Memory (CONFIG_FSL_OTP_WRITE)
This option is disabled on the default ConnectCore 6 SBC kernel configuration file for security reasons and gives you write access to the OTP bits.
Platform driver mapping
The OTP driver for the i.MX6 is located at drivers/char/fsl-otp.c.
Device tree bindings
The device tree node for the OTP driver is defined in the common i.MX6 device tree file:
Common i.MX6 device tree
ocotp-fuse@021bc000 { compatible = "fsl,imx6q-ocotp"; reg = <0x021bc000 0x4000>; clocks = <&clks IMX6QDL_CLK_IIM>; };
OTP user space usage
The OTP words are accessible through the sysfs at /sys/fsl_otp.
Read access
Each word can be read using cat command:
root@ccimx6sbc:# cat HW_OCOTP_MAC1 0x450
Write access
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:
root@ccimx6sbc:/sys/fsl_otp# echo 0xBA987654 > HW_OCOTP_MAC0
Additional considerations
- Blowing an OTP bit means converting it from 0 to 1.
- A bit that's 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.
- There is a LOCK word whose bits allow you to lock write-access to groups of words.
- The HW_OCOTP_MAC0 and HW_OCOTP_MAC1 are reserved by Digi to program the CC6 module's Hardware ID (MAC addresses are programmed in the U-Boot environment).