Harsha Vardhan V M | 677feee | 2025-03-19 14:17:11 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | .. index:: |
| 4 | single: fuse (command) |
| 5 | |
| 6 | fuse command |
| 7 | ============ |
| 8 | |
| 9 | Synopsis |
| 10 | -------- |
| 11 | |
| 12 | :: |
| 13 | |
| 14 | fuse read <bank> <word> [<cnt>] |
| 15 | fuse cmp <bank> <word> <hexval> |
| 16 | fuse readm <bank> <word> <addr> [<cnt>] |
| 17 | fuse sense <bank> <word> [<cnt>] |
| 18 | fuse prog [-y] <bank> <word> <hexval> [<hexval>...] |
| 19 | fuse override <bank> <word> <hexval> [<hexval>...] |
Harsha Vardhan V M | 2323ebe | 2025-03-19 14:17:14 +0530 | [diff] [blame^] | 20 | fuse writebuff [-y] <addr> |
Harsha Vardhan V M | 677feee | 2025-03-19 14:17:11 +0530 | [diff] [blame] | 21 | |
| 22 | Description |
| 23 | ----------- |
| 24 | |
| 25 | The fuse API allows to control a fusebox and how it is used by the upper |
| 26 | hardware layers. |
| 27 | |
| 28 | A fuse corresponds to a single non-volatile memory bit that can be programmed |
| 29 | (i.e., blown, set to 1) only once. The programming operation is irreversible. |
| 30 | A fuse that has not been programmed reads as 0. |
| 31 | |
| 32 | Fuses can be used by SoCs to store various permanent configurations and data, |
| 33 | such as boot configurations, security settings, MAC addresses, etc. |
| 34 | |
| 35 | A fuse 'word' is the smallest group of fuses that can be read at once from |
| 36 | the fusebox control IP registers. In the current API, this is limited to 32 bits. |
| 37 | |
| 38 | A fuse 'bank' is the smallest group of fuse words having a common ID, as |
| 39 | defined by each SoC. |
| 40 | |
| 41 | Upon startup, the fusebox control IP reads the fuse values and stores them in a |
| 42 | volatile shadow cache. |
| 43 | |
| 44 | Commands |
| 45 | -------- |
| 46 | |
| 47 | - **fuse read <bank> <word> [<cnt>]** |
| 48 | Reads 1 or 'cnt' fuse words, starting at 'word' from the shadow cache. |
| 49 | |
| 50 | - **fuse cmp <bank> <word> <hexval>** |
| 51 | Compares 'hexval' to fuse at 'word'. |
| 52 | |
| 53 | - **fuse readm <bank> <word> <addr> [<cnt>]** |
| 54 | Reads 1 or 'cnt' fuse words, starting at 'word' into memory at 'addr'. |
| 55 | |
| 56 | - **fuse sense <bank> <word> [<cnt>]** |
| 57 | Sense 1 or 'cnt' fuse words, starting at 'word'. |
| 58 | Sense - i.e. read directly from the fusebox, skipping the shadow cache - |
| 59 | fuse words. This operation does not update the shadow cache. This is |
| 60 | useful to know the true value of fuses if an override has been |
| 61 | performed (see below). |
| 62 | |
| 63 | - **fuse prog [-y] <bank> <word> <hexval> [<hexval>...]** |
| 64 | Permanently programs 1 or several fuse words, starting at 'word'. |
| 65 | This operation directly affects the fusebox and is irreversible. The |
| 66 | shadow cache is updated accordingly or not, depending on each IP. |
| 67 | Only the bits to be programmed should be set in the input value (i.e. |
| 68 | for fuse bits that have already been programmed and hence should be |
| 69 | left unchanged by a further programming, it is preferable to clear |
| 70 | the corresponding bits in the input value in order not to perform a |
| 71 | new hardware programming operation on these fuse bits). |
| 72 | |
| 73 | - **fuse override <bank> <word> <hexval> [<hexval>...]** |
| 74 | Override 1 or several fuse words, starting at 'word' in the shadow cache. |
| 75 | The fusebox is unaffected, so following this operation, the shadow cache |
| 76 | may differ from the fusebox values. Read or sense operations can then be |
| 77 | used to get the values from the shadow cache or from the fusebox. |
| 78 | This is useful to change the behaviours linked to some cached fuse values, |
| 79 | either because this is needed only temporarily, or because some of the |
| 80 | fuses have already been programmed or are locked (if the SoC allows to |
| 81 | override a locked fuse). |
| 82 | |
Harsha Vardhan V M | 2323ebe | 2025-03-19 14:17:14 +0530 | [diff] [blame^] | 83 | - **fuse writebuff [-y] <addr>** |
| 84 | Programs fuse data using a structured buffer in memory starting at 'addr'. |
| 85 | This operation directly affects the fusebox and is irreversible. |
| 86 | |
| 87 | The structure of the buffer should contain all necessary details for |
| 88 | programming fuses, such as the values to be written to the fuse, optional |
| 89 | metadata for validation or programming constraints and any configuration |
| 90 | data required for the operation. Define CONFIG_CMD_FUSE_WRITEBUFF to |
| 91 | enable the fuse writebuff command. |
| 92 | |
Harsha Vardhan V M | 677feee | 2025-03-19 14:17:11 +0530 | [diff] [blame] | 93 | Examples |
| 94 | -------- |
| 95 | |
| 96 | fuse read |
| 97 | ~~~~~~~~~ |
| 98 | |
| 99 | :: |
| 100 | |
| 101 | u-boot=> fuse read 0 1 |
| 102 | Reading bank 0: |
| 103 | |
| 104 | Word 0x00000001: 00000001 |
| 105 | |
| 106 | fuse cmp |
| 107 | ~~~~~~~~ |
| 108 | |
| 109 | :: |
| 110 | |
| 111 | u-boot=> fuse cmp 0 1 0x1 |
| 112 | Comparing bank 0: |
| 113 | |
| 114 | Word 0x00000001: |
| 115 | Value 0x00000001:0x00000001 |
| 116 | passed |
| 117 | |
| 118 | fuse readm |
| 119 | ~~~~~~~~~~ |
| 120 | |
| 121 | :: |
| 122 | |
| 123 | u-boot=> fuse readm 0 1 0x83000000 |
| 124 | Reading bank 0 len 1 to 0x83000000 |
| 125 | |
| 126 | fuse sense |
| 127 | ~~~~~~~~~~ |
| 128 | |
| 129 | :: |
| 130 | |
| 131 | u-boot=> fuse sense 0 1 |
| 132 | Sensing bank 0: |
| 133 | |
| 134 | Word 0x00000001: 00000001 |
| 135 | |
| 136 | fuse prog |
| 137 | ~~~~~~~~~ |
| 138 | |
| 139 | :: |
| 140 | |
| 141 | u-boot=> fuse prog 0 1 0x00000002 |
| 142 | Programming bank 0 word 0x00000001 to 0x00000002... |
| 143 | Warning: Programming fuses is an irreversible operation! |
| 144 | This may brick your system. |
| 145 | Use this command only if you are sure of what you are doing! |
| 146 | |
| 147 | Really perform this fuse programming? <y/N> |
| 148 | y |
| 149 | |
| 150 | fuse override |
| 151 | ~~~~~~~~~~~~~ |
| 152 | |
| 153 | :: |
| 154 | |
| 155 | u-boot=> fuse override 0 1 0x00000003 |
| 156 | Overriding bank 0 word 0x00000001 with 0x00000003... |
| 157 | |
Harsha Vardhan V M | 2323ebe | 2025-03-19 14:17:14 +0530 | [diff] [blame^] | 158 | fuse writebuff |
| 159 | ~~~~~~~~~~~~~~ |
| 160 | |
| 161 | :: |
| 162 | |
| 163 | u-boot=> fuse writebuff -y 0x84000000 |
| 164 | Programming fuses with buffer at addr 0x84000000 |
| 165 | |
Harsha Vardhan V M | 677feee | 2025-03-19 14:17:11 +0530 | [diff] [blame] | 166 | Configuration |
| 167 | ------------- |
| 168 | |
| 169 | The fuse commands are available if CONFIG_CMD_FUSE=y. |
Harsha Vardhan V M | 2323ebe | 2025-03-19 14:17:14 +0530 | [diff] [blame^] | 170 | The fuse writebuff command is available if CONFIG_CMD_FUSE_WRITEBUFF=y. |
Harsha Vardhan V M | 677feee | 2025-03-19 14:17:11 +0530 | [diff] [blame] | 171 | |
| 172 | Return code |
| 173 | ----------- |
| 174 | |
| 175 | The return value $? is set to 0 (true) if the command is successful, |
| 176 | 1 (false) otherwise. |