platform/kernel/u-boot.git
4 years agoMerge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 8 Jan 2020 23:57:11 +0000 (18:57 -0500)]
Merge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc1

This pull request provides:

* support for FIT images for UEFI binaries
* drivers for hardware random number generators
* an implementation of the EFI_RNG_PROTOCOL
* a sub-command for efidebug to display configuration tables

4 years agoMerge tag 'uniphier-v2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 8 Jan 2020 20:25:13 +0000 (15:25 -0500)]
Merge tag 'uniphier-v2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier

UniPhier SoC updates for v2020.04

- add pinmux nodes for I2C ch5, ch6

- enable SPI driver and command

4 years agoMerge tag 'u-boot-imx-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 8 Jan 2020 20:24:50 +0000 (15:24 -0500)]
Merge tag 'u-boot-imx-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

---------------------------------------------------------------------
Add i.MX8MP SoC and EVK board
Update README for i.MX8MN EVK and fix mmc env
Add pca9450 driver
--------------------------------------------------------------------

Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/634211885

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Wed, 8 Jan 2020 20:23:49 +0000 (15:23 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

4 years agoMerge tag 'u-boot-amlogic-20200108' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 8 Jan 2020 20:23:37 +0000 (15:23 -0500)]
Merge tag 'u-boot-amlogic-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- Khadas VIM3L based on Amlogic S905D3 support
- Various fixups for amlogic boards
- Unnecessary header includes drop into video/meson

4 years agoMerge branch '2020-01-07-master-imports'
Tom Rini [Wed, 8 Jan 2020 20:08:34 +0000 (15:08 -0500)]
Merge branch '2020-01-07-master-imports'

- DT overlay support in FIT images in SPL
- remoteproc update
- Assorted SATA fixes
- Other assorted fixes

4 years agouniphier_{v7, v8}_defconfig: enable SPI driver and sspi command
Masahiro Yamada [Tue, 7 Jan 2020 09:47:26 +0000 (18:47 +0900)]
uniphier_{v7, v8}_defconfig: enable SPI driver and sspi command

Compile drivers/spi/uniphier_spi.c and cmd/spi.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoARM: dts: uniphier: add pinmux nodes for I2C ch5, ch6
Masahiro Yamada [Tue, 7 Jan 2020 09:19:23 +0000 (18:19 +0900)]
ARM: dts: uniphier: add pinmux nodes for I2C ch5, ch6

The next generation SoC can connect on-board slave devices via
I2C ch5 and ch6.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoata: fsl_sata: Continue probing other sata port when failed current port.
Peng Ma [Wed, 4 Dec 2019 10:36:45 +0000 (10:36 +0000)]
ata: fsl_sata: Continue probing other sata port when failed current port.

In the initialization of sata driver, we want to initialize all port
 probes, Therefore, any detection failure between of them should continue
 initialization by skipping the current port instead of exit.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
4 years agoata: sata_sil: Continue probing other sata port when failed current port.
Peng Ma [Wed, 4 Dec 2019 10:36:42 +0000 (10:36 +0000)]
ata: sata_sil: Continue probing other sata port when failed current port.

In the initialization of sata driver, we want to initialize all port
 probes, Therefore, any detection failure between of them should continue
 initialization by skipping the current port instead of exit.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
4 years agotreewide: Remove CONFIG_SYS_UBOOT_START from configs board files
Patrice Chotard [Fri, 6 Dec 2019 14:01:49 +0000 (15:01 +0100)]
treewide: Remove CONFIG_SYS_UBOOT_START from configs board files

As previous CONFIG_SYS_UBOOT_START is now set by default to
CONFIG_SYS_TEXT_BASE when not defined, CONFIG_SYS_UBOOT_START
can be removed from include/configs board files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
4 years agoMakefile: Fix CONFIG_SYS_UBOOT_START default value
Patrice Chotard [Fri, 6 Dec 2019 14:01:48 +0000 (15:01 +0100)]
Makefile: Fix CONFIG_SYS_UBOOT_START default value

This patches restores boot on boards which rely on
CONFIG_SYS_UBOOT_START equal to CONFIG_SYS_TEXT_BASE when using SPL

Fixes: d3e97b53c1f2 ("spl: fix entry_point equal to load_addr")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd/Kconfig: Add more dependencies to OSE bootm support
Tom Rini [Thu, 5 Dec 2019 23:46:11 +0000 (18:46 -0500)]
cmd/Kconfig: Add more dependencies to OSE bootm support

Per Enea OSE documentation, it supports some classes of ARM, PowerPC and
X86.  Limit the option to those platforms.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimx: imx8mn: enable CONFIG_CMD_ERASEENV
Peng Fan [Mon, 6 Jan 2020 08:19:34 +0000 (16:19 +0800)]
imx: imx8mn: enable CONFIG_CMD_ERASEENV

enable CONFIG_CMD_ERASEENV to make it easy to erase env.
Use savedefconfig to generate new defconfig.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mn_evk: add board_mmc_get_env_dev
Peng Fan [Mon, 6 Jan 2020 08:16:32 +0000 (16:16 +0800)]
imx: imx8mn_evk: add board_mmc_get_env_dev

Add board_mmc_get_env_dev, otherwise,
Loading Environment from MMC...
MMC Device 0 not found
*** Warning - No MMC card found, using default environment

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx8mn: evk: add README
Peng Fan [Mon, 6 Jan 2020 07:38:17 +0000 (15:38 +0800)]
imx8mn: evk: add README

Add a README for users to build a workable image.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: add i.MX8MP EVK board
Peng Fan [Mon, 30 Dec 2019 09:46:21 +0000 (17:46 +0800)]
imx: add i.MX8MP EVK board

Add basic i.MX8MP EVK board support

U-Boot SPL 2020.01-rc4-00388-gb1bf40c0ae-dirty (Dec 30 2019 - 17:55:33 +0800)
power_pca9450b_init
DDRINFO: start DRAM init
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Failed to find clock node. Check device tree
WDT:   Not found!
Trying to boot from BOOTROM
image offset 0x8000, pagesize 0x200, ivt offset 0x0

U-Boot 2020.01-rc4-00388-gb1bf40c0ae-dirty (Dec 30 2019 - 17:55:33 +0800)

CPU:   Freescale i.MX8MP rev1.0 at 1000 MHz
Reset cause: POR
Model: NXP i.MX8MPlus EVK board
DRAM:  6 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
u-boot=> mmc list
FSL_SDHC: 1 (SD)
FSL_SDHC: 2

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add imximage-8mp-lpddr4.cfg
Peng Fan [Mon, 30 Dec 2019 09:40:38 +0000 (17:40 +0800)]
imx: imx8m: add imximage-8mp-lpddr4.cfg

Add imximage-8mp-lpddr4.cfg for imximage usage, almost same
as i.MX8MN ddr4 cfg, but with different ddr firmware

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx: add i.MX8MP clk driver
Peng Fan [Mon, 30 Dec 2019 09:39:18 +0000 (17:39 +0800)]
clk: imx: add i.MX8MP clk driver

Add i.MX8MP clk driver for i.MX8MP CLK driver model usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx: add imx_clk_mux2_flags
Peng Fan [Mon, 30 Dec 2019 08:56:25 +0000 (16:56 +0800)]
clk: imx: add imx_clk_mux2_flags

Add imx_clk_mux2_flags which will be used by i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: only support non-dm code in clock_imx8mm.c
Peng Fan [Mon, 30 Dec 2019 08:52:30 +0000 (16:52 +0800)]
imx: imx8m: only support non-dm code in clock_imx8mm.c

The drivers/clk/imx/*.c are used for CLK dm case, the
clock_imx8mm.c is used for non CLK dm case, let's split
it. Sometimes it is hard to enable CLK dm in SPL stage,
considering code size, malloc size requirement, the splittion
will make it easy to use non CLK dm in SPL stage.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: Kconfig: make SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP
Peng Fan [Mon, 30 Dec 2019 08:44:48 +0000 (16:44 +0800)]
imx: Kconfig: make SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP

i.MX8MP ROM support ROMAPI as i.MX8MN, so make
SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: add i.MX8MP PE property
Peng Fan [Mon, 30 Dec 2019 08:43:48 +0000 (16:43 +0800)]
imx: add i.MX8MP PE property

i.MX8MP does not have LVTTL, it has a PE property

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mp: add pin header file
Peng Fan [Mon, 30 Dec 2019 08:40:57 +0000 (16:40 +0800)]
imx: imx8mp: add pin header file

Add pin header file for i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agopower: Add new PMIC PCA9450 driver
Ye Li [Tue, 15 Oct 2019 09:15:18 +0000 (02:15 -0700)]
power: Add new PMIC PCA9450 driver

PCA9450 PMIC series is used to support iMX8MM (PCA9450A) and
iMX8MN (PCA9450B). Add the PMIC driver for both PCA9450A and PCA9450B.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoarm: dts: freescale: Add i.MX8MP dtsi support
Peng Fan [Mon, 30 Dec 2019 02:03:44 +0000 (10:03 +0800)]
arm: dts: freescale: Add i.MX8MP dtsi support

The i.MX8M Plus Media Applications Processor is part of the growing
mScale family targeting the consumer and industrial market. It brings
an effective Machine Learning and AI accelerator that enables a new
class of applications. It is built in Samsung 14LPP to achieve both
high performance and low power consumption and relies on a powerful
fully coherent core complex based on a quad core ARM Cortex-A53 cluster
and Cortex-M7 low-power coprocessor, audio digital signal processor,
machine learning and graphics accelerators.

Add the basic dtsi support for i.MX8MP.

Patch from Anson Huang for Kernel
https://patchwork.kernel.org/patch/11310915/

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoddr: imx8m: Add DRAM PLL to generate 1000Mhz output
Peng Fan [Mon, 30 Dec 2019 01:58:52 +0000 (09:58 +0800)]
ddr: imx8m: Add DRAM PLL to generate 1000Mhz output

We will generate DRAM 4000MT/s as default for i.MX8MP.
So need DRAM PLL to generate 1000Mhz clock to DDR PHY and controller.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agomxc_ocotp: support i.MX8MP
Peng Fan [Tue, 24 Dec 2019 03:26:41 +0000 (11:26 +0800)]
mxc_ocotp: support i.MX8MP

i.MX8MP use similar ocotp as i.MX8MN, but has changed fuse banks
and ctrl register bit definitions, so update to reflect that.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agopinctrl: imx8m: support i.MX8MP
Peng Fan [Mon, 30 Dec 2019 01:52:15 +0000 (09:52 +0800)]
pinctrl: imx8m: support i.MX8MP

Add i.MX8MP compatible to let the pinctrl driver could support
i.MX8MP.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add 1GHz fracpll entry
Peng Fan [Fri, 27 Dec 2019 03:40:55 +0000 (11:40 +0800)]
imx: imx8m: add 1GHz fracpll entry

4000MTS DDR needs 1GHz fracpll, so add the entry

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mp: add basic clock
Peng Fan [Fri, 27 Dec 2019 03:39:15 +0000 (11:39 +0800)]
imx: imx8mp: add basic clock

i.MX8MP has similar architecture as i.MX8MN, but it has different
clk root and index, so add that to make i.MX8MP could use
the non-dm clock driver.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoarm: dts: add i.MX8MP pinfunc header
Peng Fan [Fri, 27 Dec 2019 02:38:05 +0000 (10:38 +0800)]
arm: dts: add i.MX8MP pinfunc header

Add i.MX8MP pinfunc header for dts usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodt-bindings: clock: add i.MX8MP clock header
Peng Fan [Fri, 27 Dec 2019 02:37:39 +0000 (10:37 +0800)]
dt-bindings: clock: add i.MX8MP clock header

Add i.MX8MP clock header

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: spl: support i.MX8MP spl_boot_device
Peng Fan [Fri, 27 Dec 2019 02:27:49 +0000 (10:27 +0800)]
imx: spl: support i.MX8MP spl_boot_device

i.MX8MP follows i.MX8MN, so just let it use spl_board_boot_device

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add Kconfig entry for i.MX8MP
Peng Fan [Fri, 27 Dec 2019 02:24:54 +0000 (10:24 +0800)]
imx: imx8m: add Kconfig entry for i.MX8MP

Add Kconfig entry for i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: cpu: enlarge bit mask to 0x1FF for cpu type
Peng Fan [Mon, 30 Dec 2019 09:57:10 +0000 (17:57 +0800)]
imx: cpu: enlarge bit mask to 0x1FF for cpu type

i.MX8MP use 0x182 as dummy id, 0xFF is not able the get the highest
bit, so enlarge bit mask to 0x1FF to make it could detect
cpu type correctly

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx8mp: set BYPASS ID SWAP to avoid AXI bus errors
Peng Fan [Fri, 27 Dec 2019 02:19:42 +0000 (10:19 +0800)]
imx8mp: set BYPASS ID SWAP to avoid AXI bus errors

Set the BYPASS ID SWAP bit (GPR10 bit 1) in order for GPU not to
generated AXI bus errors with TZC380 enabled.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: get cpu id/type of i.MX8MP
Peng Fan [Fri, 27 Dec 2019 02:14:02 +0000 (10:14 +0800)]
imx: get cpu id/type of i.MX8MP

Support get i.MX8MP cpu id and cpu type

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mq: handle ESDHC in mxc_get_clock
Peng Fan [Wed, 11 Dec 2019 06:17:12 +0000 (06:17 +0000)]
imx: imx8mq: handle ESDHC in mxc_get_clock

fsl_esdhc_imx driver will call "mxc_get_clock(MXC_ESDHC_CLK +
dev->seq)", however mxc_get_clock wrongly handle MXC_ESDHC_CLK
as root clk and cause sd card could not be detected in U-Boot proper,
as below:
"Loading Environment from MMC... unable to select a mode"

Handle MXC_ESDHC_CLK in mxc_get_clock to fix the issue.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Baruch Siach <baruch@tkos.co.il>
Tested-by: Fabio Estevam <festevam@gmail.com>
4 years agowandboard: Remove repeated PMIC string
Fabio Estevam [Tue, 10 Dec 2019 09:33:00 +0000 (06:33 -0300)]
wandboard: Remove repeated PMIC string

After the conversion to DM_PMIC the following output is seen:

PMIC:  PMIC:  PFUZE100 ID=0x10

Remove the unnecessary PMIC string from the board file to
avoid the repetead string.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agowandboard: Fix the DM_PMIC conversion
Fabio Estevam [Tue, 10 Dec 2019 09:32:59 +0000 (06:32 -0300)]
wandboard: Fix the DM_PMIC conversion

Commit ec837c82d709 ("imx6: wandboard: convert to DM_PMIC")
caused the following pmic_get() error:

CPU:   Freescale i.MX6QP rev1.0 at 792 MHz
Reset cause: POR
DRAM:  2 GiB
PMIC:  pmic_get() ret -19
...

and since the PMIC presence is used to determine the board D1 revision,
the following error is seen when booting a board rev D1:

WARNING: Could not determine dtb to use

and the kernel does not boot at all.

Fix the regression by passing "pfuze100@8" as the correct parameter
to the pmic_get() function in the DM case.

Fixes: ec837c82d709 ("imx6: wandboard: convert to DM_PMIC")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoefi_selftest: unit test for EFI_RNG_PROTOCOL
Heinrich Schuchardt [Sat, 28 Dec 2019 14:40:40 +0000 (15:40 +0100)]
efi_selftest: unit test for EFI_RNG_PROTOCOL

Provide a unit test for the EFI_RNG_PROTOCOL.

The list of algorithms is read. Two random numbers are generated. The test
checks that the two numbers differ.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_rng_protocol: Install the efi_rng_protocol on the root node
Sughosh Ganu [Sat, 28 Dec 2019 18:31:06 +0000 (00:01 +0530)]
efi_rng_protocol: Install the efi_rng_protocol on the root node

Install the EFI_RNG_PROTOCOL implementation for it's subsequent use by
the kernel for features like kaslr.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi: qemu: arm64: Add efi_rng_protocol implementation for the platform
Sughosh Ganu [Sat, 28 Dec 2019 18:31:05 +0000 (00:01 +0530)]
efi: qemu: arm64: Add efi_rng_protocol implementation for the platform

Add support for the EFI_RNG_PROTOCOL routines for the qemu arm64
platform. EFI_RNG_PROTOCOL is an uefi boottime service which is
invoked by the efi stub in the kernel for getting random seed for
kaslr.

The routines are platform specific, and use the virtio-rng device on
the platform to get random data.

The feature can be enabled through the following config
CONFIG_EFI_RNG_PROTOCOL

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Changed SPDX header to use /* instead of //.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: add rng command
Heinrich Schuchardt [Tue, 24 Dec 2019 21:17:37 +0000 (22:17 +0100)]
cmd: add rng command

For the RNG uclass we currently only have a test working on the sandbox.

Provide a command to test the hardware random number generator on
non-sandbox systems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agovirtio: rng: Add a random number generator(rng) driver
Sughosh Ganu [Sun, 29 Dec 2019 10:00:14 +0000 (15:30 +0530)]
virtio: rng: Add a random number generator(rng) driver

Add a driver for the virtio-rng device on the qemu platform. The
device uses pci as a transport medium. The driver can be enabled with
the following configs

CONFIG_VIRTIO
CONFIG_DM_RNG
CONFIG_VIRTIO_PCI
CONFIG_VIRTIO_RNG

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
4 years agotest: rng: Add basic test for random number generator(rng) uclass
Sughosh Ganu [Sat, 28 Dec 2019 18:28:33 +0000 (23:58 +0530)]
test: rng: Add basic test for random number generator(rng) uclass

Add a unit test for testing the rng uclass functionality using the
sandbox rng driver.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: sandbox: Enable random number generator(rng) device
Sughosh Ganu [Sat, 28 Dec 2019 18:28:32 +0000 (23:58 +0530)]
configs: sandbox: Enable random number generator(rng) device

Enable support for random number generator on sandbox configs. This is
aimed primarily at adding unit test support for rng uclass.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: rng: Add a random number generator(rng) driver
Sughosh Ganu [Sat, 28 Dec 2019 18:28:31 +0000 (23:58 +0530)]
sandbox: rng: Add a random number generator(rng) driver

Add a sandbox driver for random number generation. Mostly aimed at
providing a unit test for rng uclass.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: stm32mp15: Enable random number generator(rng) device
Sughosh Ganu [Sat, 28 Dec 2019 18:28:30 +0000 (23:58 +0530)]
configs: stm32mp15: Enable random number generator(rng) device

Enable support for the rng device on the stm32mp15 configs.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agostm32mp1: rng: Add a driver for random number generator(rng) device
Sughosh Ganu [Sat, 28 Dec 2019 18:28:29 +0000 (23:58 +0530)]
stm32mp1: rng: Add a driver for random number generator(rng) device

Add a driver for the rng device found on stm32mp1 platforms. The
driver provides a routine for reading the random number seed from the
hardware device.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
Remove a superfluous blank line
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoclk: stm32mp1: Add a clock entry for RNG1 device
Sughosh Ganu [Sat, 28 Dec 2019 18:28:28 +0000 (23:58 +0530)]
clk: stm32mp1: Add a clock entry for RNG1 device

Add an entry for allowing clock enablement for the random number
generator peripheral, RNG1.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodm: rng: Add random number generator(rng) uclass
Sughosh Ganu [Sat, 28 Dec 2019 18:28:27 +0000 (23:58 +0530)]
dm: rng: Add random number generator(rng) uclass

Add a uclass for reading a random number seed from a random number
generator device.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest/py: Create a test for launching UEFI binaries from FIT images
Cristian Ciocaltea [Mon, 30 Dec 2019 01:34:27 +0000 (03:34 +0200)]
test/py: Create a test for launching UEFI binaries from FIT images

This test verifies the implementation of the 'bootm' extension that
handles UEFI binaries inside FIT images (enabled via CONFIG_BOOTM_EFI).

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodoc: uefi.rst: Document launching UEFI binaries from FIT images
Cristian Ciocaltea [Tue, 24 Dec 2019 16:05:41 +0000 (18:05 +0200)]
doc: uefi.rst: Document launching UEFI binaries from FIT images

This patch adds a new section "Launching a UEFI binary from a FIT image"
documenting the usage of the CONFIG_BOOTM_EFI extension to bootm command
that offers a verified boot alternative for UEFI binaries such as GRUB2.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodoc: Add sample uefi.its image description file
Cristian Ciocaltea [Tue, 24 Dec 2019 16:05:40 +0000 (18:05 +0200)]
doc: Add sample uefi.its image description file

This patch adds an example FIT image description file demonstrating
the usage of bootm command to securely launch UEFI binaries.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agobootm: Add a bootm command for type IH_OS_EFI
Cristian Ciocaltea [Tue, 24 Dec 2019 16:05:39 +0000 (18:05 +0200)]
bootm: Add a bootm command for type IH_OS_EFI

Add support for booting EFI binaries contained in FIT images.
A typical usage scenario is chain-loading GRUB2 in a verified
boot environment.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoimage: Add IH_OS_EFI for EFI chain-load boot
Cristian Ciocaltea [Tue, 24 Dec 2019 16:05:38 +0000 (18:05 +0200)]
image: Add IH_OS_EFI for EFI chain-load boot

Add a new OS type to be used for chain-loading an EFI compatible
firmware or boot loader like GRUB2, possibly in a verified boot
scenario.

Bellow is sample ITS file that generates a FIT image supporting
secure boot. Please note the presence of 'os = "efi";' line, which
identifies the currently introduced OS type:

/ {
    #address-cells = <1>;

    images {
        efi-grub {
            description = "GRUB EFI";
            data = /incbin/("bootarm.efi");
            type = "kernel_noload";
            arch = "arm";
            os = "efi";
            compression = "none";
            load = <0x0>;
            entry = <0x0>;
            hash-1 {
                algo = "sha256";
            };
        };
    };

    configurations {
        default = "config-grub";
        config-grub {
            kernel = "efi-grub";
            signature-1 {
                algo = "sha256,rsa2048";
                sign-images = "kernel";
            };
        };
    };
};

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: efidebug: capitalize UEFI
Heinrich Schuchardt [Tue, 7 Jan 2020 06:48:15 +0000 (07:48 +0100)]
cmd: efidebug: capitalize UEFI

%s/uefi/UEFI/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: efidebug: new sub-command tables
Heinrich Schuchardt [Tue, 7 Jan 2020 04:57:47 +0000 (05:57 +0100)]
cmd: efidebug: new sub-command tables

Provide sub-command for efidebug to list configuration tables.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: efidebug: simplify get_guid_text()
Heinrich Schuchardt [Tue, 7 Jan 2020 05:02:33 +0000 (06:02 +0100)]
cmd: efidebug: simplify get_guid_text()

When we hit a matching GUID we can directly return the text. There is no
need for a check after the loop.

efi_guid_t is defined as 8 byte aligned but GUIDs in packed structures do
not follow this alignment. Do not require the argument of get_guid_text()
to be correctly aligned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: define all known warning status codes
Heinrich Schuchardt [Fri, 3 Jan 2020 21:47:19 +0000 (22:47 +0100)]
efi_loader: define all known warning status codes

Of all warning status codes up to now only EFI_WARN_DELETE_FAILURE is
defined.

The patch adds the missing definitions for later usage.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: free load options after execution
Heinrich Schuchardt [Fri, 3 Jan 2020 21:53:42 +0000 (22:53 +0100)]
efi_loader: free load options after execution

When be launch a binary via bootefi the bootargs environment variable is
used to set the load options in the loaded image protocol.

Free memory allocated for load options when the UEFI binary exits.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: Add guidcpy function
Sughosh Ganu [Sat, 28 Dec 2019 18:31:04 +0000 (00:01 +0530)]
efi_loader: Add guidcpy function

Add guidcpy function to copy the source guid to the destination
guid. Use this function instead of memcpy for copying to the
destination guid.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Use void * instead of efi_guid_t * for arguments to allow copying unaligned
GUIDs. The GUIDs of configuration tables are __packed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: __cyg_profile_func_enter/_exit
Heinrich Schuchardt [Wed, 1 Jan 2020 12:19:12 +0000 (13:19 +0100)]
efi_loader: __cyg_profile_func_enter/_exit

U-Boot can be compiled with function tracing enabled.

When compiling with FTRACE __cyg_profile_func_enter() is called when a
function is entered and __cyg_profile_func_exit() when the function is
left.

To avoid a crash we have to define these function for the free-standing
UEFI binaries.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agopart: efi: comment for GPT_HEADER_SIGNATURE_UBOOT
Heinrich Schuchardt [Tue, 24 Dec 2019 07:11:01 +0000 (08:11 +0100)]
part: efi: comment for GPT_HEADER_SIGNATURE_UBOOT

Add a comment indicating that the value of GPT_HEADER_SIGNATURE_UBOOT
equals the ASCII string 'EFI PART'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: clear screen should move cursor to home
Heinrich Schuchardt [Sun, 22 Dec 2019 07:15:55 +0000 (07:15 +0000)]
efi_loader: clear screen should move cursor to home

On a VT100 terminal <ESC>[2J should be enough to both clear the whole
screen and set the cursor to position (1, 1). But the Linux console does
not behave like this. So send an extra <ESC>[H. For reference see the
console_codes(4) man page.

Add a function description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest/py: describe env__efi_loader_helloworld_file
Heinrich Schuchardt [Thu, 19 Dec 2019 12:39:30 +0000 (13:39 +0100)]
test/py: describe env__efi_loader_helloworld_file

Describe the components of environment variable
env__efi_loader_helloworld_file.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: git ignore helloworld_efi.S
Heinrich Schuchardt [Mon, 16 Dec 2019 11:05:58 +0000 (12:05 +0100)]
efi_loader: git ignore helloworld_efi.S

Add *.S to .gitignore.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: Update .gitignore
Sughosh Ganu [Mon, 16 Dec 2019 06:31:32 +0000 (12:01 +0530)]
efi_selftest: Update .gitignore

Add the following file to .gitignore
 efi_miniapp_file_image_exception.h

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Use efi_miniapp_*.h instead of file enumeration.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: export efi_install_fdt()
Heinrich Schuchardt [Sun, 8 Dec 2019 00:07:01 +0000 (01:07 +0100)]
efi_loader: export efi_install_fdt()

Use a pointer to addressable memory instead of a "physical" address in the
virtual address space of the sandbox to efi_install_fdt().

Export the efi_install_fdt() function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: carve out efi_run_image()
Heinrich Schuchardt [Sat, 7 Dec 2019 19:51:06 +0000 (20:51 +0100)]
efi_loader: carve out efi_run_image()

Provide public function efi_run_imager() which can be used to run an UEFI
image from memory.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: use hardware device tree by default
Heinrich Schuchardt [Wed, 4 Dec 2019 11:31:12 +0000 (12:31 +0100)]
efi_loader: use hardware device tree by default

If the bootefi command is called without passing the address of a device
tree, the internal device tree is used. For devices with a hardware device
tree it is preferable to used the hardware device tree in this case.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: pass address to efi_install_fdt()
Heinrich Schuchardt [Thu, 28 Nov 2019 05:46:09 +0000 (06:46 +0100)]
efi_loader: pass address to efi_install_fdt()

As part of moving the parsing of command line arguments to do_bootefi()
call efi_install_fdt() with the address of the device tree instead of a
string.

If the address is EFI_FDT_USE_INTERNAL (= 0), the internal device tree
is used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: adjust file system info
Heinrich Schuchardt [Sun, 8 Dec 2019 09:02:37 +0000 (10:02 +0100)]
efi_loader: adjust file system info

When the GetInfo() method of the EFI_FILE_PROTOCOL is called to retrieve
the file system info we claim that the volume is read only and has no free
space. This leads to failures in programs that check this information
before writing to the volume like SCT's InstallSct.efi.

Currently there is no function to determine these parameters in U-Boot. So
let's return optimistic values:

Return that the volume is writable.

Return the volume size as free space.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: imply USB_KEYBOARD_FN_KEYS
Heinrich Schuchardt [Wed, 4 Dec 2019 21:58:58 +0000 (22:58 +0100)]
efi_loader: imply USB_KEYBOARD_FN_KEYS

UEFI applications like GRUB and SCT assume that function keys are enabled
on the keyboard.

Let EFI_LOADER imply USB_KEYBOARD_FN_KEYS.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoinclude: pe.h: add signature-related definitions
AKASHI Takahiro [Tue, 26 Nov 2019 00:51:05 +0000 (09:51 +0900)]
include: pe.h: add signature-related definitions

The index (IMAGE_DIRECTORY_ENTRY_SECURITY) in a table points to
a region containing authentication information (image's signature)
in PE format.

WIN_CERTIFICATE structure defines an embedded signature format.

Those definitions will be used in my UEFI secure boot patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoconfigs: qemu: enable FIT images on qemu_arm(64)_defconfig
Heinrich Schuchardt [Sun, 29 Dec 2019 11:06:29 +0000 (12:06 +0100)]
configs: qemu: enable FIT images on qemu_arm(64)_defconfig

For testing UEFI FIT images we need FIT image support on QEMU.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest/py: Fix broken 'notbuildconfigspec' marker
Cristian Ciocaltea [Tue, 24 Dec 2019 15:19:12 +0000 (17:19 +0200)]
test/py: Fix broken 'notbuildconfigspec' marker

Consider the following test sample:

@pytest.mark.buildconfigspec('fit')
@pytest.mark.notbuildconfigspec('generate_acpi_table')
def test_sample(u_boot_console):

Whatever the argument of the 'notbuildconfigspec' is,
the test ends up being skipped with the message:

('/uboot/test/py/conftest.py', 463,
 'Skipped: .config feature "fit" enabled')

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agobdinfo: show multi_dtb_fit
Heiko Schocher [Sat, 9 Nov 2019 03:56:10 +0000 (04:56 +0100)]
bdinfo: show multi_dtb_fit

if MULTI_DTB_FIT is enabled it is helpful to display
the value of gd->multi_dtb_fit in bdinfo.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd_ut: add a parameter prefix to the function cmd_ut_category
Philippe Reynes [Tue, 17 Dec 2019 18:07:04 +0000 (19:07 +0100)]
cmd_ut: add a parameter prefix to the function cmd_ut_category

There is black magic in the file conftest.py that list
all the test unit. Then, all those test unit are called
in pytest. This call is done with the end of the name
(for example checksum if the full name is bloblist_test_checksum).

The result is that only test for dm are really executed.
by pytest, all others tests are listed but never executed.

This behaviour happens because the dm test unit only check
the end of the name and others tests checks the full name.

To fix this issue, I've added a prefix to the function
cmd_ut_category, and this prefix is removed when looking
for the unit test.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agopower: regulator: support off-on-delay-us
Peng Fan [Mon, 4 Nov 2019 09:27:23 +0000 (09:27 +0000)]
power: regulator: support off-on-delay-us

off-on-delay-us has been supported by Linux, so let's use it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoremoteproc: stm32: load resource table from firmware
Fabien Dessenne [Wed, 30 Oct 2019 13:38:33 +0000 (14:38 +0100)]
remoteproc: stm32: load resource table from firmware

Load the optional resource table from the firmware, and write its
address in the dedicated backup register.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agostm32mp1: remove copro_state environment variable
Fabien Dessenne [Wed, 30 Oct 2019 13:38:32 +0000 (14:38 +0100)]
stm32mp1: remove copro_state environment variable

Since the coprocessor state is tracked in a backup register, there is
no more need for tracking it in an environment variable : remove it.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoremoteproc: stm32: track the coprocessor state in a backup register
Fabien Dessenne [Wed, 30 Oct 2019 13:38:31 +0000 (14:38 +0100)]
remoteproc: stm32: track the coprocessor state in a backup register

Update the dedicated backup register to track the coprocessor state and
rely on that register to compute the .is_running() value (which expects
a return value of 0 -not 1- if the processor is running).

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agostm32mp1: reset coprocessor status at cold boot
Fabien Dessenne [Wed, 30 Oct 2019 13:38:30 +0000 (14:38 +0100)]
stm32mp1: reset coprocessor status at cold boot

Reset ResourceTableAddress and CoprocessorState at cold boot, preserve
these values at standby wakeup.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agostm32mp1: declare backup registers for coprocessor
Fabien Dessenne [Wed, 30 Oct 2019 13:38:29 +0000 (14:38 +0100)]
stm32mp1: declare backup registers for coprocessor

Use the backup register #17 as coprocessor resource table address and
backup register #18 as coprocessor state.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoremoteproc: elf_loader: Add elf resource table load support
Fabien Dessenne [Wed, 30 Oct 2019 13:38:28 +0000 (14:38 +0100)]
remoteproc: elf_loader: Add elf resource table load support

Add rproc_elf_load_rsc_table(), which searches for a resource table in
an elf64/elf32 image, and if found, copies it to device memory.
Add also the elf32 and elf64 variants of this API.
Add a test for this.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agospl: fit: Allow the board to tell if more images must be loaded from FIT
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:22 +0000 (16:39 +0200)]
spl: fit: Allow the board to tell if more images must be loaded from FIT

spl_fit_get_image_name() is used to get the names of the images that the
SPL must load from the FIT. It relies on the content of a property present
in the FIT. The list of images is thus statically defined in the FIT.
With this scheme, it quickly becomes hard to manage combinations of more
than a handful of images.
To address this problem, give the board driver code the opportunity to
add to the list of images. The images from the FIT property are loaded
first, and then the board_get_fit_loadable() is called to get more image
names.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodts: Add support for adding DT overlays in u-boot.img
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:21 +0000 (16:39 +0200)]
dts: Add support for adding DT overlays in u-boot.img

If u-boot.img is a FIT image, CONFIG_OF_OVERLAY_LIST can be used to add
DT overlays to u-boot.img.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoinclude: board: provide empty stubs when the BOARD option is not selected
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:20 +0000 (16:39 +0200)]
include: board: provide empty stubs when the BOARD option is not selected

Useful to avoid #ifdef throughout the code that uses the board driver API.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodrivers: board: Add get_fit_loadable()
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:19 +0000 (16:39 +0200)]
drivers: board: Add get_fit_loadable()

This function will be used by the SPL to get the names of images to load
from the FIT. This allows to load different images based on runtime HW
detection.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodrivers: board: Make the board drivers available in SPL
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:18 +0000 (16:39 +0200)]
drivers: board: Make the board drivers available in SPL

Make the board driver available in the SPL too. The board driver is a way
to provide useful information about the board and that can be useful in
the SPL too.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: constify the output parameter of spl_fit_get_image_name()
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:17 +0000 (16:39 +0200)]
spl: fit: constify the output parameter of spl_fit_get_image_name()

There is no need for it to be non-constant. Making it constant, allows to
return constant string without warning.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:16 +0000 (16:39 +0200)]
Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled

In order to apply an overlay to a DTB. The DTB must have been generated
with the option '-@'.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: be more verbose when an error occurs when applying the overlays
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:15 +0000 (16:39 +0200)]
spl: fit: be more verbose when an error occurs when applying the overlays

There are many ways the overlay application can fail.
2 of them are probably the most common:
- the application itself failed. Usually this is comes from an unresolved
  reference
- DTBO not available in FIT (could be because of a typo)

In both case it is good to be more explicit about the error and at least
show which overlay is failing.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: Do not fail immediately if an overlay is not available
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:14 +0000 (16:39 +0200)]
spl: fit: Do not fail immediately if an overlay is not available

If one overlay that must be applied cannot be found in the FIT, the current
implementation stops applying the overlays. Let's make it skip only the
failing overlay instead.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: allocate a temporary buffer to load the overlays
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:13 +0000 (16:39 +0200)]
spl: fit: allocate a temporary buffer to load the overlays

If the node describing an overlay does not specify a load address, it will
be loaded at the address previously used.
Fixing it by allocating a temporary buffer that will be used as a
default load address. By default, the size of the buffer is 64kB which
should be plenty for most use cases.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: Make room in the FDT before applying overlays
Jean-Jacques Hiblot [Tue, 22 Oct 2019 14:39:12 +0000 (16:39 +0200)]
spl: fit: Make room in the FDT before applying overlays

Make room in the FDT before applying the overlay, otherwise it may fail if
the overlay is big. As the exact added size is not known in advance, just
add the size of the overlay.
Move after the end of the application of the overlays, the resize  of the
FDT for the injection of the details on the loadables.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agospl: fit: Add support for applying DT overlay
Michal Simek [Tue, 22 Oct 2019 14:39:11 +0000 (16:39 +0200)]
spl: fit: Add support for applying DT overlay

doc/uImage.FIT/overlay-fdt-boot.txt is describing how to create FIT
image with DT overlays in it.
Add support for this feature to SPL.

Here is the ZynqMP fragment where dtb points to full DT and dtbo is
overlay which should be applied on the top of dtb.
config {
        description = "ATF with full u-boot overlay";
        firmware = "atf";
        loadables = "uboot";
        fdt = "dtb", "dtbo";
};

The whole feature depends on OF_LIBFDT_OVERLAY which is adding +4kB code
and 0 for platforms which are not enabling this feature.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>