we have an existing product based on the IMX7D architecture which we are updating from linux V4.14 to V5..4.40.
On the V4.14 build the product used the fsl_otp driver to read and write the fuses. As this is no longer supported, we are moving to use the NVMEM driver and imx_otp driver.
Checking the device tree include files, there is the following ocotp entry in imx7s.dtsi
Following the solution posted by NXP here https://community.nxp.com/t5/i-MX-Processors/OCOTP-write-support-on-i-mx8m/m-p/825028 (Note: I have checked that the contents of the patch provided in the answer is present in the driver version I am using).
I should now be able to read the content of the nvmem file using hexdump. However I cant.
I have two devices appearing in the /sys/bus/devices/ directory. one is a real time clock included in our top level device tree, the other is the imx_ocotp node.
I can read the content of the ds1307 device
However I cant read the nvmem of the ocotp device.
Because we can read the other device I think it is safe to assume that the NVMEM functionality is working. Which leads me to suspect that the imx_ocotp driver is not working?
I've tried using different versions of the driver and different entries in the device tree files to no avail. Am I missing any steps here or is the driver not working on this build of linux?
Unfortunately I don't have an i.MX7D board to test, but I tested this in an i.MX6UL with pre-built image L5.4.47 and it is working correctly, could you try with 5.4.47 version?
Also, could you share the changes you have made to the dts?
Thanks for your response. I have rebuilt my image with linux kernel 5.4.47 and retried reading the imx-ocotp NVMEM file. I get the same behaviour.
Note: whilst we are using a custom top level device tree ( based on the imx7-sabre device tree), there are no entries related to the ocotp. We are relying on the device tree include files to configure the ocotp. Our top level device tree includes the imx7d.dtsi which subsequently includes the imx7s.dtsi. These include files are in the linux source files.
i.e. linux-5.4.47/arch/arm/boot/dts/imx7s.dtsi (I've attached a screenshot showing how this file configures the ocotp peripheral)
I have also tried to get this working on the imx7d sabre board using buildroot's imx7d sabre board default config. This config uses an old version of the freescale linux repository (rel_imx_4.9.x_1.0.0_ga) which doesnt support the imx_ocotp driver. I then manually added this driver to no avail.
Is there a build for the imx7d sabre board where this is working?. I'm consious that the imx6ulp is a not a very good comparison to make, as it is a different chipset.
Could you try with demo image for imx7d sabre board and try again the NVMEM driver?
you may download it from here:
Also, could you try reading the fuses from uboot?
fuse read <bank> <word>
Thanks again for your response. I booted the imx7d-sdb.dtb and zImage files given (on the imx7d-sabre board) and using this I could successfully read the nvmem.
Could you tell me how I could get the source files for this build? I would like to compare the device trees and kernel options to my environment.