|
| 1 | +.TH RASPIOTP 7 |
| 2 | +. |
| 3 | +.SH NAME |
| 4 | +raspiotp \- the Raspberry Pi OTP register bits |
| 5 | +. |
| 6 | +. |
| 7 | +.SH DESCRIPTION |
| 8 | +. |
| 9 | +All SoCs used by the Raspberry Pi range have a inbuilt One-Time Programmable |
| 10 | +(OTP) memory block. |
| 11 | +It is 66 32-bit values long, although only a few locations have |
| 12 | +factory-programmed data. |
| 13 | +The |
| 14 | +.BR vcgencmd (1) |
| 15 | +utility can be used to display the contents of the OTP like so: |
| 16 | +.PP |
| 17 | +.EX |
| 18 | +$ \fBvcgencmd otp_dump\fR |
| 19 | +.EE |
| 20 | +. |
| 21 | +. |
| 22 | +.SH OTP REGISTERS |
| 23 | +This list contains the publicly available information on the registers. If a |
| 24 | +register or bit is not defined here, then it is not public. |
| 25 | +. |
| 26 | +.TP |
| 27 | +.B 17 |
| 28 | +bootmode register |
| 29 | +.RS |
| 30 | +.TP |
| 31 | +.B Bit 1 |
| 32 | +sets the oscillator frequency to 19.2MHz |
| 33 | +.TP |
| 34 | +.B Bit 3 |
| 35 | +enables pull ups on the SDIO pins |
| 36 | +.TP |
| 37 | +.B Bit 19 |
| 38 | +enables GPIO bootmode |
| 39 | +.TP |
| 40 | +.B Bit 20 |
| 41 | +sets the bank to check for GPIO bootmode |
| 42 | +.TP |
| 43 | +.B Bit 21 |
| 44 | +enables booting from SD card |
| 45 | +.TP |
| 46 | +.B Bit 22 |
| 47 | +sets the bank to boot from |
| 48 | +.TP |
| 49 | +.B Bit 28 |
| 50 | +enables USB device booting |
| 51 | +.TP |
| 52 | +.B Bit 29 |
| 53 | +enables USB host booting (ethernet and mass storage) |
| 54 | +.RE |
| 55 | +. |
| 56 | +.TP |
| 57 | +.B 18 |
| 58 | +copy of bootmode register |
| 59 | +. |
| 60 | +.TP |
| 61 | +.B 28 |
| 62 | +serial number |
| 63 | +. |
| 64 | +.TP |
| 65 | +.B 29 |
| 66 | +~(serial number) |
| 67 | +. |
| 68 | +.TP |
| 69 | +.B 30 |
| 70 | +revision code; |
| 71 | +. |
| 72 | +.BR raspirev (7) |
| 73 | +.TP |
| 74 | +.B 36-43 |
| 75 | +customer OTP values (see |
| 76 | +.B INDUSTRIAL USE |
| 77 | +below) |
| 78 | +. |
| 79 | +.TP |
| 80 | +.B 45 |
| 81 | +MPG2 decode key |
| 82 | +. |
| 83 | +.TP |
| 84 | +.B 46 |
| 85 | +WVC1 decode key |
| 86 | +. |
| 87 | +.TP |
| 88 | +.B 64-65 |
| 89 | +MAC address; if set, system will use this in preference to the automatically generated address based on the serial number |
| 90 | +. |
| 91 | +.TP |
| 92 | +.B 66 |
| 93 | +advanced boot register |
| 94 | +.RS |
| 95 | +.TP |
| 96 | +.B Bits 0-6 |
| 97 | +GPIO for ETH_CLK output pin |
| 98 | +.TP |
| 99 | +.B Bit 7 |
| 100 | +enables ETH_CLK output |
| 101 | +.TP |
| 102 | +.B Bits 8-14 |
| 103 | +GPIO for LAN_RUN output pin |
| 104 | +.TP |
| 105 | +.B Bit 15 |
| 106 | +enables LAN_RUN output |
| 107 | +.TP |
| 108 | +.B Bit 24 |
| 109 | +extends USB HUB timeout parameter |
| 110 | +.TP |
| 111 | +.B Bit 25 |
| 112 | +ETH_CLK frequency: 0=25MHz, 1=24MHz |
| 113 | +.RE |
| 114 | +. |
| 115 | +. |
| 116 | +.SH INDUSTRIAL USE |
| 117 | +The Raspberry Pi is often used as part of another product. This section |
| 118 | +describes some extra facilities available to use other capabilities of the Pi. |
| 119 | +. |
| 120 | +.SS Customer OTP settings |
| 121 | +There are a number of OTP values that can be used. To see a list of all the OTP |
| 122 | +values, you can use: |
| 123 | +.PP |
| 124 | +.EX |
| 125 | +$ \fBvcgencmd otp_dump\fR |
| 126 | +.EE |
| 127 | +.PP |
| 128 | +In register locations 36 to 43 (inclusive), there are eight rows of 32 bits |
| 129 | +available for the customer (detailed in |
| 130 | +.B OTP REGISTERS |
| 131 | +above). |
| 132 | +.PP |
| 133 | +To program these bits, you will need to use the vcmailbox. This is a Linux |
| 134 | +driver interface to the firmware which will handle the programming of the rows. |
| 135 | +To do this, please refer to the documentation at [MAILBOX], and the |
| 136 | +.BR vcmailbox (1) |
| 137 | +example application. For example: |
| 138 | +.PP |
| 139 | +.EX |
| 140 | +$ \fBvcmailbox 0x00010004 8 8 0 0\fR |
| 141 | +0x00000020 0x80000000 0x00010004 0x00000008 0x800000008 0xnnnnnnnn |
| 142 | +0x00000000 0x00000000 |
| 143 | +.EE |
| 144 | +.PP |
| 145 | +The above uses the |
| 146 | +.B GET_BOARD_SERIAL |
| 147 | +tag (detailed under [MAILBOX]) with a request size of 8 bytes and response |
| 148 | +size of 8 bytes (sending two integers for the request 0, 0). The response to |
| 149 | +this will be two integers (0x00000020 and 0x80000000) followed by the tag code, |
| 150 | +the request length, the response length (with the 31st bit set to indicate that |
| 151 | +it is a response) then the 64 bit serial number (where the MS 32bits are always |
| 152 | +0). |
| 153 | +.PP |
| 154 | +To set the customer OTP values you will need to use the |
| 155 | +.B SET_CUSTOMER_OTP |
| 156 | +(0x38021) tag as follows: |
| 157 | +.PP |
| 158 | +.EX |
| 159 | +$ \fBvcmailbox 0x00038021 \fI[8+rows*4] [8+rows*4] [start] [rows] [value]\fR ... |
| 160 | +.EE |
| 161 | +.TP |
| 162 | +.B start |
| 163 | +the first row to program from 0-7 |
| 164 | +.TP |
| 165 | +.B rows |
| 166 | +number of rows to program |
| 167 | +.TP |
| 168 | +.B value |
| 169 | +each value to program |
| 170 | +.PP |
| 171 | +So, to program OTP customer rows 4, 5, and 6 to 0x11111111, 0x22222222, |
| 172 | +0x33333333 respectively, you would use: |
| 173 | +.PP |
| 174 | +.EX |
| 175 | +$ \fBvcmailbox 0x00038021 20 20 4 3 0x11111111 0x22222222 0x33333333\fR |
| 176 | +.EE |
| 177 | +.PP |
| 178 | +This will then program rows 40, 41, and 42. To read the values back, you can |
| 179 | +use: |
| 180 | +.PP |
| 181 | +.EX |
| 182 | +$ \fBvcmailbox 0x00030021 20 20 4 3 0 0 0\fR |
| 183 | +0x0000002c 0x80000000 0x00030021 0x00000014 0x80000014 0x00000000 |
| 184 | +0x00000003 0x11111111 0x22222222 0x33333333 |
| 185 | +.EE |
| 186 | +.PP |
| 187 | +If you'd like to integrate this functionality into your own code, you should be |
| 188 | +able to achieve this by using the vcmailbox.c code as an example. |
| 189 | +. |
| 190 | +.SS Locking the OTP changes |
| 191 | +It is possible to lock the OTP changes to avoid them being edited again. This |
| 192 | +can be done using a special argument with the OTP write mailbox: |
| 193 | +.PP |
| 194 | +.EX |
| 195 | +$ \fBvcmailbox 0x00038021 8 8 0xffffffff 0xaffe0000\fR |
| 196 | +.EE |
| 197 | +.PP |
| 198 | +Once locked, the customer OTP values can no longer be altered. Note that this |
| 199 | +locking operation is irreversible. |
| 200 | +. |
| 201 | +.SS Making customer OTP bits unreadable |
| 202 | +It is possible to prevent the customer OTP bits from being read at all. This |
| 203 | +can be done using a special argument with the OTP write mailbox: |
| 204 | +.PP |
| 205 | +.EX |
| 206 | +$ \fBvcmailbox 0x00038021 8 8 0xffffffff 0xaffebabe\fR |
| 207 | +.EE |
| 208 | +.PP |
| 209 | +This operation is unlikely to be useful for the vast majority of users, and is |
| 210 | +irreversible. |
| 211 | +. |
| 212 | +. |
| 213 | +.SH SEE ALSO |
| 214 | +.BR vcgencmd (1), |
| 215 | +.BR raspirev (7), |
| 216 | +.B [SOURCE] |
| 217 | +. |
| 218 | +. |
| 219 | +.SH REFERENCES |
| 220 | +.TP |
| 221 | +.B [MAILBOX] |
| 222 | +https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface |
| 223 | +. |
| 224 | +.TP |
| 225 | +.B [SOURCE] |
| 226 | +https://www.raspberrypi.org/documentation/hardware/raspberrypi/otpbits.md |
| 227 | +and |
| 228 | +https://www.raspberrypi.org/documentation/hardware/industrial/README.md |
0 commit comments