platform/kernel/u-boot.git
3 years agoverdin-imx8mm: enable sleep_moci output
Max Krummenacher [Sat, 9 Oct 2021 20:41:08 +0000 (22:41 +0200)]
verdin-imx8mm: enable sleep_moci output

This powers some peripherals on the carrier board e.g. the USB hub.

Related-to: ELB-3206
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoverdin-imx8mm: switch to use binman to pack images
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:07 +0000 (22:41 +0200)]
verdin-imx8mm: switch to use binman to pack images

Use binman to pack images.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoarm64: dts: imx8mm-verdin-u-boot.dtsi: alphabetically re-order
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:06 +0000 (22:41 +0200)]
arm64: dts: imx8mm-verdin-u-boot.dtsi: alphabetically re-order

Alphabetically re-order nodes and properties.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
3 years agoARM: dts: imx8mm-verdin: prepare for dek blob encapsulation
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:05 +0000 (22:41 +0200)]
ARM: dts: imx8mm-verdin: prepare for dek blob encapsulation

Prepare for DEK blob encapsulation support through "dek_blob" command.
On ARMv8, u-boot runs in non-secure, thus cannot encapsulate a DEK blob
for encrypted boot.
The DEK blob is encapsulated by OP-TEE through a trusted application
call. U-boot sends and receives the DEK and the DEK blob binaries
through OP-TEE dynamic shared memory.

To enable the DEK blob encapsulation, add to the defconfig:
CONFIG_SECURE_BOOT=y
CONFIG_FAT_WRITE=y
CONFIG_CMD_DEKBLOB=y

Taken from NXP's commit 56d2050f4028 ("imx8m: Add DEK blob encapsulation
for imx8m").

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoverdin-imx8mm: fix ethernet
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:04 +0000 (22:41 +0200)]
verdin-imx8mm: fix ethernet

Turns out Microship (formerly Micrel) meanwhile integrated proper
support for the DLL setup on their KSZ9131. Unfortunately, this
conflicts with our previous board code doing that.
Fix this by getting rid of our board code and just relying on the
generic implementation relying on rgmii-id being used as phy-mode.

Fixes: commit c6df0e2ffdc4
       ("net: phy: micrel: add support for DLL setup on ksz9131")
Fixes: commit af2d3c91d877
       ("ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx8m: clean-up kconfig indentation
Marcel Ziswiler [Sat, 9 Oct 2021 20:41:03 +0000 (22:41 +0200)]
imx8m: clean-up kconfig indentation

Replace spurious spaces with proper tabs.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx8mm-cl-iot-gate-optee: align config with Kconfig
Stefano Babic [Wed, 20 Oct 2021 10:13:44 +0000 (12:13 +0200)]
imx8mm-cl-iot-gate-optee: align config with Kconfig

Due to missing configs, CI goes in deadlock until an OOM is tracked. Add
CONFIG_SYS_LOAD_ADDR and replace CONFIG_SYS_EXTRA_OPTIONS with
CONFIG_IMX_CONFIG.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>
CC: Fabio Estevam <festevam@denx.de>
3 years agokontron-sl-mx8mm: fix missing configs and deadlock in CI
Stefano Babic [Wed, 20 Oct 2021 09:55:25 +0000 (11:55 +0200)]
kontron-sl-mx8mm: fix missing configs and deadlock in CI

Even if board can be successfuly built, CI goes in deadlock (see thread
on https://www.mail-archive.com/u-boot@lists.denx.de/msg419663.html).
This is caused by SYS_CONFIG set in header file and because defconfig
for the board is out of sync with Kconfig. As result, buildman goes on
to read from stdin until an OOM is reached.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Frieder Schrempf <frieder.schrempf@kontron.de>
3 years agobuildman: Detect Kconfig loops
Simon Glass [Wed, 20 Oct 2021 03:43:24 +0000 (21:43 -0600)]
buildman: Detect Kconfig loops

Hex and int Kconfig options are supposed to have defaults. This is so we
can configure U-Boot without having to enter particular values for the
items that don't have specific values in the board's defconfig file.

If this rule is not followed, then introducing a new Kconfig can produce
a loop like this:

   Break things (BREAK_ME) [] (NEW)
   Error in reading or end of file.

   Break things (BREAK_ME) [] (NEW)
   Error in reading or end of file.

The continues forever since buildman passes /dev/null to 'conf', and
the build system just tries again. Eventually there is so much output that
buildman runs out of memory.

We can detect this situation by looking for a symbol (like 'BREAK_ME')
which has no default (the '[]' above) and is marked as new. If this
appears multiple times in the output, we know something is wrong.

Add a filter function for the output which detects this situation. Allow
it to return True to terminate the process. Implement this termination in
cros_subprocess.

With this we get a nice message:

   buildman --board sandbox -T0
   Building current source for 1 boards (0 threads, 32 jobs per thread)
      sandbox:  w+   sandbox
   +.config:66:warning: symbol value '' invalid for BREAK_ME
   +
   +Error in reading or end of file.
   +make[3]: *** [scripts/kconfig/Makefile:75: syncconfig] Terminated
   +make[2]: *** [Makefile:569: syncconfig] Terminated
   +make: *** [Makefile:177: sub-make] Terminated
   +(** did you define an int/hex Kconfig with no default? **)

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobuildman: Write output even on fatal error
Simon Glass [Wed, 20 Oct 2021 03:43:23 +0000 (21:43 -0600)]
buildman: Write output even on fatal error

At present buildman does not write any output (to the 'out' and 'err)
files if the build terminates with a fatal error. This is to avoid adding
lots of spam to the logs.

However there are times when this is actually useful, such as when the
build fails for an obscure reason such as a Kconfig loop.

Update the logic to always write the output, so that the user gets a clue
as to what is happening.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoARM: imx: mx5: Add altbootcmd and resets to M53Menlo
Marek Vasut [Sat, 11 Sep 2021 22:40:00 +0000 (00:40 +0200)]
ARM: imx: mx5: Add altbootcmd and resets to M53Menlo

Bulletproof the default boot command with reset statements in case
any command in the chain would fail. In case a failure were to happen,
the board will reset, increment boot counter and retry the procedure.
In case the failures persist and the boot counter reaches the bootlimit,
U-Boot starts altbootcmd instead of the default bootcmd boot command.

The altbootcmd swaps the default boot partition for the other boot
partition, which is an identical copy or an older copy, and tries
booting from that one instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoARM: imx: mx5: Enable Thumb2 build on MX53 Menlo board
Marek Vasut [Sat, 11 Sep 2021 22:39:59 +0000 (00:39 +0200)]
ARM: imx: mx5: Enable Thumb2 build on MX53 Menlo board

Build U-Boot in Thumb2 mode for M53Menlo board, this makes better
use of the CPU since the instruction density is higher.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoARM: imx: mx5: Enable BMODE command on MX53 Menlo board
Marek Vasut [Sat, 11 Sep 2021 22:39:58 +0000 (00:39 +0200)]
ARM: imx: mx5: Enable BMODE command on MX53 Menlo board

The board can do primary/secondary boot switching, enable the bmode command.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
3 years agoboard: ea: mx7ulp_com: move setting CONFIG_BOOTCOMMAND to defconfig
Ricardo Salveti [Thu, 26 Aug 2021 11:04:24 +0000 (14:04 +0300)]
board: ea: mx7ulp_com: move setting CONFIG_BOOTCOMMAND to defconfig

Move setting CONFIG_BOOTCOMMAND to the mx7ulp_com_defconfig file.
It also allows replacing the default CONFIG_BOOTCOMMAND without
code modification.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agosmegw01: Select IMX_HAB
Fabio Estevam [Tue, 24 Aug 2021 10:58:48 +0000 (07:58 -0300)]
smegw01: Select IMX_HAB

Select IMX_HAB to allow secure boot.

Signed-off-by: Fabio Estevam <festevam@denx.de>
3 years agosmegw01: Add redundant environment support
Fabio Estevam [Tue, 24 Aug 2021 10:58:47 +0000 (07:58 -0300)]
smegw01: Add redundant environment support

Add redundant environment support as it is required
by SWUpdate.

While at it, place the CONFIG_ENV_OFFSET at 0x100000 to allow
more headroom.

Signed-off-by: Fabio Estevam <festevam@denx.de>
3 years agoapalis-imx6: use dynamic DDR calibration
Francesco Dolcini [Tue, 31 Aug 2021 09:46:06 +0000 (11:46 +0200)]
apalis-imx6: use dynamic DDR calibration

Enable dynamic DDR calibration to have a reliable behavior on edge
temperatures conditions.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
3 years agocolibri-imx6: use dynamic DDR calibration
Francesco Dolcini [Tue, 31 Aug 2021 09:46:05 +0000 (11:46 +0200)]
colibri-imx6: use dynamic DDR calibration

Enable dynamic DDR calibration to have a reliable behavior on edge
temperatures conditions.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
3 years agommc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP
Oleksandr Suvorov [Wed, 8 Sep 2021 18:56:43 +0000 (21:56 +0300)]
mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP

Import HS400 support for iMX7ULP B0 from the Linux kernel:

2eaf5a533afd ("mmc: sdhci-esdhc-imx: Add HS400 support for iMX7ULP")

According to IC suggest, need to clear the STROBE_DLL_CTRL_RESET
before any setting of STROBE_DLL_CTRL register.

USDHC has register bits(bit[27~20] of register STROBE_DLL_CTRL)
for slave sel value. If this register bits value is 0,  it needs
256 ref_clk cycles to update slave sel value. IC suggest to set
bit[27~20] to 0x4, it only need 4 ref_clk cycle to update slave
sel value. This will short the lock time of slave.

i.MX7ULP B0 will need more time to lock the REF and SLV, so change
to add 5us delay.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
3 years agommc: fsl_esdhc_imx: initialize data for imx7ulp
Jorge Ramirez-Ortiz [Wed, 8 Sep 2021 18:56:42 +0000 (21:56 +0300)]
mmc: fsl_esdhc_imx: initialize data for imx7ulp

Import data for eSDHC driver for SoC iMX7ULP from the Linux kernel.
Set supported by u-boot flags only.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
3 years agoarm64: dts: imx8mm-venice-gw7902: use imx8mm-venice-u-boot.dtsi
Tim Harvey [Tue, 24 Aug 2021 19:04:01 +0000 (12:04 -0700)]
arm64: dts: imx8mm-venice-gw7902: use imx8mm-venice-u-boot.dtsi

Use the common imx8mm-venice-u-boot.dtsi (dtb for the
'DEFAULT_DEVICE_TREE) so that it inherits things like binman.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoarm64: dts: imx8mm-venice-gw7901: use imx8mm-venice-u-boot.dtsi
Tim Harvey [Tue, 24 Aug 2021 19:04:00 +0000 (12:04 -0700)]
arm64: dts: imx8mm-venice-gw7901: use imx8mm-venice-u-boot.dtsi

Use the common imx8mm-venice-u-boot.dtsi (dtb for the
'DEFAULT_DEVICE_TREE) so that it inherits things like binman.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoarm64: dts: imx8mm-venice-gw700x: use imx8mm-venice-u-boot.dtsi
Tim Harvey [Tue, 24 Aug 2021 19:03:59 +0000 (12:03 -0700)]
arm64: dts: imx8mm-venice-gw700x: use imx8mm-venice-u-boot.dtsi

Use the common imx8mm-venice-u-boot.dtsi (dtb for the
'DEFAULT_DEVICE_TREE) so that it inherits things like binman.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agosmegw01: Pass 'mmcpart' to the kernel command line
Fabio Estevam [Tue, 24 Aug 2021 10:58:46 +0000 (07:58 -0300)]
smegw01: Pass 'mmcpart' to the kernel command line

When using SWUpdate, it is necessary to toggle between partitions.

Use the 'mmcpart' environment variable to accomplish that.

Signed-off-by: Fabio Estevam <festevam@denx.de>
3 years agoimx: makefile: drop the use of imx8mimage.sh
Peng Fan [Mon, 16 Aug 2021 03:48:45 +0000 (11:48 +0800)]
imx: makefile: drop the use of imx8mimage.sh

After switch to use binman, no need to use the bash script
to check file exsiting or not. And there is bug that
the script will be executed everytime Makefile is used which is
confusing people.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Frieder Schrempf <frieder.schrempf@kontron.de>
3 years agotools: imx8mimage: not abort when mmap fail
Peng Fan [Mon, 16 Aug 2021 03:48:41 +0000 (11:48 +0800)]
tools: imx8mimage: not abort when mmap fail

When creating flash.bin, the hdmi firmware might not be
copied to U-Boot source tree. Then mkimage will fail.
However we are switching to binman, binman will show the
message if the file not there, and create empty file per
i.MX8MQ binman node. So we not fail mkimage here othersize
CI will fail if hdmi firmware not copied here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agoimx: imx8mm: Add support for Kontron Electronics SL/BL i.MX8M-Mini boards (N801x)
Frieder Schrempf [Wed, 29 Sep 2021 14:42:42 +0000 (16:42 +0200)]
imx: imx8mm: Add support for Kontron Electronics SL/BL i.MX8M-Mini boards (N801x)

The Kontron SoM-Line i.MX8MM (N801x) by Kontron Electronics GmbH is a SoM
module with an i.MX8M-Mini SoC, 1/2/4 GB LPDDR4 RAM, SPI NOR, eMMC and PMIC.

The matching evaluation boards (Board-Line) have 2 Ethernets, USB 2.0, HDMI/LVDS,
SD card, CAN, RS485 and much more.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Tested-by: Heiko Thiery <heiko.thiery@gmail.com>
3 years agoimx53: usbarmory: Use ethernet driver model
Andrej Rosano [Tue, 17 Aug 2021 09:34:03 +0000 (11:34 +0200)]
imx53: usbarmory: Use ethernet driver model

Enable ethernet driver model as it is mandatory.

Signed-off-by: Andrej Rosano <andrej.rosano@f-secure.com>
3 years agoimx: ventana: fix USB hub reset
Tim Harvey [Wed, 29 Sep 2021 22:04:22 +0000 (15:04 -0700)]
imx: ventana: fix USB hub reset

Remove board_ehci_hcd_init function that is not used with DM_USB
and replace its functionality with device-tree configuraton that treats
USB HUB RST# as a gpio enable for the usbh1 vbus regulator.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: update LVDS support
Tim Harvey [Wed, 29 Sep 2021 22:04:21 +0000 (15:04 -0700)]
imx: ventana: update LVDS support

Enable LVDS display detection and panel-specific configuration

Make I2C based LVDS detection and configuration model specific:
- not all boards support LVDS connectors; fail detection that do not
  support LVDS to avoid misdetecting an I2C device as a display
- GPIO configuration is panel specific; use panel name where needed

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: fix splash logo drawing
Tim Harvey [Wed, 29 Sep 2021 22:04:20 +0000 (15:04 -0700)]
imx: ventana: fix splash logo drawing

After mxc_ipuv3 DM_VIDEO conversion showing splash image
doesn't work. Fix this by adding new requirements:
- splashimage env variable.
- CONFIG_SPLASH_SCREEN
- CONFIG_CMD_BMP

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: enable additional USB ether devices
Tim Harvey [Wed, 29 Sep 2021 22:04:19 +0000 (15:04 -0700)]
imx: ventana: enable additional USB ether devices

Enable additional USB ethernet devices.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: remove phy gpio reset from dt
Tim Harvey [Wed, 29 Sep 2021 22:04:18 +0000 (15:04 -0700)]
imx: ventana: remove phy gpio reset from dt

We configure network phy configuration for internal delay, LED config,
and clock config. If we leave the phy reset gpio defined in dt the
kernel may issue a reset to the phy and break these configs. While some
may be handled by a kernel phy driver, others may not (typically LED
config).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: add U-Boot watchdog support
Tim Harvey [Wed, 29 Sep 2021 22:04:17 +0000 (15:04 -0700)]
imx: ventana: add U-Boot watchdog support

Add watchdog support for U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: ventana: add part command
Tim Harvey [Wed, 29 Sep 2021 22:04:16 +0000 (15:04 -0700)]
imx: ventana: add part command

Add part command for obtaining info about disk partitions.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: imx6ul: Add support for Kontron Electronics SL/BL i.MX6UL/ULL boards (N63xx...
Frieder Schrempf [Wed, 29 Sep 2021 14:42:41 +0000 (16:42 +0200)]
imx: imx6ul: Add support for Kontron Electronics SL/BL i.MX6UL/ULL boards (N63xx/N64xx)

This adds support for i.MX6UL/ULL-based evaluation kits with SoMs by
Kontron Electronics GmbH.

Currently there are the following SoM flavors (SoM-Line):
  * N6310: SOM with i.MX6UL-2, 256MB RAM, 256MB SPI NAND
  * N6311: SOM with i.MX6UL-2, 512MB RAM, 512MB SPI NAND
  * N6411: SOM with i.MX6ULL, 512MB RAM, 512MB SPI NAND

And the according evaluation boards (Board-Line):
  * N6310-S: Baseboard with SOM N6310, eMMC, display (optional), ...
  * N6311-S: Baseboard with SOM N6311, eMMC, display (optional), ...
  * N6411-S: Baseboard with SOM N6411, eMMC, display (optional), ...

Currently U-Boot describes i.MX6UL and i.MX6ULL through separate config
options at compile-time. Though the differences are so minor, that for
the scope of these SoMs we just use a single defconfig that is compatible
with both SoCs.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
3 years agoimx: mx7: spl: fix CONFIG_SPL_MAX_SIZE definition
Matthias Schiffer [Tue, 28 Sep 2021 11:40:52 +0000 (13:40 +0200)]
imx: mx7: spl: fix CONFIG_SPL_MAX_SIZE definition

The CONFIG_SPL_MAX_SIZE definition did not account for all areas that
are used by the boot ROM according to the manual, causing boot failures
due to truncated SPL images when actually hitting this limit.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agomisc: ocotp: Allow disabling ocotp driver in SPL
Michael Scott [Sat, 25 Sep 2021 16:49:28 +0000 (19:49 +0300)]
misc: ocotp: Allow disabling ocotp driver in SPL

This allows removal of the OCOTP driver when SPL is enabled.
Disabling OCOTP reduces SPL size efficiently.

Signed-off-by: Michael Scott <mike@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoARM: dts: imx: use generic name bus
Oleksandr Suvorov [Thu, 23 Sep 2021 20:14:37 +0000 (23:14 +0300)]
ARM: dts: imx: use generic name bus

Synchronize the u-boot and kernel imx device trees, using tuned
script from commit c0157bdcafa1 ("ARM: dts: imx: use generic name bus")

Per devicetree specification, generic names are recommended to be
used, such as bus.

i.MX AIPS is an AHB - IP bridge bus, so we could use bus as node
name.

Script:
sed -i "s/\<aips@/bus@/" arch/arm/dts/imx*.dtsi
sed -i "s/\<aips@/bus@/" arch/arm/dts/vf*.dtsi
sed -i "s/\<aips-bus@/bus@/" arch/arm/dts/imx*.dtsi
sed -i "s/\<aips-bus@/bus@/" arch/arm/dts/vf*.dtsi

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agomx7ulp: Update wdog disable sequence
Ye Li [Thu, 23 Sep 2021 14:01:15 +0000 (17:01 +0300)]
mx7ulp: Update wdog disable sequence

Update the mx7ulp wdog disable sequence to avoid potential reset
issue in unlock or refresh sequence. Both sequence need two words
write to wdog CNT register in 16 bus clocks window, if miss the
window, the write will cause violation in wdog and reset the chip.

Current u-boot code is using writel() function which has a DMB
barrier to order the memory access. The DMB between two words write
may introduce some delay in certain circumstance, causing the wdog
reset due to 16 bus clock window requirement.

Also, WDOG1 might have been enabled already depending on FUSE hence
we need to be as close as possible to its reconfiguration timing
requirement of 128 bus clock limit.

This patch replaces writel() function by __raw_writel() to avoid such
issue, and improve to check if watchdog is already disabled or
unlocked.

Signed-off-by: Ye Li <ye.li@nxp.com>
Co-developed-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Co-developed-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agortc: rv8803: add epson,rx8803 and epson,rx8900 compatible
Heiko Thiery [Thu, 23 Sep 2021 09:14:32 +0000 (11:14 +0200)]
rtc: rv8803: add epson,rx8803 and epson,rx8900 compatible

The RX8803 and RX8900 register layouts are compatible with the one of
the RV8803. So add these to the compatibles.

The same compatible strings are used and approved in linux kernel.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Michael Walle <michael@walle.cc>
3 years agoARM: dts: imx6-apalis: enable watchdog
Ricardo Salveti [Tue, 21 Sep 2021 11:48:26 +0000 (14:48 +0300)]
ARM: dts: imx6-apalis: enable watchdog

Add u-boot.dtsi specific to imx6-apalis with a watchdog enabled.

If OP-TEE is loaded by SPL, it may use a watchdog to handle fails of
u-boot running. Enable the watchdog in SPL to use it by OP-TEE.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agoARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID
Marek Vasut [Sat, 11 Sep 2021 22:43:18 +0000 (00:43 +0200)]
ARM: dts: imx8mm-verdin: Set PHY mode to RGMII-ID

Since c6df0e2ffdc ("net: phy: micrel: add support for DLL setup on ksz9131")
the Micrel PHY driver correctly configures the delay register. The Verdin PHY
is RGMII-ID, so reflect that in DT, otherwise the ethernet no longer works.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
3 years agoimx8qm_mek: Increase CONFIG_SYS_BOOTM_LEN to 64MB
Oleksandr Suvorov [Sun, 29 Aug 2021 19:39:13 +0000 (22:39 +0300)]
imx8qm_mek: Increase CONFIG_SYS_BOOTM_LEN to 64MB

The BSP platform LmP supports the board NXP iMX8QM MEK. The
kernel size in LmP exceeds 32Mb. Increase the maximum size
of an uncompressed kernel to fix the following error:
    Uncompressing Kernel Image
    Error: inflate() returned -5
    Image too large: increase CONFIG_SYS_BOOTM_LEN
    Must RESET board to recover

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoimx8mq_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB
Oleksandr Suvorov [Sun, 29 Aug 2021 19:39:12 +0000 (22:39 +0300)]
imx8mq_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB

The BSP platform LmP supports the board NXP iMX8M Plus EVK. The
kernel size in LmP exceeds 32Mb. Increase the maximum size
of an uncompressed kernel to fix the following error:
    Uncompressing Kernel Image
    Error: inflate() returned -5
    Image too large: increase CONFIG_SYS_BOOTM_LEN
    Must RESET board to recover

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoimx8mm_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB
Oleksandr Suvorov [Sun, 29 Aug 2021 19:39:11 +0000 (22:39 +0300)]
imx8mm_evk: Increase CONFIG_SYS_BOOTM_LEN to 64MB

The BSP platform LmP supports the board NXP iMX8M Mini EVK. The
kernel size in LmP exceeds 32Mb. Increase the maximum size
of an uncompressed kernel to fix the following error:
    Uncompressing Kernel Image
    Error: inflate() returned -5
    Image too large: increase CONFIG_SYS_BOOTM_LEN
    Must RESET board to recover

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoKconfig: Don't use RSA_FREESCALE_EXP on MX7ULP
Ricardo Salveti [Sat, 28 Aug 2021 07:41:22 +0000 (10:41 +0300)]
Kconfig: Don't use RSA_FREESCALE_EXP on MX7ULP

The CAAM on IMX7ULP doesn't support public key hardware acceleration
(PKHA), as in other NXP parts. Disable RSA_FREESCALE_EXP for IMX7ULP
too.

Fixed: f4e9ff7135 ("Kconfig: Don't use RSA_FREESCALE_EXP on IMX")
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoarm: dts: imx8mp: Generate single bootable binary
Teresa Remmet [Thu, 26 Aug 2021 08:54:09 +0000 (10:54 +0200)]
arm: dts: imx8mp: Generate single bootable binary

binman conversion made flashing flash.bin
and u-boot.itb necessary. Update binman config
to create a single flash.bin image again.

This updates imx8mp_evk and phyCORE-i.MX8MP as they share the
same binman config.

Updated also imx8mp_evk documentation.

Tested on phyCORE-i.MX8MP.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoarm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size
Ying-Chun Liu (PaulLiu) [Tue, 24 Aug 2021 09:44:19 +0000 (17:44 +0800)]
arm: imx8m: imx8mm-cl-iot-gate: Add support for detect memory size

When purchasing imx8mm-cl-iot-gate it is able to customize the
memory size. It could be 1GB, 2GB and 4GB. We implement
board_phys_sdram_size() to detect the memory size for usage.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
3 years agotree: imx: remove old fit generator script
Andrey Zhizhikin [Tue, 24 Aug 2021 07:55:14 +0000 (09:55 +0200)]
tree: imx: remove old fit generator script

Since derivatives are moving to binman from usage of the FIT generator
script, and considering the warning introduced in f4a43d2925
("Makefile: Warn against using CONFIG_SPL_FIT_GENERATOR"), usage of FIT
generator is discouraged.

Current FIT generator also generates broken output, since commit
3f04db891a ("image: Check for unit addresses in FITs") prohibits using
'@' for unit addresses but the generator script still emits the old
sematics.

Remove the generator script and corresponding call in Makefile, all
derivatives should be migrated to binman in order to provide binary
images.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx8mm-cl-iot-gate: Split the defconfigs
Fabio Estevam [Tue, 24 Aug 2021 00:11:09 +0000 (21:11 -0300)]
imx8mm-cl-iot-gate: Split the defconfigs

Currently imx8mm-cl-iot-gate_defconfig fails to produce a working boot
binary due to the lack of fip.bin:

"  BINMAN  all
Image 'main-section' is missing external blobs and is non-functional: blob-ext

Some images are invalid"

To make the build process more consistent with the other i.MX8M targets,
split the defconfig in two:

- imx8mm-cl-iot-gate_defconfig: standard defconfig that only
requires ATF / DDR firmware.

- imx8mm-cl-iot-gate-optee_defconfig: "more advanced" defconfig that
requires ATF / Optee / mbedtls / DDR firmware.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Tested-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
3 years agomx7ulp: Allow to enable CONFIG_IMX_HAB
Ricardo Salveti [Mon, 23 Aug 2021 11:55:12 +0000 (14:55 +0300)]
mx7ulp: Allow to enable CONFIG_IMX_HAB

Secure boot support on mx7ulp was added in the
commit 27117b2024b6 ("mx7ulp: Add HAB boot support").

Allow selecting CONFIG_IMX_HAB for ARCH_IMX7ULP.

Fixes: 27117b2024b6 ("mx7ulp: Add HAB boot support")
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx8m: Restrict usable memory based on rom_pointer[0]
Ying-Chun Liu (PaulLiu) [Mon, 23 Aug 2021 02:43:06 +0000 (10:43 +0800)]
imx8m: Restrict usable memory based on rom_pointer[0]

When TEE is loaded, we need to restrict the memory usage based
on rom_pointer[0]

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
3 years agoarm: dts: imx8mm-venice*: remove thermal zone overrides
Tim Harvey [Wed, 18 Aug 2021 22:24:31 +0000 (15:24 -0700)]
arm: dts: imx8mm-venice*: remove thermal zone overrides

Remove the unnecessary thermal zone overrides.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoboard: gateworks: venice: update thermal temp thresholds per cpu grade
Tim Harvey [Wed, 18 Aug 2021 22:24:30 +0000 (15:24 -0700)]
board: gateworks: venice: update thermal temp thresholds per cpu grade

Update the passive/critical thermal zone dt config per CPU temperature
grade.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoarm: dts: imx8mm-venice-gw700x: fix mp5416 pmic config
Tim Harvey [Wed, 18 Aug 2021 22:24:29 +0000 (15:24 -0700)]
arm: dts: imx8mm-venice-gw700x: fix mp5416 pmic config

Fix various MP5416 PMIC configurations:
 - Update regulator names per dt-bindings
 - ensure values fit among valid register values
 - add required regulator-max-microamp property
 - add regulator-always-on prop

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoboard: gateworks: venice: do not overwrite serial#
Tim Harvey [Wed, 18 Aug 2021 22:24:28 +0000 (15:24 -0700)]
board: gateworks: venice: do not overwrite serial#

Do not overwrite existing serial# env to avoid:
 ## Error: Can't overwrite "serial#"
 ## Error inserting "serial#" variable, errno=1

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 years agoboard: gateworks: venice: display hwmon details by default
Tim Harvey [Wed, 18 Aug 2021 22:24:27 +0000 (15:24 -0700)]
board: gateworks: venice: display hwmon details by default

Display hwmon values by default when using the 'gsc' command.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 years agoimx53: usbarmory: Add card detect configuration
Andrej Rosano [Tue, 17 Aug 2021 09:34:02 +0000 (11:34 +0200)]
imx53: usbarmory: Add card detect configuration

After the enforcement of DM_MMC the microSD card is not detected. Fix by
correctly configuring the card detect in the devicetree.

Signed-off-by: Andrej Rosano <andrej.rosano@f-secure.com>
3 years agomtd: nand: mxs_nand_spl: Add nand_spl_adjust_offset
Ye Li [Tue, 17 Aug 2021 09:24:47 +0000 (17:24 +0800)]
mtd: nand: mxs_nand_spl: Add nand_spl_adjust_offset

Since the mxs_nand_spl has implemented adjust read offset in
nand_spl_load_image, so we don't need to check the bad block in
nand_spl_adjust_offset. Directly return the offset to continue
read by nand_spl_load_image.

Signed-off-by: Ye Li <ye.li@nxp.com>
3 years agoarm: imx8m: Fix pad DSE issue for i.MX8MM/MN/MP
Ye Li [Tue, 17 Aug 2021 09:10:35 +0000 (17:10 +0800)]
arm: imx8m: Fix pad DSE issue for i.MX8MM/MN/MP

According to 8MM/MN/MP reference manual, their pad registers only have
4 valid DSE values. And DSE2 and DSE4 are different with current
definitions in iomux-v3.h. Fix the issue to align with manual.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
3 years agommc: fsl_esdhc_imx: Fix clock disable issue
Ye Li [Tue, 17 Aug 2021 09:09:20 +0000 (17:09 +0800)]
mmc: fsl_esdhc_imx: Fix clock disable issue

The SD clock disable is wrapped by MMC_SUPPORTS_TUNING. So it
only works when UHS is enabled. However, in SD initialization the
power cycle does not depends on UHS. But the power cycle needs
disable the SD clock before power down.
So this causes a problem when UHS is not enabled. Some cards can't
become ready (ACMD14 timeout) due to the clock is enabled during
power cycle.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoimx: spl: fix imx8m secure boot
Heiko Schocher [Tue, 17 Aug 2021 06:17:18 +0000 (08:17 +0200)]
imx: spl: fix imx8m secure boot

cherry-picked from NXP code:
719d665a87c6: ("MLK-20467 imx8m: Fix issue for booting signed image through uuu")

which fixes secure boot on imx8m based boards. Problem was
that FIT header and so IVT header too, was loaded to
memallocated address. So the ivt header address coded
in IVT itself does not fit with the real position.

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com>
3 years agoimx: spl: implement spl_load_simple_fit_fix_load
Heiko Schocher [Fri, 6 Aug 2021 04:44:27 +0000 (06:44 +0200)]
imx: spl: implement spl_load_simple_fit_fix_load

read the address where the IVT header must sit
from IVT image header, loaded from SPL into
an malloced buffer and copy the IVT header
to this address

May make this dependend on SoC ?

Signed-off-by: Heiko Schocher <hs@denx.de>
3 years agospl_fit. add hook to make fixes after fit header is loaded
Heiko Schocher [Fri, 6 Aug 2021 04:44:26 +0000 (06:44 +0200)]
spl_fit. add hook to make fixes after fit header is loaded

add hook function spl_load_simple_fit_fix_load()
which is called after fit image header is loaded.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agomtd: nand: Fix typo in MXC Kconfig symbol description
Haolin Li [Sun, 18 Jul 2021 02:13:39 +0000 (10:13 +0800)]
mtd: nand: Fix typo in MXC Kconfig symbol description

Trivial typo fix.

Signed-off-by: Haolin Li <li.haolin@qq.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
3 years agoMerge branch '2021-10-06-assorted-improvements'
Tom Rini [Wed, 6 Oct 2021 16:26:33 +0000 (12:26 -0400)]
Merge branch '2021-10-06-assorted-improvements'

- Use better values for ACPI OEM_VERSION
- Assorted NAND related Kconifg migrations and another dependency fix

3 years agoConvert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:39 +0000 (14:50 -0400)]
Convert CONFIG_NAND_OMAP_ECCSCHEME to Kconfig

The values of CONFIG_NAND_OMAP_ECCSCHEME map to the enum in
include/linux/mtd/omap_gpmc.h for valid ECC schemes.  Make which one we
will use be a choice statement, enumerating the ones which we have
implemented.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_U_BOOT_LOCATIONS et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:38 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_U_BOOT_LOCATIONS et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_U_BOOT_LOCATIONS
   CONFIG_SYS_NAND_U_BOOT_OFFS

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_NAND_FSL_ELBC et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:37 +0000 (14:50 -0400)]
Convert CONFIG_NAND_FSL_ELBC et al to Kconfig

This converts the following to Kconfig:
   CONFIG_NAND_FSL_ELBC
   CONFIG_NAND_FSL_IFC

Note that a number of PowerPC platforms had previously enabled
CONFIG_NAND_FSL_ELBC without CONFIG_MTD_RAW_NAND, and now they no longer
enable the option, reducing the size of a few functions.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_MAX_CHIPS to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:36 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_MAX_CHIPS to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_MAX_CHIPS

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonand.h: Cleanup linux/mtd/rawnand.h usage
Tom Rini [Wed, 22 Sep 2021 18:50:35 +0000 (14:50 -0400)]
nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly.  Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_ONFI_DETECTION to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:34 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_ONFI_DETECTION to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_ONFI_DETECTION

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_5_ADDR_CYCLE to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:33 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_5_ADDR_CYCLE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_5_ADDR_CYCLE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:32 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_BAD_BLOCK_POS to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_BAD_BLOCK_POS

In order to do this, introduce a choice for HAS_LARGE/SMALL_BADBLOCK_POS
as those are the only valid values.  Use LARGE as the default as no
in-tree boards use SMALL, but it is possible.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonand_spl_simple: Drop CONFIG_SYS_NAND_4_ADDR_CYCLE support
Tom Rini [Wed, 22 Sep 2021 18:50:31 +0000 (14:50 -0400)]
nand_spl_simple: Drop CONFIG_SYS_NAND_4_ADDR_CYCLE support

This code is unused, drop it.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SYS_NAND_PAGE_COUNT to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:30 +0000 (14:50 -0400)]
Convert CONFIG_SYS_NAND_PAGE_COUNT to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_NAND_PAGE_COUNT

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_SPL_NAND_LOAD et al to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:29 +0000 (14:50 -0400)]
Convert CONFIG_SPL_NAND_LOAD et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SPL_NAND_LOAD
   CONFIG_SYS_NAND_BLOCK_SIZE
   CONFIG_SYS_NAND_PAGE_SIZE
   CONFIG_SYS_NAND_OOBSIZE

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoConvert CONFIG_NAND_LPC32XX_MLC to Kconfig
Tom Rini [Wed, 22 Sep 2021 18:50:28 +0000 (14:50 -0400)]
Convert CONFIG_NAND_LPC32XX_MLC to Kconfig

This converts the following to Kconfig:
   CONFIG_NAND_LPC32XX_MLC

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agom53menlo: Switch to deriving CONFIG_SYS_NAND_PAGE_COUNT
Tom Rini [Wed, 22 Sep 2021 18:50:27 +0000 (14:50 -0400)]
m53menlo: Switch to deriving CONFIG_SYS_NAND_PAGE_COUNT

Typically platforms will define CONFIG_SYS_NAND_PAGE_COUNT based on
CONFIG_SYS_NAND_BLOCK_SIZE / CONFIG_SYS_NAND_PAGE_SIZE.  Switch to this
in preparation for migrating CONFIG_SYS_NAND namespace to Kconfig.

Cc: Marek Vasut <marex@denx.de>
Cc: Olaf Mandel <o.mandel@menlosystems.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agork3308: Remove unused NAND defines
Tom Rini [Wed, 22 Sep 2021 18:50:26 +0000 (14:50 -0400)]
rk3308: Remove unused NAND defines

These platforms do not currently enable NAND, remove these references.

Cc: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agolib: rsa: fix dependency for SPL_RSA_VERIFY
Oleksandr Suvorov [Thu, 16 Sep 2021 12:03:36 +0000 (15:03 +0300)]
lib: rsa: fix dependency for SPL_RSA_VERIFY

SPL_RSA_VERIFY requires SPL_RSA to be enabled. Add correct
dependency.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
3 years agoacpi: Use U-Boot version for OEM_REVISION
Pali Rohár [Sat, 10 Jul 2021 11:10:01 +0000 (13:10 +0200)]
acpi: Use U-Boot version for OEM_REVISION

OEM_REVISION is 32-bit unsigned number. It should be increased only when
changing software version. Therefore it should not depend on build time.

Change calculation to use U-Boot version numbers and set this revision
to date number.

Prior this change OEM_REVISION was calculated from build date and stored in
the same format.

After this change macro U_BOOT_BUILD_DATE is not used in other files so
remove it from global autogenerated files and also from Makefile.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-10-05-general-updates'
Tom Rini [Tue, 5 Oct 2021 21:16:23 +0000 (17:16 -0400)]
Merge branch '2021-10-05-general-updates'

- Assorted OPTEE cleanups
- pinctrl, gpio improvements, assorted livetree migrations
- Assorted pytest improvements

3 years agoreboot-mode: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 16:27:20 +0000 (18:27 +0200)]
reboot-mode: migrate uclass to livetree

Use dev_ function to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodemo: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 15:58:33 +0000 (17:58 +0200)]
demo: migrate uclass to livetree

Use dev_ function to read the sides and colour to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoremoteproc: migrate uclass to livetree
Patrick Delaunay [Mon, 20 Sep 2021 15:56:06 +0000 (17:56 +0200)]
remoteproc: migrate uclass to livetree

Use dev_ function to read the name and boolean to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: test: Explain how to run pytests in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:51 +0000 (15:14 -0600)]
doc: test: Explain how to run pytests in parallel

Add documentation for this so people can try it out. At present it does
not fully work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow tpm2 tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:50 +0000 (15:14 -0600)]
test: Allow tpm2 tests to run in parallel

These tests currently run in a particular sequence, with some of them
depending on the actions of earlier tests.

Add a check for sandbox and reset to a known state at the start of each
test, so that all tests can run in parallel.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow hush tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:49 +0000 (15:14 -0600)]
test: Allow hush tests to run in parallel

The -z tests don't really need to be part of the main set. Separate them
out so we can drop the test setup/cleans functions and thus run all tests
in parallel.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Allow vboot tests to run in parallel
Simon Glass [Sun, 19 Sep 2021 21:14:48 +0000 (15:14 -0600)]
test: Allow vboot tests to run in parallel

Update the tests to use separate working directories, so we can run them
in parallel. It also makes it possible to see the individual output files
after the tests have completed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: Check hashes produced by mkimage against known values
Alexandru Gagniuc [Wed, 15 Sep 2021 19:33:01 +0000 (14:33 -0500)]
test/py: Check hashes produced by mkimage against known values

Target code and mkimage share the same hashing infrastructure. If one
is wrong, it's very likely that both are wrong in the same way. Thus
testing won't catch hash regressions. This already happened in
commit 92055e138f28 ("image: Drop if/elseif hash selection in
calculate_hash()"). None of the tests caught that CRC32 was broken.

Instead of testing hash_calculate() against itself, create a FIT with
containing a kernel with pre-calculated hashes. Then check the hashes
produced against the known good hashes.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Factor out DT flag translation
Samuel Holland [Sat, 11 Sep 2021 22:05:53 +0000 (17:05 -0500)]
gpio: Factor out DT flag translation

The generic GPIO flags binding is shared across many drivers, some of
which need their own xlate function. Factor out the flag translation
code from gpio_xlate_offs_flags so it does not need to be duplicated.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Verify validity of pin offsets from device trees
Samuel Holland [Sat, 11 Sep 2021 22:05:52 +0000 (17:05 -0500)]
gpio: Verify validity of pin offsets from device trees

Translation of an OF GPIO specifier should fail if the pin offset is
larger than the number of pins in the GPIO bank.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Verify validity of pin offsets when looking up names
Samuel Holland [Sat, 11 Sep 2021 22:05:51 +0000 (17:05 -0500)]
gpio: Verify validity of pin offsets when looking up names

Translation of a pin name to a device+offset should fail if the offset
is larger than the number of pins in the GPIO bank.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:09 +0000 (12:07 -0500)]
arm: imx: mx7: Move CONFIG_OPTEE_TZDRAM_SIZE from lib/optee

This config is only used by three boards with this SOC. Most other
platforms derive this information from devicetree, and are unlikely
to ever need this config.

Moreover, it is confusing when Kconfig asks for this value under
"Support OPTEE images", but does not do anything with the value.
Move it to imx7 for those boards who still make use of it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Remove CONFIG_OPTEE_LOAD_ADDR
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:08 +0000 (12:07 -0500)]
lib: optee: Remove CONFIG_OPTEE_LOAD_ADDR

This value is not used by u-boot, and it should not. The load address
of an OPTEE image is defined by said image. Either a uImage or a FIT
will have a defined load address and entry point. Those values are the
correct ones, not CONFIG_OPTEE_LOAD_ADDR.

Commit f25006b96e9f ("optee: Add CONFIG_OPTEE_LOAD_ADDR") justifies
this config by requiring its presence in u-boot's .config for other
images as part of a larger build, claiming it is "the best way".

This argument is not persuasive. U-boot's configuration is driven by
platform requirements, not the other way around. It seems more likely
that the argument is conflating tooling issues with Kconfig. Yocto and
buildroot have excellent mechanisms for defining values across the
board (pun intended). u-boot's Kconfig is the wrong place to do it.

Furthermore, it is not "best" for u-boot because it hardcodes a value
which is then not used. In fact the load address that u-boot uses is
the one derived from the OPTEE image.

Confused yet? I sure was. To prevent future confusion, remove
CONFIG_OPTEE_LOAD_ADDR.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:07 +0000 (12:07 -0500)]
lib: optee: Remove CONFIG_OPTEE_TZDRAM_BASE

It is no longer used in u-boot. Information about the TZDRAM location
is usually available in the devicetree as "/reserved-memory/" nodes.
Because this isn't used, remove it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agolib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()
Alexandru Gagniuc [Tue, 7 Sep 2021 17:07:06 +0000 (12:07 -0500)]
lib: optee: Avoid CONFIG_TZDRAM_* in optee_verify_bootm_image()

The configs TZDRAM_BASE and TZDRAM_SIZE are expected to describe the
memory allocated to the OPTEE region. according to according to commit
c5a6e8bd00cc ("optee: Add optee_verify_bootm_image()"). The TZDRAM is
with some limitations, described by "/reserved-memory" nodes in the
devicetree.

Consequently TZDRAM_BASE and TZDRAM_SIZE can point to imaginary
regions which have nothing to do with actual DRAM. They are not used
to configure the hardware or set up the Trust Zone Controller (TZC)
for OP-TEE -- the devicetree values are used instead.

When a valid OP-TEE image does not fall within the region described by
these configs, u-boot will refuse to load it. In fact, it mostly
serves to cause "bootm" to reject perfectly good OP-TEE images.

Ironically, someone has to correctly configure the devicetree for
TZDRAM, then go back and enter the same information in Kconfig for
"bootm". To remedy this, do not use TZDRAM_BASE and TZDRAM_SIZE in the
verification of OPTEE images.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agotee: add a stub for tee_find_device
Patrick Delaunay [Thu, 2 Sep 2021 09:56:17 +0000 (11:56 +0200)]
tee: add a stub for tee_find_device

Add stub for tee_find_device function when CONFIG_TEE is not activated
to simplify the caller code.

This patch allows to remove the CONFIG_IS_ENABLED(OPTEE) tests
for stm32 platform.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@inaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>