1# 2# Device Tree Control 3# 4 5config SUPPORT_OF_CONTROL 6 bool 7 8config DTC 9 bool 10 11config PYLIBFDT 12 bool 13 14config DTOC 15 bool 16 select PYLIBFDT 17 18config BINMAN 19 bool 20 select DTOC 21 22menu "Device Tree Control" 23 depends on SUPPORT_OF_CONTROL 24 25config OF_CONTROL 26 bool "Run-time configuration via Device Tree" 27 select DTC 28 help 29 This feature provides for run-time configuration of U-Boot 30 via a flattened device tree. 31 32config OF_ADDR_SIZE_AUTO_NOPARENT 33 bool "FDT get address/size cell auto from parent node" 34 depends on OF_CONTROL && ARM64 35 help 36 Enable this to use 'fdtdec_get_addr_size_auto_noparent' instead of 37 'fdtdec_get_addr_size_fixed' in case of 64-bit U-Boot use 32-bit 38 platform dtb. 39 40config OF_BOARD_FIXUP 41 bool "Board-specific manipulation of Device Tree" 42 help 43 In certain circumstances it is necessary to be able to modify 44 U-Boot's device tree (e.g. to delete device from it). This option 45 make the Device Tree writeable and provides a board-specific 46 "board_fix_fdt" callback (called during pre-relocation time), which 47 enables the board initialization to modifiy the Device Tree. The 48 modified copy is subsequently used by U-Boot after relocation. 49 50config SPL_OF_CONTROL 51 bool "Enable run-time configuration via Device Tree in SPL" 52 depends on SPL && OF_CONTROL 53 help 54 Some boards use device tree in U-Boot but only have 4KB of SRAM 55 which is not enough to support device tree. Enable this option to 56 allow such boards to be supported by U-Boot SPL. 57 58config SPL_DTB_MINIMUM 59 bool "Provide a minimum SPL DTB " 60 depends on SPL_OF_CONTROL 61 default n 62 help 63 Some boards need a SPL DTB as smaller as possible to save dm scan 64 time and space. It provides a SPL DTB only include the node with 65 property "u-boot,dm-spl". The property "u-boot,pre-reloc" doesn't 66 work any more. 67 68config TPL_OF_CONTROL 69 bool "Enable run-time configuration via Device Tree in TPL" 70 depends on TPL && OF_CONTROL 71 help 72 Some boards use device tree in U-Boot but only have 4KB of SRAM 73 which is not enough to support device tree. Enable this option to 74 allow such boards to be supported by U-Boot TPL. 75 76config OF_LIVE 77 bool "Enable use of a live tree" 78 depends on OF_CONTROL 79 help 80 Normally U-Boot uses a flat device tree which saves space and 81 avoids the need to unpack the tree before use. However a flat 82 tree does not support modifcation from within U-Boot since it 83 can invalidate driver-model device tree offsets. This option 84 enables a live tree which is available after relocation, 85 and can be adjusted as needed. 86 87choice 88 prompt "Provider of DTB for DT control" 89 depends on OF_CONTROL 90 91config OF_SEPARATE 92 bool "Separate DTB for DT control" 93 depends on !SANDBOX 94 help 95 If this option is enabled, the device tree will be built and 96 placed as a separate u-boot.dtb file alongside the U-Boot image. 97 98config OF_EMBED 99 bool "Embedded DTB for DT control" 100 help 101 If this option is enabled, the device tree will be picked up and 102 built into the U-Boot image. This is suitable for local debugging 103 and development only and is not recommended for production devices. 104 Boards in the mainline U-Boot tree should not use it. 105 106config OF_BOARD 107 bool "Provided by the board at runtime" 108 depends on !SANDBOX 109 help 110 If this option is enabled, the device tree will be provided by 111 the board at runtime if the board supports it, instead of being 112 bundled with the image. 113 114config OF_HOSTFILE 115 bool "Host filed DTB for DT control" 116 depends on SANDBOX 117 help 118 If this option is enabled, DTB will be read from a file on startup. 119 This is only useful for Sandbox. Use the -d flag to U-Boot to 120 specify the file to read. 121 122config OF_PRIOR_STAGE 123 bool "Prior stage bootloader DTB for DT control" 124 help 125 If this option is enabled, the device tree used for DT 126 control will be read from a device tree binary, at a memory 127 location passed to U-Boot by the prior stage bootloader. 128 129endchoice 130 131config DEFAULT_DEVICE_TREE 132 string "Default Device Tree for DT control" 133 depends on OF_CONTROL 134 help 135 This option specifies the default Device Tree used for DT control. 136 It can be overridden from the command line: 137 $ make DEVICE_TREE=<device-tree-name> 138 139config OF_LIST 140 string "List of device tree files to include for DT control" 141 depends on SPL_LOAD_FIT || MULTI_DTB_FIT 142 default DEFAULT_DEVICE_TREE 143 help 144 This option specifies a list of device tree files to use for DT 145 control. These will be packaged into a FIT. At run-time, U-boot 146 or SPL will select the correct DT to use by examining the 147 hardware (e.g. reading a board ID value). This is a list of 148 device tree files (without the directory or .dtb suffix) 149 separated by <space>. 150 151 152config DTB_RESELECT 153 bool "Support swapping dtbs at a later point in boot" 154 depends on MULTI_DTB_FIT 155 help 156 It is possible during initial boot you may need to use a generic 157 dtb until you can fully determine the board your running on. This 158 config allows boards to implement a function at a later point 159 during boot to switch to the "correct" dtb. 160 161config MULTI_DTB_FIT 162 bool "Support embedding several DTBs in a FIT image for u-boot" 163 help 164 This option provides hooks to allow U-boot to parse an 165 appended FIT image and enable board specific code to then select 166 the correct DTB to be used. Use this if you need to support 167 multiple DTBs but don't use the SPL. 168 169 170config SPL_MULTI_DTB_FIT 171 depends on SPL_LOAD_FIT && SPL_OF_CONTROL && !SPL_OF_PLATDATA 172 bool "Support embedding several DTBs in a FIT image for the SPL" 173 help 174 This option provides the SPL with the ability to select its own 175 DTB at runtime from an appended FIT image containing several DTBs. 176 This allows using the same SPL binary on multiple platforms. 177 The primary purpose is to handle different versions of 178 the same platform without tweaking the platform code if the 179 differences can be expressed in the DTBs (common examples are: bus 180 capabilities, pad configurations). 181 182config SPL_OF_LIST 183 string "List of device tree files to include for DT control in SPL" 184 depends on SPL_MULTI_DTB_FIT 185 default OF_LIST 186 help 187 This option specifies a list of device tree files to use for DT 188 control in the SPL. These will be packaged into a FIT. At run-time, 189 the SPL will select the correct DT to use by examining the 190 hardware (e.g. reading a board ID value). This is a list of 191 device tree files (without the directory or .dtb suffix) 192 separated by <space>. 193 194choice 195 prompt "SPL OF LIST compression" 196 depends on SPL_MULTI_DTB_FIT 197 default SPL_MULTI_DTB_FIT_LZO 198 199config SPL_MULTI_DTB_FIT_LZO 200 bool "LZO" 201 depends on SYS_MALLOC_F 202 select SPL_LZO 203 help 204 Compress the FIT image containing the DTBs available for the SPL 205 using LZO compression. (requires lzop on host). 206 207config SPL_MULTI_DTB_FIT_GZIP 208 bool "GZIP" 209 depends on SYS_MALLOC_F 210 select SPL_GZIP 211 help 212 Compress the FIT image containing the DTBs available for the SPL 213 using GZIP compression. (requires gzip on host) 214 215config SPL_MULTI_DTB_FIT_NO_COMPRESSION 216 bool "No compression" 217 help 218 Do not compress the FIT image containing the DTBs available for the SPL. 219 Use this options only if LZO is not available and the DTBs are very small. 220endchoice 221 222choice 223 prompt "Location of uncompressed DTBs " 224 depends on (SPL_MULTI_DTB_FIT_GZIP || SPL_MULTI_DTB_FIT_LZO) 225 default SPL_MULTI_DTB_FIT_DYN_ALLOC if SYS_MALLOC_F 226 227config SPL_MULTI_DTB_FIT_DYN_ALLOC 228 bool "Dynamically allocate the memory" 229 depends on SYS_MALLOC_F 230 231config SPL_MULTI_DTB_FIT_USER_DEFINED_AREA 232 bool "User-defined location" 233endchoice 234 235config SPL_MULTI_DTB_FIT_UNCOMPRESS_SZ 236 hex "Size of memory reserved to uncompress the DTBs" 237 depends on (SPL_MULTI_DTB_FIT_GZIP || SPL_MULTI_DTB_FIT_LZO) 238 default 0x8000 239 help 240 This is the size of this area where the DTBs are uncompressed. 241 If this area is dynamically allocated, make sure that 242 SPL_SYS_MALLOC_F_LEN is big enough to contain it. 243 244config SPL_MULTI_DTB_FIT_USER_DEF_ADDR 245 hex "Address of memory where dtbs are uncompressed" 246 depends on SPL_MULTI_DTB_FIT_USER_DEFINED_AREA 247 help 248 the FIT image containing the DTBs is uncompressed in an area defined 249 at compilation time. This is the address of this area. It must be 250 aligned on 2-byte boundary. 251 252config OF_SPL_REMOVE_PROPS 253 string "List of device tree properties to drop for SPL" 254 default "interrupt-parent" if SPL_PINCTRL && SPL_CLK 255 default "clocks clock-names interrupt-parent" if SPL_PINCTRL 256 default "pinctrl-0 pinctrl-names interrupt-parent" if SPL_CLK 257 default "pinctrl-0 pinctrl-names clocks clock-names interrupt-parent" 258 help 259 Since SPL normally runs in a reduced memory space, the device tree 260 is cut down to only what is needed to load and start U-Boot. Only 261 nodes marked with the property "u-boot,dm-pre-reloc" will be 262 included. In addition, some properties are not used by U-Boot and 263 can be discarded. This option defines the list of properties to 264 discard. 265 266config OF_U_BOOT_REMOVE_PROPS 267 string "List of device tree properties to drop for U-Boot" 268 depends on USING_KERNEL_DTB 269 default "" 270 help 271 Since kernel dtb feature is enabled, U-Boot prop use the same device tree as SPL. 272 At sometimes there is different require for list of device tree properties to drop 273 for U-Boot prop, so providing this configure which has higher priority, that if it 274 is defined empty string, fallback to use OF_SPL_REMOVE_PROPS. 275 276config SPL_OF_PLATDATA 277 bool "Generate platform data for use in SPL" 278 depends on SPL_OF_CONTROL 279 select DTOC 280 help 281 For very constrained SPL environments the overhead of decoding 282 device tree nodes and converting their contents into platform data 283 is too large. This overhead includes libfdt code as well as the 284 device tree contents itself. The latter is fairly compact, but the 285 former can add 3KB or more to a Thumb 2 Image. 286 287 This option enables generation of platform data from the device 288 tree as C code. This code creates devices using U_BOOT_DEVICE() 289 declarations. The benefit is that it allows driver code to access 290 the platform data directly in C structures, avoidin the libfdt 291 overhead. 292 293 This option works by generating C structure declarations for each 294 compatible string, then adding platform data and U_BOOT_DEVICE 295 declarations for each node. See README.platdata for more 296 information. 297 298config TPL_OF_PLATDATA 299 bool "Generate platform data for use in TPL" 300 depends on TPL_OF_CONTROL 301 select DTOC 302 help 303 For very constrained SPL environments the overhead of decoding 304 device tree nodes and converting their contents into platform data 305 is too large. This overhead includes libfdt code as well as the 306 device tree contents itself. The latter is fairly compact, but the 307 former can add 3KB or more to a Thumb 2 Image. 308 309 This option enables generation of platform data from the device 310 tree as C code. This code creates devices using U_BOOT_DEVICE() 311 declarations. The benefit is that it allows driver code to access 312 the platform data directly in C structures, avoidin the libfdt 313 overhead. 314 315 This option works by generating C structure declarations for each 316 compatible string, then adding platform data and U_BOOT_DEVICE 317 declarations for each node. See README.platdata for more 318 information. 319 320endmenu 321 322config MKIMAGE_DTC_PATH 323 string "Path to dtc binary for use within mkimage" 324 default "dtc" 325 help 326 The mkimage host tool will, in order to generate FIT images make 327 calls to the dtc application in order to create the output. In 328 some cases the system dtc may not support all required features 329 and the path to a different version should be given here. 330