Kconfig 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. #
  2. # Device Tree Control
  3. #
  4. config SUPPORT_OF_CONTROL
  5. bool
  6. config PYLIBFDT
  7. bool
  8. config DTOC
  9. bool
  10. select PYLIBFDT
  11. config BINMAN
  12. bool
  13. select DTOC
  14. menu "Device Tree Control"
  15. depends on SUPPORT_OF_CONTROL
  16. config OF_CONTROL
  17. bool "Run-time configuration via Device Tree"
  18. select OF_LIBFDT
  19. select OF_REAL
  20. help
  21. This feature provides for run-time configuration of U-Boot
  22. via a flattened device tree.
  23. config OF_REAL
  24. bool
  25. help
  26. Indicates that a real devicetree is available which can be accessed
  27. at runtime. This means that dev_read_...() functions can be used to
  28. read data from the devicetree for each device. This is true if
  29. OF_CONTROL is enabled in U-Boot proper.
  30. config OF_BOARD_FIXUP
  31. bool "Board-specific manipulation of Device Tree"
  32. help
  33. In certain circumstances it is necessary to be able to modify
  34. U-Boot's device tree (e.g. to delete device from it). This option
  35. make the Device Tree writeable and provides a board-specific
  36. "board_fix_fdt" callback (called during pre-relocation time), which
  37. enables the board initialization to modifiy the Device Tree. The
  38. modified copy is subsequently used by U-Boot after relocation.
  39. config SPL_OF_CONTROL
  40. bool "Enable run-time configuration via Device Tree in SPL"
  41. depends on SPL && OF_CONTROL
  42. select SPL_OF_LIBFDT if !SPL_OF_PLATDATA
  43. select SPL_OF_REAL if !SPL_OF_PLATDATA
  44. help
  45. Some boards use device tree in U-Boot but only have 4KB of SRAM
  46. which is not enough to support device tree. Disable this option to
  47. allow such boards to be supported by U-Boot SPL.
  48. config TPL_OF_CONTROL
  49. bool "Enable run-time configuration via Device Tree in TPL"
  50. depends on TPL && OF_CONTROL
  51. select TPL_OF_LIBFDT if !TPL_OF_PLATDATA
  52. select TPL_OF_REAL if !TPL_OF_PLATDATA
  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 TPL.
  57. config VPL_OF_CONTROL
  58. bool "Enable run-time configuration via Device Tree in VPL"
  59. depends on VPL && OF_CONTROL
  60. default y if SPL_OF_CONTROL
  61. help
  62. Some boards use device tree in U-Boot but only have 4KB of SRAM
  63. which is not enough to support device tree. Enable this option to
  64. allow such boards to be supported by U-Boot VPL.
  65. config OF_LIVE
  66. bool "Enable use of a live tree"
  67. depends on DM && OF_CONTROL
  68. help
  69. Normally U-Boot uses a flat device tree which saves space and
  70. avoids the need to unpack the tree before use. However a flat
  71. tree does not support modification from within U-Boot since it
  72. can invalidate driver-model device tree offsets. This option
  73. enables a live tree which is available after relocation,
  74. and can be adjusted as needed.
  75. choice
  76. prompt "Provider of DTB for DT control"
  77. depends on OF_CONTROL
  78. config OF_SEPARATE
  79. bool "Separate DTB for DT control"
  80. help
  81. If this option is enabled, the device tree will be built and
  82. placed as a separate u-boot.dtb file alongside the U-Boot image.
  83. config OF_EMBED
  84. bool "Embedded DTB for DT control"
  85. help
  86. If this option is enabled, the device tree will be picked up and
  87. built into the U-Boot image. This is suitable for local debugging
  88. and development only and is not recommended for production devices.
  89. Boards in the mainline U-Boot tree should not use it.
  90. endchoice
  91. config OF_BOARD
  92. bool "Provided by the board (e.g a previous loader) at runtime"
  93. default y if SANDBOX || OF_HAS_PRIOR_STAGE
  94. help
  95. If this option is enabled, the device tree is provided at runtime by
  96. a custom function called board_fdt_blob_setup(). The board must
  97. implement this function if it wishes to provide special behaviour.
  98. With this option, the device tree build by U-Boot may be overridden or
  99. ignored. See OF_HAS_PRIOR_STAGE.
  100. Note: Boards which use this to handle a device tree passed from an
  101. earlier stage should enable OF_HAS_PRIOR_STAGE.
  102. config OF_HAS_PRIOR_STAGE
  103. bool
  104. help
  105. Indicates that a prior stage of the firmware (before U-Boot proper)
  106. makes use of device tree and this board normally boots with that prior
  107. stage, that provides a devicetree to U-Boot.
  108. This means that the device tree built in U-Boot should not be packaged
  109. in the firmware image. Instead, the prior stage's device tree should
  110. be so packaged. At runtime, the prior stage reads this, does any
  111. necessary fix-ups, then passes it to U-Boot. See OF_BOARD.
  112. This option does not preclude using the U-Boot device tree, e.g. for
  113. development purposes, but it is not recommended, and likely will not
  114. even work, for production systems.
  115. Note: This option must be set in Kconfig and cannot be enabled or
  116. disabled in the board's defconfig file.
  117. config OF_OMIT_DTB
  118. bool "Omit the device tree output when building"
  119. default y if OF_HAS_PRIOR_STAGE && !BINMAN
  120. help
  121. As a special case, avoid writing a device tree file u-boot.dtb when
  122. building. Also don't include that file in u-boot.bin
  123. This is used for boards which normally provide a devicetree via a
  124. runtime mechanism (such as OF_BOARD), to avoid confusion.
  125. config DEFAULT_DEVICE_TREE
  126. string "Default Device Tree for DT control"
  127. depends on OF_CONTROL
  128. help
  129. This option specifies the default Device Tree used for DT control.
  130. It can be overridden from the command line:
  131. $ make DEVICE_TREE=<device-tree-name>
  132. config DEVICE_TREE_INCLUDES
  133. string "Extra .dtsi files to include when building DT control"
  134. depends on OF_CONTROL
  135. help
  136. U-Boot's control .dtb is usually built from an in-tree .dts
  137. file, plus (if available) an in-tree U-Boot-specific .dtsi
  138. file. This option specifies a space-separated list of extra
  139. .dtsi files that will also be used.
  140. config OF_LIST
  141. string "List of device tree files to include for DT control" if SPL_LOAD_FIT || MULTI_DTB_FIT
  142. depends on OF_CONTROL
  143. default DEFAULT_DEVICE_TREE
  144. help
  145. This option specifies a list of device tree files to use for DT
  146. control. These will be packaged into a FIT. At run-time, U-Boot
  147. or SPL will select the correct DT to use by examining the
  148. hardware (e.g. reading a board ID value). This is a list of
  149. device tree files (without the directory or .dtb suffix)
  150. separated by <space>.
  151. config OF_OVERLAY_LIST
  152. string "List of device tree overlays to include for DT control"
  153. depends on SPL_LOAD_FIT_APPLY_OVERLAY
  154. help
  155. This option specifies a list of device tree overlays to use for DT
  156. control. This option can then be used by a FIT generator to include
  157. the overlays in the FIT image.
  158. choice
  159. prompt "OF LIST compression"
  160. depends on MULTI_DTB_FIT
  161. default MULTI_DTB_FIT_NO_COMPRESSION
  162. config MULTI_DTB_FIT_LZO
  163. bool "LZO"
  164. depends on SYS_MALLOC_F
  165. select LZO
  166. help
  167. Compress the FIT image containing the DTBs available for the SPL
  168. using LZO compression. (requires lzop on host).
  169. config MULTI_DTB_FIT_GZIP
  170. bool "GZIP"
  171. depends on SYS_MALLOC_F
  172. select GZIP
  173. help
  174. Compress the FIT image containing the DTBs available for the SPL
  175. using GZIP compression. (requires gzip on host)
  176. config MULTI_DTB_FIT_NO_COMPRESSION
  177. bool "No compression"
  178. help
  179. Do not compress the FIT image containing the DTBs available for the SPL.
  180. Use this options only if LZO is not available and the DTBs are very small.
  181. endchoice
  182. choice
  183. prompt "Location of uncompressed DTBs"
  184. depends on (MULTI_DTB_FIT_GZIP || MULTI_DTB_FIT_LZO)
  185. default MULTI_DTB_FIT_DYN_ALLOC if SYS_MALLOC_F
  186. config MULTI_DTB_FIT_DYN_ALLOC
  187. bool "Dynamically allocate the memory"
  188. depends on SYS_MALLOC_F
  189. config MULTI_DTB_FIT_USER_DEFINED_AREA
  190. bool "User-defined location"
  191. endchoice
  192. config MULTI_DTB_FIT_UNCOMPRESS_SZ
  193. hex "Size of memory reserved to uncompress the DTBs"
  194. default 0x8000
  195. help
  196. This is the size of this area where the DTBs are uncompressed.
  197. If this area is dynamically allocated, make sure that
  198. SYS_MALLOC_F_LEN is big enough to contain it.
  199. config MULTI_DTB_FIT_USER_DEF_ADDR
  200. hex "Address of memory where dtbs are uncompressed"
  201. depends on MULTI_DTB_FIT_USER_DEFINED_AREA
  202. help
  203. the FIT image containing the DTBs is uncompressed in an area defined
  204. at compilation time. This is the address of this area. It must be
  205. aligned on 2-byte boundary.
  206. config DTB_RESELECT
  207. bool "Support swapping dtbs at a later point in boot"
  208. depends on MULTI_DTB_FIT
  209. help
  210. It is possible during initial boot you may need to use a generic
  211. dtb until you can fully determine the board your running on. This
  212. config allows boards to implement a function at a later point
  213. during boot to switch to the "correct" dtb.
  214. config MULTI_DTB_FIT
  215. bool "Support embedding several DTBs in a FIT image for u-boot"
  216. help
  217. This option provides hooks to allow U-Boot to parse an
  218. appended FIT image and enable board specific code to then select
  219. the correct DTB to be used. Use this if you need to support
  220. multiple DTBs but don't use the SPL.
  221. config SPL_MULTI_DTB_FIT
  222. depends on SPL_LOAD_FIT && SPL_OF_REAL
  223. bool "Support embedding several DTBs in a FIT image for the SPL"
  224. help
  225. This option provides the SPL with the ability to select its own
  226. DTB at runtime from an appended FIT image containing several DTBs.
  227. This allows using the same SPL binary on multiple platforms.
  228. The primary purpose is to handle different versions of
  229. the same platform without tweaking the platform code if the
  230. differences can be expressed in the DTBs (common examples are: bus
  231. capabilities, pad configurations).
  232. config SPL_OF_LIST
  233. string "List of device tree files to include for DT control in SPL" if SPL_MULTI_DTB_FIT
  234. depends on SPL_OF_CONTROL
  235. default OF_LIST
  236. help
  237. This option specifies a list of device tree files to use for DT
  238. control in the SPL. These will be packaged into a FIT. At run-time,
  239. the SPL will select the correct DT to use by examining the
  240. hardware (e.g. reading a board ID value). This is a list of
  241. device tree files (without the directory or .dtb suffix)
  242. separated by <space>.
  243. choice
  244. prompt "SPL OF LIST compression"
  245. depends on SPL_MULTI_DTB_FIT
  246. default SPL_MULTI_DTB_FIT_LZO
  247. config SPL_MULTI_DTB_FIT_LZO
  248. bool "LZO"
  249. depends on SYS_MALLOC_F
  250. select SPL_LZO
  251. help
  252. Compress the FIT image containing the DTBs available for the SPL
  253. using LZO compression. (requires lzop on host).
  254. config SPL_MULTI_DTB_FIT_GZIP
  255. bool "GZIP"
  256. depends on SYS_MALLOC_F
  257. select SPL_GZIP
  258. help
  259. Compress the FIT image containing the DTBs available for the SPL
  260. using GZIP compression. (requires gzip on host)
  261. config SPL_MULTI_DTB_FIT_NO_COMPRESSION
  262. bool "No compression"
  263. help
  264. Do not compress the FIT image containing the DTBs available for the SPL.
  265. Use this options only if LZO is not available and the DTBs are very small.
  266. endchoice
  267. choice
  268. prompt "Location of uncompressed DTBs"
  269. depends on (SPL_MULTI_DTB_FIT_GZIP || SPL_MULTI_DTB_FIT_LZO)
  270. default SPL_MULTI_DTB_FIT_DYN_ALLOC if SYS_MALLOC_F
  271. config SPL_MULTI_DTB_FIT_DYN_ALLOC
  272. bool "Dynamically allocate the memory"
  273. depends on SYS_MALLOC_F
  274. config SPL_MULTI_DTB_FIT_USER_DEFINED_AREA
  275. bool "User-defined location"
  276. endchoice
  277. config SPL_MULTI_DTB_FIT_UNCOMPRESS_SZ
  278. hex "Size of memory reserved to uncompress the DTBs"
  279. depends on (SPL_MULTI_DTB_FIT_GZIP || SPL_MULTI_DTB_FIT_LZO)
  280. default 0x8000
  281. help
  282. This is the size of this area where the DTBs are uncompressed.
  283. If this area is dynamically allocated, make sure that
  284. SPL_SYS_MALLOC_F_LEN is big enough to contain it.
  285. config SPL_MULTI_DTB_FIT_USER_DEF_ADDR
  286. hex "Address of memory where dtbs are uncompressed"
  287. depends on SPL_MULTI_DTB_FIT_USER_DEFINED_AREA
  288. help
  289. the FIT image containing the DTBs is uncompressed in an area defined
  290. at compilation time. This is the address of this area. It must be
  291. aligned on 2-byte boundary.
  292. config OF_TAG_MIGRATE
  293. bool "Ease migration from old device trees with u-boot,dm- tags"
  294. default y
  295. help
  296. U-Boot moved over to use new tags to mark device tree nodes which need
  297. to be processed in SPL, before relocation, etc. Enable this option to
  298. detect old tags and handle them.
  299. Note: This option will be removed after the 2023.07 release.
  300. config OF_SPL_REMOVE_PROPS
  301. string "List of device tree properties to drop for SPL"
  302. depends on SPL_OF_CONTROL
  303. default "interrupt-parent interrupts" if SPL_PINCTRL && SPL_CLK
  304. default "clocks clock-names interrupt-parent interrupts" if SPL_PINCTRL
  305. default "pinctrl-0 pinctrl-names interrupt-parent interrupts" if SPL_CLK
  306. default "pinctrl-0 pinctrl-names clocks clock-names interrupt-parent interrupts"
  307. help
  308. Since SPL normally runs in a reduced memory space, the device tree
  309. is cut down to only what is needed to load and start U-Boot. Only
  310. nodes marked with the property "bootph-all" will be
  311. included. In addition, some properties are not used by U-Boot and
  312. can be discarded. This option defines the list of properties to
  313. discard.
  314. config OF_DTB_PROPS_REMOVE
  315. bool "Enable removal of device tree properties"
  316. depends on OF_CONTROL
  317. help
  318. Some boards have restricted amount of storage for U-Boot image.
  319. If the generated binary doesn't fit into available image storage,
  320. the built-in device tree could probably be cut down by removing
  321. some not required device tree properties to reduce the image size.
  322. Enable this option and define the properties to be removed in the
  323. CONFIG_OF_REMOVE_PROPS list. Do not enable this option if you must
  324. pass the built-in DTB directly to the kernel!
  325. config OF_REMOVE_PROPS
  326. string "List of device tree properties to drop"
  327. depends on OF_DTB_PROPS_REMOVE
  328. default "interrupt-parent interrupts" if PINCTRL
  329. help
  330. Some properties are not used by U-Boot and can be discarded.
  331. This option defines the list of properties to discard.
  332. config SPL_OF_PLATDATA
  333. bool "Generate platform data for use in SPL"
  334. depends on SPL_OF_CONTROL
  335. select DTOC
  336. select SPL_OF_PLATDATA_DRIVER_RT if !SPL_OF_PLATDATA_INST
  337. help
  338. For very constrained SPL environments the overhead of decoding
  339. device tree nodes and converting their contents into platform data
  340. is too large. This overhead includes libfdt code as well as the
  341. device tree contents itself. The latter is fairly compact, but the
  342. former can add 3KB or more to a Thumb 2 Image.
  343. This option enables generation of platform data from the device
  344. tree as C code. This code creates devices using U_BOOT_DRVINFO()
  345. declarations. The benefit is that it allows driver code to access
  346. the platform data directly in C structures, avoidin the libfdt
  347. overhead.
  348. This option works by generating C structure declarations for each
  349. compatible string, then adding platform data and U_BOOT_DRVINFO
  350. declarations for each node. See of-plat.txt for more information.
  351. config SPL_OF_REAL
  352. bool
  353. help
  354. Indicates that a real devicetree is available which can be accessed
  355. at runtime. This means that dev_read_...() functions can be used to
  356. read data from the devicetree for each device. This is true if
  357. SPL_OF_CONTROL is enabled and not SPL_OF_PLATDATA
  358. if SPL_OF_PLATDATA
  359. config SPL_OF_PLATDATA_PARENT
  360. bool "Support parent information in devices"
  361. default y
  362. help
  363. Generally it is useful to be able to access the parent of a device
  364. with of-platdata. To save space this can be disabled, but in that
  365. case dev_get_parent() will always return NULL;
  366. config SPL_OF_PLATDATA_INST
  367. bool "Declare devices at build time"
  368. help
  369. Declare devices as udevice instances so that they do not need to be
  370. bound when U-Boot starts. This can save time and code space.
  371. config SPL_OF_PLATDATA_NO_BIND
  372. bool "Don't allow run-time binding of devices"
  373. depends on SPL_OF_PLATDATA_INST
  374. default y
  375. help
  376. This removes the ability to bind devices at run time, thus saving
  377. some code space in U-Boot. This can be disabled if binding is needed,
  378. at the code of some code size increase.
  379. config SPL_OF_PLATDATA_RT
  380. bool "Use a separate struct for device runtime data"
  381. depends on SPL_OF_PLATDATA_INST
  382. default y
  383. help
  384. For systems running SPL from read-only memory it is convenient to
  385. separate out the runtime information, so that the devices don't need
  386. to be copied before being used. This moves the read-write parts of
  387. struct udevice (at present just the flags) into a separate struct,
  388. which is allocated at runtime.
  389. config SPL_OF_PLATDATA_DRIVER_RT
  390. bool
  391. help
  392. Use a separate struct for driver runtime data.
  393. This enables the driver_rt information, used with of-platdata when
  394. of-platdata-inst is not used. It allows finding devices by their
  395. driver data.
  396. endif
  397. config TPL_OF_REAL
  398. bool
  399. help
  400. Indicates that a real devicetree is available which can be accessed
  401. at runtime. This means that dev_read_...() functions can be used to
  402. read data from the devicetree for each device. This is true if
  403. TPL_OF_CONTROL is enabled and not TPL_OF_PLATDATA
  404. config TPL_OF_PLATDATA
  405. bool "Generate platform data for use in TPL"
  406. depends on TPL_OF_CONTROL
  407. select DTOC
  408. select TPL_OF_PLATDATA_DRIVER_RT if !TPL_OF_PLATDATA_INST
  409. help
  410. For very constrained SPL environments the overhead of decoding
  411. device tree nodes and converting their contents into platform data
  412. is too large. This overhead includes libfdt code as well as the
  413. device tree contents itself. The latter is fairly compact, but the
  414. former can add 3KB or more to a Thumb 2 Image.
  415. This option enables generation of platform data from the device
  416. tree as C code. This code creates devices using U_BOOT_DRVINFO()
  417. declarations. The benefit is that it allows driver code to access
  418. the platform data directly in C structures, avoidin the libfdt
  419. overhead.
  420. This option works by generating C structure declarations for each
  421. compatible string, then adding platform data and U_BOOT_DRVINFO
  422. declarations for each node. See of-plat.txt for more information.
  423. if TPL_OF_PLATDATA
  424. config TPL_OF_PLATDATA_PARENT
  425. bool "Support parent information in devices"
  426. default y
  427. help
  428. Generally it is useful to be able to access the parent of a device
  429. with of-platdata. To save space this can be disabled, but in that
  430. case dev_get_parent() will always return NULL;
  431. config TPL_OF_PLATDATA_INST
  432. bool "Declare devices at build time"
  433. help
  434. Declare devices as udevice instances so that they do not need to be
  435. bound when U-Boot starts. This can save time and code space.
  436. config TPL_OF_PLATDATA_NO_BIND
  437. bool "Don't allow run-time binding of devices"
  438. depends on TPL_OF_PLATDATA_INST
  439. default y
  440. help
  441. This removes the ability to bind devices at run time, thus saving
  442. some code space in U-Boot. This can be disabled if binding is needed,
  443. at the code of some code size increase.
  444. config TPL_OF_PLATDATA_RT
  445. bool "Use a separate struct for device runtime data"
  446. depends on TPL_OF_PLATDATA_INST
  447. default y
  448. help
  449. For systems running TPL from read-only memory it is convenient to
  450. separate out the runtime information, so that the devices don't need
  451. to be copied before being used. This moves the read-write parts of
  452. struct udevice (at present just the flags) into a separate struct,
  453. which is allocated at runtime.
  454. config TPL_OF_PLATDATA_DRIVER_RT
  455. bool
  456. help
  457. Use a separate struct for driver runtime data.
  458. This enables the driver_rt information, used with of-platdata when
  459. of-platdata-inst is not used. It allows finding devices by their
  460. driver data.
  461. endif
  462. config VPL_OF_REAL
  463. def_bool y
  464. depends on VPL
  465. help
  466. Indicates that a real devicetree is available which can be accessed
  467. at runtime. This means that dev_read_...() functions can be used to
  468. read data from the devicetree for each device. This is true if
  469. TPL_OF_CONTROL is enabled and not TPL_OF_PLATDATA
  470. endmenu