Hi Simon,

On 13/08/2019 11:33, Simon Glass wrote:
Hi Jean-Jacques,

On Mon, 5 Aug 2019 at 03:44, Jean-Jacques Hiblot <jjhib...@ti.com> wrote:

The purpose of this series is to provide the SPL with ability to apply
overlays for u-boot. this is only a RFC so far, to get a feedback on the
approach.

Our use-case is the support of the daughter boards of the AM65x EVM. In
Linux, each board is supported by a unique overlay. The presence of the
boards is detected at runtime, and some useful features (like USB) are
implemented on those daughter boards. Instead of providing multiple dtbs
and fall in a combinatorial pit, we propose to use DT overlays.
But why do this in SPL? Is it so U-Boot can use the DT with overlays
itself for driver model?

Sorry for the long delay.

You are right, the goal is to be able to apply DTB overlays in the SPL so that u-boot the DTB+ overlays for its driver model.

Our platform for example has optional daughter cards with various combination of PCIe, USB and Ethernet.

At the kernel level the hardware is described in separate overlays. U-boot is responsible to detect the HW and load/apply the needed overlays.

We want to do the same in u-boot and the SPL will load/apply the right overlays.

JJ


Patch #2 "spl: fit: Add support for applying DT overlay" has been posted
a few weeks ago by Michal Simek.
Patch #3 to #6 amend Michal's patch.
Patch #7 to #9 are simple fixes for the Makefile
Patch #10 is used to reduce the complexity of the Makefile by having FIT
generator scripts provide their dependencies
Patch #12-#13 allow to use the board driver in SPL
Patch #14-#15 adds a way to dynamically select the DT overlays. That is
were we would use HW detection to select the required overlays. In that
case, the board driver code tells what overlay it needs (it gives the
name of the node).

On arm, if overlay are supported, this series increases the size of the SPL
by 3.2 kB.

Travis build : https://travis-ci.org/jjhiblot/u-boot/builds/567779404

Changes in v4:
- use CONFIG_IS_ENABLED() instead of #idef
- make sure that the temp buffer is freed in all cases
- Use the board driver infrastructure to get the image names from the
board code.
- Remove a patch that passed the board name to the FIT generator. If needed
the generator can get it from elsewhere
- Add a fix to not load the firmware twice (once as a firmware and once as
a loadable)

Changes in v3:
- Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is
not selected.
- removed the RFC prefix. This work will be needed soon by TI's AM65x
platform. and can probably benefit other modular platforms
- removed the last patch that provided an example of how to use this with
on a DRA76.
- removed the patch that made u-boot.img a symlink to u-boot.itb because
it breaks the build of many platforms (because files required to build the
ITB are missing)
- removed the patch to reduce the footprint of the am335x SPL. (already
merged)
- Made the boot flow more permissive (don't fail immediately if an overlay
is not present) and more verbose when an error occures
- handle the dependencies of the FIT generation in a more generic way
- use a dedicated kconfig option to enable the application of the overlays
by the SPL.

Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the
   overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm

Jean-Jacques Hiblot (14):
   spl: fit: don't load the firmware twice
   spl: fit: Make room in the FDT before applying overlays
   spl: fit: allocate a temporary buffer to load the overlays
   spl: fit: Do not fail immediately if an overlay is not available
   spl: fit: be more verbose when an error occurs when applying the
     overlays
   Makefile.lib: include /__symbols__ in dtb if
     SPL_LOAD_FIT_APPLY_OVERLAY is enabled
   Makefile: Fix tests for CONFIG_SPL_LOAD_FIT and
     CONFIG_SPL_FIT_GENERATOR
   Makefile: Fix u-boot.itb generation when building outside the source
     tree
   Makefile: Query the SPL Fit Generator for its dependencies
   spl: fit: constify the output parameter of spl_fit_get_image_name()
   drivers: board: Make the board drivers available in SPL
   drivers: board: Add get_fit_loadable()
   include: board: provide empty stubs when the BOARD option is not
     selected
   spl: fit: Allow the board to tell if more images must be loaded from
     FIT

Michal Simek (1):
   spl: fit: Add support for applying DT overlay

  Kconfig                                       |   9 ++
  Makefile                                      |  23 ++--
  arch/arm/mach-imx/mkimage_fit_atf.sh          |   5 +
  arch/arm/mach-rockchip/make_fit_atf.py        |   7 ++
  board/sunxi/mksunxi_fit_atf.sh                |   4 +
  .../lion_rk3368/fit_spl_atf.its               |   6 +-
  .../puma_rk3399/fit_spl_atf.sh                |   6 +
  common/spl/spl_fit.c                          | 104 ++++++++++++++++--
  drivers/Makefile                              |   2 +-
  drivers/board/Kconfig                         |   2 +
  drivers/board/Makefile                        |   2 +-
  drivers/board/board-uclass.c                  |  11 ++
  include/board.h                               |  72 ++++++++++++
  scripts/Makefile.lib                          |   4 +
  14 files changed, 230 insertions(+), 27 deletions(-)

--
2.17.1

Please can we have a sandbox test for this?

Regards,
SImon

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to