Hello,
I have an anomaly in the addressing of OTP memory access.
I am using uboot to write to the OTP shadow registers, then I am reading OTP in my application using the nvmem file access in /sys/bus/nvmem/devices/imx-ocotp0/nvmem.
(Eventually, I will use the prog command to permanently write fuse OTP memory, but I'm just using override while in development.)
For experimentation, I am overriding bank 12 word 7, with value 0x12000007, and then read this value back to verify it.
I do the same kind of thing with banks 13, 14, 15, so I can track bank word values to memory addressed values in the nvmem dump.
When I subsequently boot the device (not reboot, which would reset the overrides!) the nvmem file access addressing does not make sense.
I expected the bank/word byte address to start at 4*(8*b + w), where b is bank and w is word. e.g. for bank 15, word 7, the byte address is 4*(8*15 + 7) = 508 = 0x1fc, so the word occupies bytes at 0x1fc to 0x1ff.
and bank 12, word 0 should start at byte address 4*(8*12 + 0) = 0x180.
However, my value (0x12000000) for bank 12, word 0 actually appears at byte address 0x1c0, which is where bank 14, word 0 should be.
And my value (0x12000007) for bank 12, word 7 actually appears at byte address 0x1dc, which is where bank 14, word 7 should be.
Furthermore, the values for banks 14 and 15 do not appear anywhere in the nvmem dump.
Please see below for uboot command log and subsequent nvmem dump.
Can anyone suggest a reason for this anomaly? Is my address arithmetic correct? Why can't I see banks 14 & 15 in the nvmem dump?
Thanks,
Tom.
NAME="NXP i.MX Release Distro"
VERSION="5.10-hardknott (hardknott)"
VERSION_ID=5.10-hardknott
Note, in the fuse command, bank address 12 is DECIMAL not hex, however the value IS in hex. For hex bank address, you would use "fuse override 0xc 0 12000000"
=> fuse override 12 0 12000000
Overriding bank 12 word 0x00000000 with 0x12000000...
=> fuse override 13 0 13000000
Overriding bank 13 word 0x00000000 with 0x13000000...
=> fuse override 14 0 14000000
Overriding bank 14 word 0x00000000 with 0x14000000...
=> fuse override 15 0 15000000
Overriding bank 15 word 0x00000000 with 0x15000000...
=> fuse override 12 7 12000007
Overriding bank 12 word 0x00000007 with 0x12000007...
=> fuse override 13 7 13000007
Overriding bank 13 word 0x00000007 with 0x13000007...
=> fuse override 14 7 14000007
Overriding bank 14 word 0x00000007 with 0x14000007...
=> fuse override 15 7 15000007
Overriding bank 15 word 0x00000007 with 0x15000007...
=> fuse read 12 0
Reading bank 12:
Word 0x00000000: 12000000
=> fuse read 13 0
Reading bank 13:
Word 0x00000000: 13000000
=> fuse read 14 0
Reading bank 14:
Word 0x00000000: 14000000
=> fuse read 15 0
Reading bank 15:
Word 0x00000000: 15000000
=> fuse read 12 7
Reading bank 12:
Word 0x00000007: 12000007
=> fuse read 13 7
Reading bank 13:
Word 0x00000007: 13000007
=> fuse read 14 7
Reading bank 14:
Word 0x00000007: 14000007
=> fuse read 15 7
Reading bank 15:
Word 0x00000007: 15000007
root@smartcom:~# hexdump /sys/bus/nvmem/devices/imx-ocotp0/nvmem
0000000 8003 00b2 6b3c d965 79d4 3d28 0050 78f2
0000010 2502 0241 0000 0000 0040 0008 0000 0000
0000020 0080 0000 0000 0000 0093 0000 0000 0000
0000030 0000 0000 0000 0000 0569 5955 0000 0000
0000040 bada bada bada bada bada bada bada bada
*
0000060 0000 0000 0000 0000 0000 0000 0000 0000
*
0000080 0000 0000 0000 0000 8221 287e 8034 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
*
0000100 0801 5500 29d8 0000 2d20 da01 0801 5500
0000110 2a04 0000 f11a 9afc 2003 5500 d000 0091
0000120 6860 b110 68a6 42ae d300 462e 68e0 4540
0000130 d001 f6e5 9cfe f6e5 9d00 0000 0000 0000
0000140 0000 0000 0000 0000 0000 0000 0000 0000
*
00001c0 0000 1200 0000 0000 0000 0000 0000 0000
00001d0 0000 0000 0000 0000 0000 0000 0007 1200
00001e0 0000 1300 0000 0000 0000 0000 0000 0000
00001f0 0000 0000 0000 0000 0000 0000 0007 1300
0000200