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