-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I am trying to make the MA35D1's TRNG module work without op-tee. According to Nuvoton's documentation, this should be possible. Here is what I am doing:
-
In the TF-A, in the device tree, I set the TRNG as accessible from the non-secure environment:
<TRNG_TZNS>, -
In the Linux kernel, in my own device tree, I override the "optee_nuvoton" property of ma35d1.dtsi as "no", as the documentation suggests:
&trng { optee_nuvoton = "no"; status = "okay"; };
- In the defconfig for the kernel, I enable the HW_RANDOM_MA35D1 option and disable the optee support for hw_random:
CONFIG_HW_RANDOM_MA35D1=y
# CONFIG_HW_RANDOM_OPTEE is not set
After rebuilding everything (TF-A & kernel included), I can see that the driver found in drivers/char/hw_random/ma35d1-trng.c is included in the linux kernel, but it fails during initialization. What I could see is that inside ma35d1_trng_init() calls ma35d1_trng_gen_noise(), and, inside this function, the following function call is performed:
err = ma35d1_trng_issue_command(tdev, TCMD_GEN_NOISE);
Inside the ma35d1_trng_issue_command() function, after writing the command to the CTRL register, it repeatedly checks that the ISTAT_DONE flag is activated on the ISTAT register, but this never happens so EBUSY is returned.
The result is that, during the kernel init process, after a 2 second timeout, the following message is printed:
nuvoton-trng: probe of 40b90000.trng failed with error -16
I have tried to get information about these registers but the TRNG is not documented in the MA35D1 Reference Manual (I guess this is done on purpose for security reasons). So can't know why the ISTAT register is not returning the expected value. I guess this must be a bug in the driver, something must not be done properly. Can you clarify what's going on?