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