xref: /OK3568_Linux_fs/u-boot/doc/README.multi-dtb-fit (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunMULTI DTB FIT and SPL_MULTI_DTB_FIT
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunThe purpose of this feature is to enable U-Boot or the SPL to select its DTB
4*4882a593Smuzhiyunfrom a FIT appended at the end of the binary.
5*4882a593SmuzhiyunIt comes in two flavors: U-Boot (CONFIG_MULTI_DTB_FIT) and SPL
6*4882a593Smuzhiyun(CONFIG_SPL_MULTI_DTB_FIT).
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunU-Boot flavor:
9*4882a593SmuzhiyunUsually the DTB is selected by the SPL and passed down to U-Boot. But some
10*4882a593Smuzhiyunplatforms don't use the SPL. In this case MULTI_DTB_FIT can used to provide
11*4882a593SmuzhiyunU-Boot with a choice of DTBs.
12*4882a593SmuzhiyunThe relevant DTBs are packed into a FIT (list provided by CONFIG__OF_LIST). The
13*4882a593SmuzhiyunFIT is automatically generated at the end of the compilation and appended to
14*4882a593Smuzhiyunu-boot.bin so that U-Boot can locate it and select the correct DTB from inside
15*4882a593Smuzhiyunthe FIT.
16*4882a593SmuzhiyunThe selection is done using board_fit_config_name_match() (same as what the SPL
17*4882a593Smuzhiyunuses to select the DTB for U-Boot). The selection happens during fdtdec_setup()
18*4882a593Smuzhiyunwhich is called during before relocation by board_init_f().
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunSPL flavor:
21*4882a593Smuzhiyunthe SPL uses only a small subset of the DTB and it usually depends more
22*4882a593Smuzhiyunon the SOC than on the board. So it's usually fine to include a DTB in the
23*4882a593SmuzhiyunSPL that doesn't exactly match the board. There are howerver some cases
24*4882a593Smuzhiyunwhere it's not possible. In the later case, in order to support multiple
25*4882a593Smuzhiyunboards (or board revisions) with the same SPL binary, SPL_MULTI_DTB_FIT
26*4882a593Smuzhiyuncan be used.
27*4882a593SmuzhiyunThe relevant DTBs are packed into a FIT. This FIT is automatically generated
28*4882a593Smuzhiyunat the end of the compilation, compressed and appended to u-boot-spl.bin, so
29*4882a593Smuzhiyunthat SPL can locate it and select the correct DTB from inside the FIT.
30*4882a593SmuzhiyunCONFIG_SPL__OF_LIST is used to list the relevant DTBs.
31*4882a593SmuzhiyunThe compression stage is optional but reduces the impact on the size of the
32*4882a593SmuzhiyunSPL. LZO and GZIP compressions are supported. By default, the area where the
33*4882a593SmuzhiyunFIT is uncompressed is dynamicaly allocated but this behaviour can be changed
34*4882a593Smuzhiyunfor platforms that don't provide a HEAP big enough to contain the uncompressed
35*4882a593SmuzhiyunFIT.
36*4882a593SmuzhiyunThe SPL uses board_fit_config_name_match() to find the correct DTB within the
37*4882a593SmuzhiyunFIT (same as what the SPL uses to select the DTB for U-Boot).
38*4882a593SmuzhiyunUncompression and selection stages happen in fdtdec_setup() which is called
39*4882a593Smuzhiyunduring the early initialization stage of the SPL (spl_early_init() or
40*4882a593Smuzhiyunspl_init())
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunImpacts and performances (SPL flavor):
43*4882a593SmuzhiyunThe impact of this option is relatively small. Here are some numbers measured
44*4882a593Smuzhiyunfor a TI DRA72 platform:
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun                            +----------+------------+-----------+------------+
47*4882a593Smuzhiyun                            |  size    | size delta | SPL boot  | boot time  |
48*4882a593Smuzhiyun                            |  (bytes) | (bytes)    | time (s)  | delta (s)  |
49*4882a593Smuzhiyun+---------------------------+----------+------------+-----------+------------+
50*4882a593Smuzhiyun| 1 DTB                     |          |            |           |            |
51*4882a593Smuzhiyun+---------------------------+----------+------------+-----------+------------+
52*4882a593Smuzhiyun| reference                 |   125305 |          0 |     1.389 |          0 |
53*4882a593Smuzhiyun| LZO (dynamic allocation)  |   125391 |         86 |     1.381 |     -0.008 |
54*4882a593Smuzhiyun+---------------------------+----------+------------+-----------+------------+
55*4882a593Smuzhiyun| 4 DTBs (DRA7, DRA71,      |          |            |           |            |
56*4882a593Smuzhiyun| DRA72, DRA72 revC)        |          |            |           |            |
57*4882a593Smuzhiyun+---------------------------+----------+------------+-----------+------------+
58*4882a593Smuzhiyun| LZO (dynamic allocation)  |   125991 |        686 |      1.39 |      0.001 |
59*4882a593Smuzhiyun| LZO (user defined area)   |   125927 |        622 |     1.403 |      0.014 |
60*4882a593Smuzhiyun| GZIP (user defined area)  |   133880 |       8575 |     1.421 |      0.032 |
61*4882a593Smuzhiyun| No compression (in place) |   137472 |      12167 |     1.412 |      0.023 |
62*4882a593Smuzhiyun+---------------------------+----------+------------+-----------+------------+
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunNote: SPL boot time is the time elapsed between the 'reset' command is entered
65*4882a593Smuzhiyunand the time when the first U-Boot (not SPL) version string is displayed.
66