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