xref: /arm-trusted-firmware/docs/plat/nxp/nxp-ls-fuse-prov.rst (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu
2*91f16700SchasingluluSteps to blow fuses on NXP LS SoC:
3*91f16700Schasinglulu==================================
4*91f16700Schasinglulu
5*91f16700Schasinglulu
6*91f16700Schasinglulu- Enable POVDD
7*91f16700Schasinglulu  -- Refer board GSG(Getting Started Guide) for the steps to enable POVDD.
8*91f16700Schasinglulu  -- Once the POVDD is enabled, make sure to set variable POVDD_ENABLE := yes, in the platform.mk.
9*91f16700Schasinglulu
10*91f16700Schasinglulu+---+-----------------+-----------+------------+-----------------+-----------------------------+
11*91f16700Schasinglulu|   |   Platform      |  Jumper   |  Switch    | LED to Verify   |  Through GPIO Pin (=number) |
12*91f16700Schasinglulu+===+=================+===========+============+=================+=============================+
13*91f16700Schasinglulu| 1.| lx2160ardb      |  J9       |            |                 |             no              |
14*91f16700Schasinglulu+---+-----------------+-----------+------------+-----------------+-----------------------------+
15*91f16700Schasinglulu| 2.| lx2160aqds      |  J35      |            |                 |             no              |
16*91f16700Schasinglulu+---+-----------------+-----------+------------+-----------------+-----------------------------+
17*91f16700Schasinglulu| 3.| lx2162aqds      |  J35      | SW9[4] = 1 |    D15          |             no              |
18*91f16700Schasinglulu+---+-----------------+-----------+------------+-----------------+-----------------------------+
19*91f16700Schasinglulu
20*91f16700Schasinglulu- SFP registers to be written to:
21*91f16700Schasinglulu
22*91f16700Schasinglulu+---+----------------------------------+----------------------+----------------------+
23*91f16700Schasinglulu|   |   Platform                       |   OTPMKR0..OTPMKR7   |   SRKHR0..SRKHR7     |
24*91f16700Schasinglulu+===+==================================+======================+======================+
25*91f16700Schasinglulu| 1.| lx2160ardb/lx2160aqds/lx2162aqds | 0x1e80234..0x1e80250 | 0x1e80254..0x1e80270 |
26*91f16700Schasinglulu+---+----------------------------------+----------------------+----------------------+
27*91f16700Schasinglulu
28*91f16700Schasinglulu- At U-Boot prompt, verify that SNVS register - HPSR, whether OTPMK was written, already:
29*91f16700Schasinglulu
30*91f16700Schasinglulu+---+----------------------------------+-------------------------------------------+---------------+
31*91f16700Schasinglulu|   |   Platform                       |           OTPMK_ZERO_BIT(=value)          | SNVS_HPSR_REG |
32*91f16700Schasinglulu+===+==================================+===========================================+===============+
33*91f16700Schasinglulu| 1.| lx2160ardb/lx2160aqds/lx2162aqds | 27 (= 1 means not blown, =0 means blown)  | 0x01E90014    |
34*91f16700Schasinglulu+---+----------------------------------+-------------------------------------------+---------------+
35*91f16700Schasinglulu
36*91f16700SchasingluluFrom u-boot prompt:
37*91f16700Schasinglulu
38*91f16700Schasinglulu  --  Check for the OTPMK.
39*91f16700Schasinglulu   .. code:: shell
40*91f16700Schasinglulu
41*91f16700Schasinglulu        md $SNVS_HPSR_REG
42*91f16700Schasinglulu
43*91f16700Schasinglulu      Command Output:
44*91f16700Schasinglulu          01e90014: 88000900
45*91f16700Schasinglulu
46*91f16700Schasinglulu          In case it is read as 00000000, then read this register using jtag (in development mode only through CW tap).
47*91f16700Schasinglulu                       +0       +4       +8       +C
48*91f16700Schasinglulu          [0x01E90014] 88000900
49*91f16700Schasinglulu
50*91f16700Schasinglulu          Note: OTPMK_ZERO_BIT is 1, indicating that the OTPMK is not blown.
51*91f16700Schasinglulu
52*91f16700Schasinglulu  --  Check for the SRK Hash.
53*91f16700Schasinglulu   .. code:: shell
54*91f16700Schasinglulu
55*91f16700Schasinglulu        md $SRKHR0 0x10
56*91f16700Schasinglulu
57*91f16700Schasinglulu      Command Output:
58*91f16700Schasinglulu          01e80254: 00000000 00000000 00000000 00000000    ................
59*91f16700Schasinglulu          01e80264: 00000000 00000000 00000000 00000000    ................
60*91f16700Schasinglulu
61*91f16700Schasinglulu          Note: Zero means that SRK hash is not blown.
62*91f16700Schasinglulu
63*91f16700Schasinglulu- If not blown, then from the U-Boot prompt, using following commands:
64*91f16700Schasinglulu  --  Provision the OTPMK.
65*91f16700Schasinglulu
66*91f16700Schasinglulu   .. code:: shell
67*91f16700Schasinglulu
68*91f16700Schasinglulu        mw.l $OTPMKR0  <OTMPKR_0_32Bit_val>
69*91f16700Schasinglulu        mw.l $OTPMKR1  <OTMPKR_1_32Bit_val>
70*91f16700Schasinglulu        mw.l $OTPMKR2  <OTMPKR_2_32Bit_val>
71*91f16700Schasinglulu        mw.l $OTPMKR3  <OTMPKR_3_32Bit_val>
72*91f16700Schasinglulu        mw.l $OTPMKR4  <OTMPKR_4_32Bit_val>
73*91f16700Schasinglulu        mw.l $OTPMKR5  <OTMPKR_5_32Bit_val>
74*91f16700Schasinglulu        mw.l $OTPMKR6  <OTMPKR_6_32Bit_val>
75*91f16700Schasinglulu        mw.l $OTPMKR7  <OTMPKR_7_32Bit_val>
76*91f16700Schasinglulu
77*91f16700Schasinglulu  --  Provision the SRK Hash.
78*91f16700Schasinglulu
79*91f16700Schasinglulu   .. code:: shell
80*91f16700Schasinglulu
81*91f16700Schasinglulu        mw.l $SRKHR0  <SRKHR_0_32Bit_val>
82*91f16700Schasinglulu        mw.l $SRKHR1  <SRKHR_1_32Bit_val>
83*91f16700Schasinglulu        mw.l $SRKHR2  <SRKHR_2_32Bit_val>
84*91f16700Schasinglulu        mw.l $SRKHR3  <SRKHR_3_32Bit_val>
85*91f16700Schasinglulu        mw.l $SRKHR4  <SRKHR_4_32Bit_val>
86*91f16700Schasinglulu        mw.l $SRKHR5  <SRKHR_5_32Bit_val>
87*91f16700Schasinglulu        mw.l $SRKHR6  <SRKHR_6_32Bit_val>
88*91f16700Schasinglulu        mw.l $SRKHR7  <SRKHR_7_32Bit_val>
89*91f16700Schasinglulu
90*91f16700Schasinglulu      Note: SRK Hash should be carefully written keeping in mind the SFP Block Endianness.
91*91f16700Schasinglulu
92*91f16700Schasinglulu- At U-Boot prompt, verify that SNVS registers for OTPMK are correctly written:
93*91f16700Schasinglulu
94*91f16700Schasinglulu  --  Check for the OTPMK.
95*91f16700Schasinglulu   .. code:: shell
96*91f16700Schasinglulu
97*91f16700Schasinglulu        md $SNVS_HPSR_REG
98*91f16700Schasinglulu
99*91f16700Schasinglulu      Command Output:
100*91f16700Schasinglulu          01e90014: 80000900
101*91f16700Schasinglulu
102*91f16700Schasinglulu          OTPMK_ZERO_BIT is zero, indicating that the OTPMK is blown.
103*91f16700Schasinglulu
104*91f16700Schasinglulu          Note: In case it is read as 00000000, then read this register using jtag (in development mode only through CW tap).
105*91f16700Schasinglulu
106*91f16700Schasinglulu   .. code:: shell
107*91f16700Schasinglulu
108*91f16700Schasinglulu        md $OTPMKR0 0x10
109*91f16700Schasinglulu
110*91f16700Schasinglulu      Command Output:
111*91f16700Schasinglulu          01e80234: ffffffff ffffffff ffffffff ffffffff    ................
112*91f16700Schasinglulu          01e80244: ffffffff ffffffff ffffffff ffffffff    ................
113*91f16700Schasinglulu
114*91f16700Schasinglulu          Note: OTPMK will never be visible in plain.
115*91f16700Schasinglulu
116*91f16700Schasinglulu  --  Check for the SRK Hash. For example, if following SRK hash is written:
117*91f16700Schasinglulu
118*91f16700Schasinglulu       SFP SRKHR0 = fdc2fed4
119*91f16700Schasinglulu       SFP SRKHR1 = 317f569e
120*91f16700Schasinglulu       SFP SRKHR2 = 1828425c
121*91f16700Schasinglulu       SFP SRKHR3 = e87b5cfd
122*91f16700Schasinglulu       SFP SRKHR4 = 34beab8f
123*91f16700Schasinglulu       SFP SRKHR5 = df792a70
124*91f16700Schasinglulu       SFP SRKHR6 = 2dff85e1
125*91f16700Schasinglulu       SFP SRKHR7 = 32a29687,
126*91f16700Schasinglulu
127*91f16700Schasinglulu       then following would be the value on dumping SRK hash.
128*91f16700Schasinglulu
129*91f16700Schasinglulu   .. code:: shell
130*91f16700Schasinglulu
131*91f16700Schasinglulu        md $SRKHR0 0x10
132*91f16700Schasinglulu
133*91f16700Schasinglulu      Command Output:
134*91f16700Schasinglulu          01e80254: d4fec2fd 9e567f31 5c422818 fd5c7be8    ....1.V..(B\.{\.
135*91f16700Schasinglulu          01e80264: 8fabbe34 702a79df e185ff2d 8796a232    4....y*p-...2...
136*91f16700Schasinglulu
137*91f16700Schasinglulu          Note: SRK Hash is visible in plain based on the SFP Block Endianness.
138*91f16700Schasinglulu
139*91f16700Schasinglulu- Caution: Donot proceed to the next step, until you are sure that OTPMK and SRKH are correctly blown from above steps.
140*91f16700Schasinglulu  -- After the next step, there is no turning back.
141*91f16700Schasinglulu  -- Fuses will be burnt, which cannot be undo.
142*91f16700Schasinglulu
143*91f16700Schasinglulu- Write SFP_INGR[INST] with the PROGFB(0x2) instruction to blow the fuses.
144*91f16700Schasinglulu  -- User need to save the SRK key pair and OTPMK Key forever, to continue using this board.
145*91f16700Schasinglulu
146*91f16700Schasinglulu+---+----------------------------------+-------------------------------------------+-----------+
147*91f16700Schasinglulu|   |   Platform                       | SFP_INGR_REG | SFP_WRITE_DATE_FRM_MIRROR_REG_TO_FUSE  |
148*91f16700Schasinglulu+===+==================================+=======================================================+
149*91f16700Schasinglulu| 1.| lx2160ardb/lx2160aqds/lx2162aqds | 0x01E80020   |    0x2                                 |
150*91f16700Schasinglulu+---+----------------------------------+--------------+----------------------------------------+
151*91f16700Schasinglulu
152*91f16700Schasinglulu   .. code:: shell
153*91f16700Schasinglulu
154*91f16700Schasinglulu        md $SFP_INGR_REG  $SFP_WRITE_DATE_FRM_MIRROR_REG_TO_FUSE
155*91f16700Schasinglulu
156*91f16700Schasinglulu- On reset, if the SFP register were read from u-boot, it will show the following:
157*91f16700Schasinglulu  --  Check for the OTPMK.
158*91f16700Schasinglulu
159*91f16700Schasinglulu   .. code:: shell
160*91f16700Schasinglulu
161*91f16700Schasinglulu        md $SNVS_HPSR_REG
162*91f16700Schasinglulu
163*91f16700Schasinglulu      Command Output:
164*91f16700Schasinglulu          01e90014: 80000900
165*91f16700Schasinglulu
166*91f16700Schasinglulu          In case it is read as 00000000, then read this register using jtag (in development mode only through CW tap).
167*91f16700Schasinglulu                       +0       +4       +8       +C
168*91f16700Schasinglulu          [0x01E90014] 80000900
169*91f16700Schasinglulu
170*91f16700Schasinglulu          Note: OTPMK_ZERO_BIT is zero, indicating that the OTPMK is blown.
171*91f16700Schasinglulu
172*91f16700Schasinglulu   .. code:: shell
173*91f16700Schasinglulu
174*91f16700Schasinglulu        md $OTPMKR0 0x10
175*91f16700Schasinglulu
176*91f16700Schasinglulu      Command Output:
177*91f16700Schasinglulu          01e80234: ffffffff ffffffff ffffffff ffffffff    ................
178*91f16700Schasinglulu          01e80244: ffffffff ffffffff ffffffff ffffffff    ................
179*91f16700Schasinglulu
180*91f16700Schasinglulu          Note: OTPMK will never be visible in plain.
181*91f16700Schasinglulu
182*91f16700Schasinglulu  -- SRK Hash
183*91f16700Schasinglulu
184*91f16700Schasinglulu   .. code:: shell
185*91f16700Schasinglulu
186*91f16700Schasinglulu        md $SRKHR0 0x10
187*91f16700Schasinglulu
188*91f16700Schasinglulu      Command Output:
189*91f16700Schasinglulu          01e80254: d4fec2fd 9e567f31 5c422818 fd5c7be8    ....1.V..(B\.{\.
190*91f16700Schasinglulu          01e80264: 8fabbe34 702a79df e185ff2d 8796a232    4....y*p-...2...
191*91f16700Schasinglulu
192*91f16700Schasinglulu          Note: SRK Hash is visible in plain based on the SFP Block Endianness.
193*91f16700Schasinglulu
194*91f16700SchasingluluSecond method to do the fuse provsioning:
195*91f16700Schasinglulu=========================================
196*91f16700Schasinglulu
197*91f16700SchasingluluThis method is used for quick way to provision fuses.
198*91f16700SchasingluluTypically used by those who needs to provision number of boards.
199*91f16700Schasinglulu
200*91f16700Schasinglulu- Enable POVDD:
201*91f16700Schasinglulu  -- Refer the table above to enable POVDD.
202*91f16700Schasinglulu
203*91f16700Schasinglulu     Note: If GPIO Pin supports enabling POVDD, it can be done through the below input_fuse_file.
204*91f16700Schasinglulu
205*91f16700Schasinglulu  -- Once the POVDD is enabled, make sure to set variable POVDD_ENABLE := yes, in the platform.mk.
206*91f16700Schasinglulu
207*91f16700Schasinglulu- User need to populate the "input_fuse_file", corresponding to the platform for:
208*91f16700Schasinglulu
209*91f16700Schasinglulu  -- OTPMK
210*91f16700Schasinglulu  -- SRKH
211*91f16700Schasinglulu
212*91f16700Schasinglulu  Table of fuse provisioning input file for every supported platform:
213*91f16700Schasinglulu
214*91f16700Schasinglulu+---+----------------------------------+-----------------------------------------------------------------+
215*91f16700Schasinglulu|   |   Platform                       |                        FUSE_PROV_FILE                           |
216*91f16700Schasinglulu+===+==================================+=================================================================+
217*91f16700Schasinglulu| 1.| lx2160ardb/lx2160aqds/lx2162aqds | ${CST_DIR}/input_files/gen_fusescr/ls2088_1088/input_fuse_file  |
218*91f16700Schasinglulu+---+----------------------------------+--------------+--------------------------------------------------+
219*91f16700Schasinglulu
220*91f16700Schasinglulu- Create the TF-A binary with FUSE_PROG=1.
221*91f16700Schasinglulu
222*91f16700Schasinglulu   .. code:: shell
223*91f16700Schasinglulu
224*91f16700Schasinglulu        make PLAT=$PLAT FUSE_PROG=1\
225*91f16700Schasinglulu          BOOT_MODE=<platform_supported_boot_mode> \
226*91f16700Schasinglulu          RCW=$RCW_BIN \
227*91f16700Schasinglulu          BL32=$TEE_BIN SPD=opteed\
228*91f16700Schasinglulu          BL33=$UBOOT_SECURE_BIN \
229*91f16700Schasinglulu          pbl \
230*91f16700Schasinglulu          fip \
231*91f16700Schasinglulu          fip_fuse \
232*91f16700Schasinglulu          FUSE_PROV_FILE=../../apps/security/cst/input_files/gen_fusescr/ls2088_1088/input_fuse_file
233*91f16700Schasinglulu
234*91f16700Schasinglulu- Deployment:
235*91f16700Schasinglulu  -- Refer the nxp-layerscape.rst for deploying TF-A images.
236*91f16700Schasinglulu  -- Deploying fip_fuse.bin:
237*91f16700Schasinglulu
238*91f16700Schasinglulu       For Flexspi-Nor:
239*91f16700Schasinglulu
240*91f16700Schasinglulu   .. code:: shell
241*91f16700Schasinglulu
242*91f16700Schasinglulu        tftp 82000000  $path/fuse_fip.bin;
243*91f16700Schasinglulu        i2c mw 66 50 20;sf probe 0:0; sf erase 0x880000 +$filesize; sf write 0x82000000 0x880000 $filesize;
244*91f16700Schasinglulu
245*91f16700Schasinglulu      For SD or eMMC [file_size_in_block_sizeof_512 = (Size_of_bytes_tftp / 512)]:
246*91f16700Schasinglulu
247*91f16700Schasinglulu   .. code:: shell
248*91f16700Schasinglulu
249*91f16700Schasinglulu        tftp 82000000  $path/fuse_fip.bin;
250*91f16700Schasinglulu        mmc write 82000000 0x4408 <file_size_in_block_sizeof_512>;
251*91f16700Schasinglulu
252*91f16700Schasinglulu- Valiation:
253*91f16700Schasinglulu
254*91f16700Schasinglulu+---+----------------------------------+---------------------------------------------------+
255*91f16700Schasinglulu|   |   Platform                       |    Error_Register        | Error_Register_Address |
256*91f16700Schasinglulu+===+==================================+===================================================+
257*91f16700Schasinglulu| 1.| lx2160ardb/lx2160aqds/lx2162aqds | DCFG scratch 4 register  |     0x01EE020C         |
258*91f16700Schasinglulu+---+----------------------------------+---------------------------------------------------+
259*91f16700Schasinglulu
260*91f16700Schasinglulu   At the U-Boot prompt, check DCFG scratch 4 register for any error.
261*91f16700Schasinglulu
262*91f16700Schasinglulu   .. code:: shell
263*91f16700Schasinglulu
264*91f16700Schasinglulu        md $Error_Register_Address 1
265*91f16700Schasinglulu
266*91f16700Schasinglulu      Command Ouput:
267*91f16700Schasinglulu          01ee020c: 00000000
268*91f16700Schasinglulu
269*91f16700Schasinglulu      Note:
270*91f16700Schasinglulu       - 0x00000000 shows no error, then fuse provisioning is successful.
271*91f16700Schasinglulu       - For non-zero value, refer the code header file ".../drivers/nxp/sfp/sfp_error_codes.h"
272