xref: /openbmc/u-boot/doc/README.multi-dtb-fit (revision 2f57c95100f231de0f4e0301237cbe477e09084b)
1*2f57c951SJean-Jacques HiblotMULTI DTB FIT and SPL_MULTI_DTB_FIT
211955590SJean-Jacques Hiblot
3*2f57c951SJean-Jacques HiblotThe purpose of this feature is to enable U-Boot or the SPL to select its DTB
4*2f57c951SJean-Jacques Hiblotfrom a FIT appended at the end of the binary.
5*2f57c951SJean-Jacques HiblotIt comes in two flavors: U-Boot (CONFIG_MULTI_DTB_FIT) and SPL
6*2f57c951SJean-Jacques Hiblot(CONFIG_SPL_MULTI_DTB_FIT).
711955590SJean-Jacques Hiblot
8*2f57c951SJean-Jacques HiblotU-Boot flavor:
911955590SJean-Jacques HiblotUsually the DTB is selected by the SPL and passed down to U-Boot. But some
1011955590SJean-Jacques Hiblotplatforms don't use the SPL. In this case MULTI_DTB_FIT can used to provide
1111955590SJean-Jacques HiblotU-Boot with a choice of DTBs.
1211955590SJean-Jacques HiblotThe relevant DTBs are packed into a FIT (list provided by CONFIG__OF_LIST). The
1311955590SJean-Jacques HiblotFIT is automatically generated at the end of the compilation and appended to
1411955590SJean-Jacques Hiblotu-boot.bin so that U-Boot can locate it and select the correct DTB from inside
1511955590SJean-Jacques Hiblotthe FIT.
1611955590SJean-Jacques HiblotThe selection is done using board_fit_config_name_match() (same as what the SPL
1711955590SJean-Jacques Hiblotuses to select the DTB for U-Boot). The selection happens during fdtdec_setup()
1811955590SJean-Jacques Hiblotwhich is called during before relocation by board_init_f().
19*2f57c951SJean-Jacques Hiblot
20*2f57c951SJean-Jacques HiblotSPL flavor:
21*2f57c951SJean-Jacques Hiblotthe SPL uses only a small subset of the DTB and it usually depends more
22*2f57c951SJean-Jacques Hibloton the SOC than on the board. So it's usually fine to include a DTB in the
23*2f57c951SJean-Jacques HiblotSPL that doesn't exactly match the board. There are howerver some cases
24*2f57c951SJean-Jacques Hiblotwhere it's not possible. In the later case, in order to support multiple
25*2f57c951SJean-Jacques Hiblotboards (or board revisions) with the same SPL binary, SPL_MULTI_DTB_FIT
26*2f57c951SJean-Jacques Hiblotcan be used.
27*2f57c951SJean-Jacques HiblotThe relevant DTBs are packed into a FIT. This FIT is automatically generated
28*2f57c951SJean-Jacques Hiblotat the end of the compilation, compressed and appended to u-boot-spl.bin, so
29*2f57c951SJean-Jacques Hiblotthat SPL can locate it and select the correct DTB from inside the FIT.
30*2f57c951SJean-Jacques HiblotCONFIG_SPL__OF_LIST is used to list the relevant DTBs.
31*2f57c951SJean-Jacques HiblotThe compression stage is optional but reduces the impact on the size of the
32*2f57c951SJean-Jacques HiblotSPL. LZO and GZIP compressions are supported. By default, the area where the
33*2f57c951SJean-Jacques HiblotFIT is uncompressed is dynamicaly allocated but this behaviour can be changed
34*2f57c951SJean-Jacques Hiblotfor platforms that don't provide a HEAP big enough to contain the uncompressed
35*2f57c951SJean-Jacques HiblotFIT.
36*2f57c951SJean-Jacques HiblotThe SPL uses board_fit_config_name_match() to find the correct DTB within the
37*2f57c951SJean-Jacques HiblotFIT (same as what the SPL uses to select the DTB for U-Boot).
38*2f57c951SJean-Jacques HiblotUncompression and selection stages happen in fdtdec_setup() which is called
39*2f57c951SJean-Jacques Hiblotduring the early initialization stage of the SPL (spl_early_init() or
40*2f57c951SJean-Jacques Hiblotspl_init())
41*2f57c951SJean-Jacques Hiblot
42*2f57c951SJean-Jacques HiblotImpacts and performances (SPL flavor):
43*2f57c951SJean-Jacques HiblotThe impact of this option is relatively small. Here are some numbers measured
44*2f57c951SJean-Jacques Hiblotfor a TI DRA72 platform:
45*2f57c951SJean-Jacques Hiblot
46*2f57c951SJean-Jacques Hiblot                            +----------+------------+-----------+------------+
47*2f57c951SJean-Jacques Hiblot                            |  size    | size delta | SPL boot  | boot time  |
48*2f57c951SJean-Jacques Hiblot                            |  (bytes) | (bytes)    | time (s)  | delta (s)  |
49*2f57c951SJean-Jacques Hiblot+---------------------------+----------+------------+-----------+------------+
50*2f57c951SJean-Jacques Hiblot| 1 DTB                     |          |            |           |            |
51*2f57c951SJean-Jacques Hiblot+---------------------------+----------+------------+-----------+------------+
52*2f57c951SJean-Jacques Hiblot| reference                 |   125305 |          0 |     1.389 |          0 |
53*2f57c951SJean-Jacques Hiblot| LZO (dynamic allocation)  |   125391 |         86 |     1.381 |     -0.008 |
54*2f57c951SJean-Jacques Hiblot+---------------------------+----------+------------+-----------+------------+
55*2f57c951SJean-Jacques Hiblot| 4 DTBs (DRA7, DRA71,      |          |            |           |            |
56*2f57c951SJean-Jacques Hiblot| DRA72, DRA72 revC)        |          |            |           |            |
57*2f57c951SJean-Jacques Hiblot+---------------------------+----------+------------+-----------+------------+
58*2f57c951SJean-Jacques Hiblot| LZO (dynamic allocation)  |   125991 |        686 |      1.39 |      0.001 |
59*2f57c951SJean-Jacques Hiblot| LZO (user defined area)   |   125927 |        622 |     1.403 |      0.014 |
60*2f57c951SJean-Jacques Hiblot| GZIP (user defined area)  |   133880 |       8575 |     1.421 |      0.032 |
61*2f57c951SJean-Jacques Hiblot| No compression (in place) |   137472 |      12167 |     1.412 |      0.023 |
62*2f57c951SJean-Jacques Hiblot+---------------------------+----------+------------+-----------+------------+
63*2f57c951SJean-Jacques Hiblot
64*2f57c951SJean-Jacques HiblotNote: SPL boot time is the time elapsed between the 'reset' command is entered
65*2f57c951SJean-Jacques Hiblotand the time when the first U-Boot (not SPL) version string is displayed.
66