|
| 1 | +.. _key-writer-lite-label: |
| 2 | + |
| 3 | +Key Writer Lite |
| 4 | +--------------- |
| 5 | + |
| 6 | +This OTP (One Time Programmable) key writer lite guide describes |
| 7 | +the procedure to be followed to populate customer keys in eFuses |
| 8 | +of the SoC. Once the SoC eFuses are programmed using keywriter lite, |
| 9 | +there is no going back. This action of burning the OTP fields is |
| 10 | +irreversible. |
| 11 | + |
| 12 | +**High Security (HS) Device Sub-types** |
| 13 | + |
| 14 | +*HS-FS (High Security - Field Securable)*: |
| 15 | +Device type before customer keys are programmed (the state in which |
| 16 | +the device leaves TI factory). In this state, device protects the |
| 17 | +ROM code, TI keys and certain security peripherals. HS-FS devices do |
| 18 | +not enforce secure boot process. |
| 19 | + |
| 20 | +*HS-SE Lite (High Security - Security Enforced Lite)*: |
| 21 | +Device type after only the customer public key hashes are programmed. |
| 22 | +HS-SE Lite devices enforce secure boot (without encryption). |
| 23 | + |
| 24 | +**HS-FS to HS-SE Lite Conversion** |
| 25 | + |
| 26 | +In order to convert a HS-FS device to HS-SE Lite device, one has to |
| 27 | +program the customer root key (optionally backup key) on the target |
| 28 | +device, using OTP Keywriter Lite. |
| 29 | + |
| 30 | +Customer key information is put in a structured format to create a |
| 31 | +binary blob (Uboot key writer lite structure). |
| 32 | + |
| 33 | +**Uboot Key Writer Lite Structure** |
| 34 | + |
| 35 | +.. code-block:: text |
| 36 | +
|
| 37 | + struct fuse_otp_header { |
| 38 | + uint32_t version_info; |
| 39 | + uint32_t fuse_mode; |
| 40 | + } __attribute__((packed)); |
| 41 | +
|
| 42 | + struct fuse_otp { |
| 43 | + struct fuse_otp_header fuse_otp_hdr; |
| 44 | + struct fuse_otp_blob fuse_otp_blb; |
| 45 | + } __attribute__((packed)); |
| 46 | +
|
| 47 | +* version_info : Customer can use this field to denote the version of uboot fuse programming. |
| 48 | +* fuse_mode : Fuse mode with value 0x00009045. |
| 49 | + |
| 50 | +The overall fuse_otp structure is shown below: |
| 51 | + |
| 52 | +.. Image:: /images/Uboot_fuse_writebuff_OTP_structure.png |
| 53 | + |
| 54 | +For information on the fuse_otp_blob structure, |
| 55 | +visit `keywriter_lite_cert_gen_procedure`_. |
| 56 | + |
| 57 | +.. _keywriter_lite_cert_gen_procedure: https://software-dl.ti.com/tisci/esd/latest/6_topic_user_guides/key_writer_lite.html |
| 58 | + |
| 59 | +**Generate the Binary Blob** |
| 60 | + |
| 61 | +Generate the binary blob based out of Uboot Key Writer Lite |
| 62 | +structure by populating the structure and extracting the |
| 63 | +.data section to a bin file and copy it to SD card. |
| 64 | + |
| 65 | +**Typical Key Writer Lite Flow** |
| 66 | + |
| 67 | +A typical flow to do OTP key writer lite is as follows: |
| 68 | + |
| 69 | +#. Addr 0x82000000 is the dedicated address to store the generated |
| 70 | + key writer lite binary blob. Clear out 1Kb of memory starting |
| 71 | + from 0x82000000: |
| 72 | + |
| 73 | + .. code-block:: text |
| 74 | +
|
| 75 | + u-boot=> mw 0x82000000 0 0x400 |
| 76 | +
|
| 77 | +#. The binary blob copied to SD card can be loaded into memory using |
| 78 | + commands like: |
| 79 | + |
| 80 | + .. code-block:: text |
| 81 | +
|
| 82 | + u-boot=> fatload mmc 1:1 0x82000000 key_writer_lite_blob.bin |
| 83 | +
|
| 84 | +#. If the cache has to be flushed, then enable the config |
| 85 | + CONFIG_CMD_CACHE=y in <path-to-tisdk>/board-support/<ti-u-boot-source-code>/configs/<device_defconfig> |
| 86 | + and re-build uboot. |
| 87 | + |
| 88 | + .. code-block:: text |
| 89 | +
|
| 90 | + u-boot=> dcache flush |
| 91 | + u-boot=> md 0x82000000 |
| 92 | +
|
| 93 | +#. Efuse modification requires a voltage to be applied on a specific pin (Vpp) during the programming. |
| 94 | + To program the efuses, the Vpp pin on the System-on-Chip (SoC) must be powered at 1.8V. It is the |
| 95 | + responsibility of the SoC user to design a suitable circuit that enables the Vpp pin to be powered. |
| 96 | + |
| 97 | + Texas Instruments (TI) EVMs feature an I2C-based IO expander, which has one of its IO pins |
| 98 | + connected to the SoC's Vpp pin. The software required to control the power to the Vpp pin depends |
| 99 | + on the specific circuit implementation. |
| 100 | + |
| 101 | + In the case of TI AM62L PROC181E1 EVMs, an I2C driver is necessary to send command packets to the IO expander, |
| 102 | + which then toggles the IO pin connected to the Vpp pin, thereby controlling the power supply to the pin. |
| 103 | + On TI EVM, Vpp pin can be turned on using the below commands: |
| 104 | + |
| 105 | + .. code-block:: text |
| 106 | +
|
| 107 | + u-boot=> i2c dev 2 |
| 108 | + u-boot=> i2c probe 22 |
| 109 | +
|
| 110 | + .. rubric:: To turn off Vpp: |
| 111 | + |
| 112 | + .. code-block:: text |
| 113 | +
|
| 114 | + u-boot=> i2c mw 0x22 0x04 0x00 |
| 115 | +
|
| 116 | + .. rubric:: To configure Vpp (port 04) as output: |
| 117 | + |
| 118 | + .. code-block:: text |
| 119 | +
|
| 120 | + u-boot=> i2c mw 0x22 0xC 0xEF |
| 121 | +
|
| 122 | + .. rubric:: To turn on Vpp: |
| 123 | + |
| 124 | + .. code-block:: text |
| 125 | +
|
| 126 | + u-boot=> i2c mw 0x22 0x04 0x10 |
| 127 | +
|
| 128 | +#. Call fuse writebuff sub-system command with the address 0x82000000: |
| 129 | + |
| 130 | + .. code-block:: text |
| 131 | +
|
| 132 | + u-boot=> fuse writebuff -y 0x82000000 |
| 133 | +
|
| 134 | +#. Turn off Vpp after programming is successful: |
| 135 | + |
| 136 | + .. code-block:: text |
| 137 | +
|
| 138 | + u-boot=> i2c mw 0x22 0x04 0x00 |
| 139 | +
|
| 140 | +Changes made to efuses, by programming them, take effect (like become |
| 141 | +visible in Memory-Mapped Registers (MMRs), device type change etc.) |
| 142 | +after a complete System-on-Chip (SoC) power cycle. |
0 commit comments