Hello!
We are trying to create a separate boot-time utility that will handle the programming of the OTP memory (programming the secure key, and handle the locking part).
We already have an early loader with the purpose to launch linux (not using u-boot), it's a sort of a shim loader that mainly unpacks the kernel, places the device tree at the right location and then launch linux in EL3.
This part has been working fine for us.
Now we want to add some additional functionality in it that enables it to program the OTP memory in a separate boot flow.
In a first attempt, we try to just simply read something out from the OTP memory in order to see that we at least can access it.
We are using the OTP service api in the cces libraries (adi_otp_v1).
We call adi_otp_Open() providing a sufficient memory for it and a status callback.
Then call adi_otp_SecurityEnable() with the returned handle with false as parameter (to enable the access to the memory).
Then we try to just read out any part of the otp memory. As an example we try to read out using adi_otp_Read() with the ADI_OTPCMD_PVTKEY0 as a command.
Here is where we fail, with some uart-logging we can see that we end up in the internal do_read() function where it gets stuck (it seems like it's only derefencing the otp memory pointer to read out the requested data).
We do not get any calls back from the SMPU in our provided status handler.
This leads us to think that may need to initialize or set something else up before we start using the service.
We cannot find any usage examples of this api anywhere and are out of ideas what is missing or what goes wrong here.
Is there anything else that must be prepared before using this api? Some specific clocks set up (CGU/CDU), or some other stuff in the SPU or the SMPU, or maybe even something specific in the MMU?
We can see that there are slight changes in the code for this otp service in the latest CCES 3.0.1, but haven't tried it yet. This makes us wonder if this api was working in CCES 2.11.1 at all.
The 3.0.1 version appears to omit the SMPU setup, if the target is SC598.
Grateful for some ideas or directions for accessing the OTP memory (any code examples would be great).
Best Regards,
Lars