Kconfig 18 KB

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