IMX6UL: kernel 5.4.3: writing to OCOTP registers through nvmem interface

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

IMX6UL: kernel 5.4.3: writing to OCOTP registers through nvmem interface

979 Views
sikumar3
Contributor III

Hi,

we are migrating from Linux kernel 4.1.15 to 5.4.3 (yocto Zeus).

I noticed that the ocotp has been modified as a nvmem driver and I am able to perform read.

 

root@imx6ul:~# hexdump /sys/bus/nvmem/devices/imx-ocotp0/nvmem

0000000 c04f 0032 89dd ea9b 69d4 4110 001f 7032

0000010 0002 0241 0000 0000 004a 0018 0000 0000

0000020 0080 0000 0000 0000 00d0 0000 0000 0000

0000030 0000 0000 0000 0000 f069 5774 0000 0000

0000040 bada bada bada bada bada bada bada bada

*

0000060 687c 4869 8c6d da7e e74a 08f5 782f 0319

0000070 2e6d bab3 c759 050f 6f6c 2fd2 911f 4b7a

0000080 bada bada bada bada 0000 0000 0000 0000

0000090 0000 0000 bada bada 0000 0000 0000 0000

00000a0 0000 0000 0000 0000 0000 0000 0000 0000

00000b0 0000 0000 0040 0000 0000 0000 0000 0000

00000c0 0000 0000 0000 0000 0000 0000 0000 0000

*

0000200

root@imx6ul:~#

 

Since, there is an API imx_ocotp_write() to perform write operation in the drivers/nvmem/imx-ocotp.c, can we perform write operation from the userspace?

Our boards are fused in the factory through MfgTools. But, sometimes there is failure to write these fuses at the factory. So we have a script file to check whether the fuses are properly closed or not.

If they are not closed at the factory, then our script files running from userspace will take care of closing it. This was working fine with 4.1.15 kernel.

 

Can some one tell whether I will be able port this functionality to 5.4.3 kernel as well?

 

Regards,

Siva

0 Kudos
2 Replies

969 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi,

   Yes, your idea is correct. detailed steps, you can refer to the link:

https://community.nxp.com/t5/i-MX-Processors/OCOTP-write-support-on-i-mx8m/m-p/825028

 

Hope it is helpful to you.

Have a nice day!

B.R,

Weidong

0 Kudos

941 Views
sikumar3
Contributor III

Hi Weidong,

 

Thanks for the response!

I have gone through the thread and understand that we can write into OCOTP registers through the nvmem interface.

Is there any example code available which performs write to FUSE registers (SRK0.. SRK7, CFG0 etc)?

currently, we are using MfgTools with ucl.xml file to burn the fuses. Do we need to change this file content as well for 5.4.3 kernel?

 

<!-- program SRK_HASH fuse -->
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK0">Program SRK0 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK1">Program SRK1 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK2">Program SRK2 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK3">Program SRK3 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK4">Program SRK4 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd> /sys/fsl_otp/HW_OCOTP_SRK5">Program SRK5 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK6">Program SRK6 </CMD>
<CMD state="Updater" type="push" body="$ echo 0xabcdabcd > /sys/fsl_otp/HW_OCOTP_SRK7">Program SRK7 </CMD>

 

Regards,

Siva

0 Kudos