Here is my u-boot/linux DTS configuration:
fsl,pins = <
IMX8QXP_CSI_D05 3 0x00000060
>;
(as IMX8QXP_CSI_D05_SNVS_TAMPER_IN0 is not defined in pads-imx8qxp.h, I have to define "IMX8QXP_CSI_D05 3")
1) u-boot steps
If I do the configuration with u-boot, I tried 3 different commands in 3 different tests:
snvs_cfg 1f0703ff 8000003f 3000007f 1f0003ff 36 00800000 276 0 0 0 84001111 0 0 0 0 00010001 0 1 0
snvs_cfg 1f0703ff 8000003f 3000007f 1f0003ff 36 00800000 276 ff 0 0 84001111 0 0 0 0 001f001f 0 1 0
snvs_cfg 00000000 8000003f 3000007f 00000000 3f 00000000 776 ff 0 0 84001111 0 0 0 0 001f001f 0 1 0
But when I modify the tamper (with just removing a jumper on the board), it does not modify any SNVS registers (I used snvs_sec_status, you can see the result of this command in my last post)
So which snvs_cfg parameters do I need to use?
How to see any modification when I put/remove the tamper jumper?
2) linux steps
Now I tried on linux.
I am using imx-secvio-sc.c file.
I add at the beginning of the imx_secvio_sc_ioctl() function:
u32 val0=0;
u32 val1=0;
ret = call_secvio_config(dev, 0x18, SECVIO_CONFIG_WRITE, &val0, NULL, NULL, NULL, NULL, 1);
if (ret) {
printk("1-Error Reg 18: %d\n", ret);
}
ret = call_secvio_config(dev, 0x48, SECVIO_CONFIG_WRITE, &val0, &val1, NULL, NULL, NULL, 2);
if (ret) {
printk("2-Error Reg 48+A0: %d\n", ret);
}
ret = call_secvio_config(dev, 0x48, SECVIO_CONFIG_WRITE, &val0, NULL, NULL, NULL, NULL, 1);
if (ret) {
printk("3-Error Reg 48: %d\n", ret);
}
ret = call_secvio_config(dev, 0xA0, SECVIO_CONFIG_WRITE, &val0, NULL, NULL, NULL, NULL, 1);
if (ret) {
printk("4-Error Reg A0: %d\n", ret);
}
ret = call_secvio_config(dev, 0x18, SECVIO_CONFIG_WRITE, &val0, NULL, NULL, NULL, NULL, 1);
if (ret) {
printk("5-Error Reg 18: %d\n", ret);
}
return 0;// So I ignore the code after this
I launch this command on my target:
./ioctl /dev/secvio-sc 1
And here is the result:
[ 27.953802] 2-Error Reg 48+A0: -32
[ 27.957344] 3-Error Reg 48: -22
[ 27.965539] 4-Error Reg A0: -22
So I can modify Reg 18 but not 48, A0.
How can I modify Reg A0?
If I succeed, which C function which can tell me the tamper has detected something?
Just note I had to modfy imx-secvio-sc.c file as I had another issue: when opening /dev/secvio-sc, node->i_private was null and not equal to 'dev' structure.
So I did some patch.
I created :
struct device *mydev=0;
In call_secvio_config(), I add this instruction:
if (mydev==0) mydev=dev;
In imx_secvio_sc_open(), I replace this instruction:
filp->private_data = mydev;//node->i_private;