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