platform/kernel/u-boot.git
19 months agoboard: gateworks: gw_ventana: fix mmc env dev
Tim Harvey [Wed, 28 Sep 2022 21:00:35 +0000 (14:00 -0700)]
board: gateworks: gw_ventana: fix mmc env dev

Fix the MMC env device for boards with eMMC by adding a
board_mmc_get_env_dev override to return the boot device as the
MMC env device.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoARM: imx6: dh-imx6: Use sf update instead of sf erase and write
Marek Vasut [Wed, 28 Sep 2022 16:45:18 +0000 (18:45 +0200)]
ARM: imx6: dh-imx6: Use sf update instead of sf erase and write

With sf update fixed to support unaligned start offset, use plain
sf update to update the bootloader in SPI NOR. This also helps
avoid the case where not enough SPI NOR has been erased and the
bootloader has been written to unerased area, and thus corrupted.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: imx: Enable btrfs support on DHSOM
Marek Vasut [Wed, 28 Sep 2022 15:40:11 +0000 (17:40 +0200)]
ARM: imx: Enable btrfs support on DHSOM

The btrfs filesystem provides advanced functionality like copy-on-write
and snapshots, as well as metadata and data duplication and checksumming.
Enable btrfs in U-Boot to permit even the primary partition to be btrfs
and let system boot from it.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agocrypto/fsl: fsl_rsa: Fix dcache issue in the driver
Ye Li [Wed, 28 Sep 2022 10:19:02 +0000 (15:49 +0530)]
crypto/fsl: fsl_rsa: Fix dcache issue in the driver

issue:
CAAM fails with key error when perform Modular Exponentiation
using PKHA Block in CAAM

Fix:
add flush and invalidate dcache for keys, signature
and output decrypted data processed by CAAM.

Fixes: 34276478f7 (DM: crypto/fsl - Add Freescale rsa DM driver)
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
19 months agoapalis/colibri_imx6/-imx6ull/_imx7: update env memory layout
Marcel Ziswiler [Tue, 27 Sep 2022 15:50:52 +0000 (17:50 +0200)]
apalis/colibri_imx6/-imx6ull/_imx7: update env memory layout

Update the distro config env memory layout for the Apalis iMX6,
Colibri iMX6, Colibri iMX6ULL and Colibri iMX7:

- loadaddr=0x84200000 (resp. 0x14200000 on them i.MX 6) allows for 64MB
  area for uncompressing (ie FIT images)
- fdt_addr_r = loadaddr + 64MB : allows for 64MB kernel
- scriptaddr = fdt_addr_r + 512KB : allows for 512KB fdt
- pxefile_addr_r = scriptaddr + 512KB : allows for 512KB script
- ramdisk_addr_r = pxefile_addr_r + 512KB : allows for 1MB extlinux.conf

Memory layout analogous to 64-bit one from commit fd5c7173ade4
("imx8m{m,n}_venice: update env memory layout") but left pxefile_addr_r
updated according to doc/develop/distro.rst.

This fixes a potential issue caused by the compressed kernel being
relocated on top of the ramdisk causing its corruption.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
19 months agonitrogen6x: Remove extra quotes in fdtfile
Ariel D'Alessandro [Tue, 27 Sep 2022 14:24:53 +0000 (11:24 -0300)]
nitrogen6x: Remove extra quotes in fdtfile

After commit 395110284b56 ("nitrogen6x: Populate FDTFILE at build-time
for all platforms") iMX.6Q Sabrelite fails to boot due to a bad fdtfile
string:

  Retrieving file: /dtbs/5.18.0-0.deb11.4-armmp/"imx6q-sabrelite".dtb
  ** File not found /dtbs/5.18.0-0.deb11.4-armmp/"imx6q-sabrelite".dtb **

CONFIG_DEFAULT_DEVICE_TREE option is string typed, so __stringify() is
adding extra quotes. Remove this.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Troy Kisky <troy.kisky@boundarydevices.com>
19 months agoclk-imx8mm: Only build QSPI clocks when CONFIG_NXP_FSPI=y
Fabio Estevam [Mon, 26 Sep 2022 16:40:11 +0000 (13:40 -0300)]
clk-imx8mm: Only build QSPI clocks when CONFIG_NXP_FSPI=y

The QSPI clocks are only used when CONFIG_NXP_FSPI=y, so only build the
QSPI clocks in this case to reduce the final SPL binary size.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoclk-imx8mm: Only build ecspi clocks when CONFIG_DM_SPI=y
Fabio Estevam [Mon, 26 Sep 2022 16:40:10 +0000 (13:40 -0300)]
clk-imx8mm: Only build ecspi clocks when CONFIG_DM_SPI=y

The ecspi clocks are only used when CONFIG_DM_SPI=y, so only build the
ecspi clocks in this case to reduce the final SPL binary size.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoclk-imx8mm: Move CLK_ENET_AXI to the non-SPL section
Fabio Estevam [Mon, 26 Sep 2022 16:40:09 +0000 (13:40 -0300)]
clk-imx8mm: Move CLK_ENET_AXI to the non-SPL section

Ethernet is not used inside SPL, so move the IMX8MM_CLK_ENET_AXI clock
inside the non-SPL block to reduce the final SPL binary size.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoclk-imx8mm: Only build PWM clocks in non-SPL code
Fabio Estevam [Mon, 26 Sep 2022 16:40:08 +0000 (13:40 -0300)]
clk-imx8mm: Only build PWM clocks in non-SPL code

PWM is not used inside SPL, so do not define the PWM clocks inside
SPL to reduce the final SPL binary size.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agommc: fsl_esdhc: fix problem when using clk driver
Ye Li [Fri, 23 Sep 2022 22:29:33 +0000 (00:29 +0200)]
mmc: fsl_esdhc: fix problem when using clk driver

Move init_clk_usdhc to non-clk driver case, since assigned-clocks properties
will initialize the clocks by clk driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
19 months agoverdin-imx8mm: verdin-imx8mp: drop obsolete net/phy configs
Marcel Ziswiler [Wed, 21 Sep 2022 11:34:19 +0000 (13:34 +0200)]
verdin-imx8mm: verdin-imx8mp: drop obsolete net/phy configs

Drop obsolete networking/PHY related configuration defines.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
19 months agoboard: tbs2910: Add serial rx buffer in defconfig
Soeren Moch [Tue, 20 Sep 2022 16:05:41 +0000 (18:05 +0200)]
board: tbs2910: Add serial rx buffer in defconfig

... to avoid loosing characters when pasting text into the serial console.
This allows to remove the workaround to disable the vidconsole output
when no HDMI device is detected. This workaround only was there to speed-up
serial console processing.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoboard: tbs2910: Set all board dts files as maintained
Soeren Moch [Tue, 20 Sep 2022 16:05:40 +0000 (18:05 +0200)]
board: tbs2910: Set all board dts files as maintained

This also includes the imx6q-tbs2910-u-boot.dtsi file now.

Signed-off-by: Soeren Moch <smoch@web.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx8mm_evk: Add Serial Download Protocol support
Fabio Estevam [Tue, 20 Sep 2022 00:20:14 +0000 (21:20 -0300)]
imx8mm_evk: Add Serial Download Protocol support

Add Serial Download Protocol support as it is a useful method to
load flash.bin to RAM and run it via 'uuu'.

With this patch, it is possible to start both U-Boot SPL and U-Boot
proper using the following 'uuu'command:

$ uuu -brun spl flash.bin

Based on a patch from Marek Vasut for the imx8mm-mx8menlo board.

Also, to fit the SPL binary into the internal RAM, select CONFIG_LTO
to reduce its size.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8mm_evk: Add an entry for USB boot
Fabio Estevam [Tue, 20 Sep 2022 00:20:13 +0000 (21:20 -0300)]
imx8mm_evk: Add an entry for USB boot

Add an entry for USB boot so that U-Boot could be loaded via
the Serial Download Protocol.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support
Marek Vasut [Mon, 19 Sep 2022 19:41:18 +0000 (21:41 +0200)]
ARM: dts: imx8m: imx8mm-mx8menlo: Enable SPL SDP support

Enable DM USB, DM PHY and USB gadget support in imx8mm-mx8menlo SPL
to let the board continue SDP loading of second stage after the first
stage was loaded by BootROM SDP implementation. It is not possible to
jump back into BootROM v1 and let the BootROM implementation continue
the SDP loading, all this has to be performed by the U-Boot CI HDRC
controller driver and SDP protocol implementation, both of which fit
into the SPL just barely.

With this patch, it is possible to start both U-Boot SPL and U-Boot
using e.g. uuu on this board as follows:

$ uuu -brun spl flash.bin

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: imx8m: verdin-imx8mm: Drop bogus content from spl_board_init()
Marek Vasut [Mon, 19 Sep 2022 19:41:17 +0000 (21:41 +0200)]
ARM: imx8m: verdin-imx8mm: Drop bogus content from spl_board_init()

The current implementation of spl_board_init() USB boot handling is
not correct, the MX8MM BootROM v1 does not support SDP load when
re-entered from U-Boot SPL, it is up to U-Boot to perform the next
stage load using its own internal CI gadget driver and SDP protocol
implementation. Drop the spl_board_init() to let SPL continue with
normal load in case the SDP support is enabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: imx8m: phycore_imx8mm: Drop bogus spl_board_init()
Marek Vasut [Mon, 19 Sep 2022 19:41:16 +0000 (21:41 +0200)]
ARM: imx8m: phycore_imx8mm: Drop bogus spl_board_init()

The current implementation of spl_board_init() is not correct,
the MX8MM BootROM v1 does not support SDP load when re-entered
from U-Boot SPL, it is up to U-Boot to perform the next stage
load using its own internal CI gadget driver and SDP protocol
implementation. Drop the spl_board_init() to let SPL continue
with normal load in case the SDP support is enabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: imx8m: Deduplicate CAAM init with arch_misc_init() call
Marek Vasut [Mon, 19 Sep 2022 19:41:15 +0000 (21:41 +0200)]
ARM: imx8m: Deduplicate CAAM init with arch_misc_init() call

Instead of duplicating code implemented by i.MX8M version of arch_misc_init()
in every board, enable CONFIG_ARCH_MISC_INIT and call arch_misc_init() from
spl_board_init(). This removes the duplication. No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoARM: dts: imx8mm: Swap i.MX8M Mini Menlo board UARTs back
Marek Vasut [Mon, 19 Sep 2022 19:35:56 +0000 (21:35 +0200)]
ARM: dts: imx8mm: Swap i.MX8M Mini Menlo board UARTs back

The first production revision of the MX8M Mini Menlo board implements
a hardware change which swaps console UART and another UART connector.
Implement the swap, which maps the console UART back to the way Verdin
console is mapped.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoarm: dts: imx8mm-venice-gw7903: add dig1_ctl and dig2_ctl gpios
Tim Harvey [Fri, 9 Sep 2022 22:58:42 +0000 (15:58 -0700)]
arm: dts: imx8mm-venice-gw7903: add dig1_ctl and dig2_ctl gpios

The GW7903 revision B adds two additional GPIO's to control the
direction of the 2 isolated digital I/O circuits.

Define them as:
 - dig1_ctl
 - dig2_ctl

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoboard: gateworks: venice: update GW74xx PMIC config
Tim Harvey [Thu, 8 Sep 2022 21:41:09 +0000 (14:41 -0700)]
board: gateworks: venice: update GW74xx PMIC config

Update the GW74xx PMIC configuration:
 - increase VDD_SOC DVS1 to 0.85V per datasheet
 - increase VDD_SOC DVS0 to 0.95V before first DRAM access
 - increase VDD_ARM DVS0 to 0.95V to support kernel overdrive voltage (OD)
 - remove unnecessary changes to VDD_DRAM as we don't use 3GHz DRAM
 - remove unnecessary change to LDO2 as it is unused

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
v2: update commit log with more detail

19 months agoarm: dts: imx8mp-venice-gw74xx: update M2 gpio hogs
Tim Harvey [Thu, 8 Sep 2022 20:42:01 +0000 (13:42 -0700)]
arm: dts: imx8mp-venice-gw74xx: update M2 gpio hogs

Update the M2 socket gpio hogs such that they are not active on boot by
flagging them as GPIO_ACTIVE_HIGH so that 'output-high' drives high.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoarm: dts: imx8mp-venice-gw74xx: fix uart configuration gpio hogs
Tim Harvey [Thu, 8 Sep 2022 20:41:08 +0000 (13:41 -0700)]
arm: dts: imx8mp-venice-gw74xx: fix uart configuration gpio hogs

Update the UART config gpio hogs such that it is configured for RS232
by default on boot. Additionally rename them to match the names used
on the reset of the venice boards.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoARM: imx8mp: verdin-imx8mp: Add memory size detection
Francesco Dolcini [Wed, 7 Sep 2022 09:51:05 +0000 (11:51 +0200)]
ARM: imx8mp: verdin-imx8mp: Add memory size detection

Add RAM auto-sizing, without this change memory size for all SKU is set
to 8GB and the system will crash on SKU with less memory as soon as the
non existent memory addresses are accessed.

Fixes: 2bc2f817cea7 ("board: toradex: add verdin imx8m plus support")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
19 months agoboard: verdin-imx8mp: add call to ft_common_board_setup
Philippe Schenker [Mon, 29 Aug 2022 17:59:53 +0000 (19:59 +0200)]
board: verdin-imx8mp: add call to ft_common_board_setup

With this call the following attributes get set to the device-tree
and are then accessible from linux in /proc/device-tree/

serial-number: The serial number that is stored in config-block
toradex,board-rev: The version of the module (e.g. V1.1A)
toradex,product-id: The SKU number of the module runnin

Fixes: commit 2bc2f817cea7 ("board: toradex: add verdin imx8m plus support")
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
19 months agoboard: verdin-imx8mm: add call to ft_common_board_setup
Philippe Schenker [Mon, 29 Aug 2022 17:59:52 +0000 (19:59 +0200)]
board: verdin-imx8mm: add call to ft_common_board_setup

With this call the following attributes get set to the device-tree
and are then accessible from linux in /proc/device-tree/

serial-number: The serial number that is stored in config-block
toradex,board-rev: The version of the module (e.g. V1.1A)
toradex,product-id: The SKU number of the module running

Fixes: commit 14d5aeff776b ("board: toradex: Add Verdin iMX8M Mini support")
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
19 months agoimx: kontron-sl-mx8mm: Prepare for I2C display detection in environment script
Frieder Schrempf [Wed, 24 Aug 2022 13:59:20 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Prepare for I2C display detection in environment script

Enable the I2C bus and set a env variable for the reset GPIO of the touch
controller. This allows us to probe the panel in a script.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Add support for Kontron Electronics SoM SL i.MX8MM OSM-S
Frieder Schrempf [Wed, 24 Aug 2022 13:59:19 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Add support for Kontron Electronics SoM SL i.MX8MM OSM-S

This adds support for the Kontron Electronics SoM SL i.MX8MM OSM-S
and the matching baseboard BL i.MX8MM OSM-S.

The SoM hardware complies to the Open Standard Module (OSM) 1.0
specification, size S (https://sget.org/standards/osm).

The existing board configuration for the non-OSM SoM is reused and
allows to detect the SoM variant at runtime.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Simplify code in spl.c
Frieder Schrempf [Wed, 24 Aug 2022 13:59:18 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Simplify code in spl.c

Refactor the code a bit without any functional changes.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Use voltage rail names from schematic for PMIC regulator-names
Frieder Schrempf [Wed, 24 Aug 2022 13:59:17 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Use voltage rail names from schematic for PMIC regulator-names

Improve the naming of the regulators to contain the voltage rail
names from the schematic.

Suggested-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Use the VSELECT signal to switch SD card IO voltage
Frieder Schrempf [Wed, 24 Aug 2022 13:59:16 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Use the VSELECT signal to switch SD card IO voltage

It turns out that it is not necessary to declare the VSELECT signal as
GPIO and let the PMIC driver set it to a fixed high level. This switches
the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5
accordingly.

Instead we can do it like other boards already do and simply mux the
VSELECT signal of the USDHC interface to the pin. This makes sure that
the correct voltage is selected by setting the PMIC's SD_VSEL input
to high or low accordingly.

Reported-by: Heiko Thiery <heiko.thiery@gmail.com>
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Adjust devicetree names, compatibles and model strings
Frieder Schrempf [Wed, 24 Aug 2022 13:59:15 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Adjust devicetree names, compatibles and model strings

This adjusts the names of the boards and SoMs to the official naming
used by Kontron marketing. These changes also affect devicetree
names and compatibles. The same changes have been submitted to the
Linux kernel.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Prepare for other i.MX8MM SoM types
Frieder Schrempf [Wed, 24 Aug 2022 13:59:14 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Prepare for other i.MX8MM SoM types

This sets an env variable 'som_type' from the board code. It can
later be used by environment scripts, e. g. to select the proper
devicetree for the board.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Use new LPDDR4 config parameters
Frieder Schrempf [Wed, 24 Aug 2022 13:59:13 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Use new LPDDR4 config parameters

These parameters are needed for stable performance on new hardware
with Nanya LPDDR4 chips.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Remove 100mt DDR setpoint
Frieder Schrempf [Wed, 24 Aug 2022 13:59:12 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Remove 100mt DDR setpoint

The new stable configuration is missing the 100mt setpoint, remove
it before updating the config to make sure the changes are separated
cleanly.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: lpddr4_timing.c: Add spaces for proper alignment
Frieder Schrempf [Wed, 24 Aug 2022 13:59:11 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: lpddr4_timing.c: Add spaces for proper alignment

Fix the spaces and alignment for easier tracking of changes and comparing
with configs generated by the tools.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Enable bootaux command
Frieder Schrempf [Wed, 24 Aug 2022 13:59:10 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Enable bootaux command

Enable the bootaux command in order to be able to load a
binary into the M4 core when needed.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Migrate to use CONFIG_EXTRA_ENV_TEXT
Frieder Schrempf [Wed, 24 Aug 2022 13:59:09 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Migrate to use CONFIG_EXTRA_ENV_TEXT

Move the environment from the board header to a separate text file
and also drop those variables that are already set in env_default.h
from the Kconfig options.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Enable environment in MMC
Frieder Schrempf [Wed, 24 Aug 2022 13:59:08 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Enable environment in MMC

In case we boot from SD card or eMMC, we also want to load
the environment from the according boot device.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Add redundant environment and SPI NOR partitions
Frieder Schrempf [Wed, 24 Aug 2022 13:59:07 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Add redundant environment and SPI NOR partitions

Enable the redundant environment feature to allow falling back in case of
storage corruption. The partition layout for the SPI NOR device is added
to the devicetree.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Enable MTD command
Frieder Schrempf [Wed, 24 Aug 2022 13:59:06 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Enable MTD command

Enable the MTD command to be used for the SPI NOR on the SoM.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Increase CONFIG_SYS_CBSIZE to 2K
Frieder Schrempf [Wed, 24 Aug 2022 13:59:05 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Increase CONFIG_SYS_CBSIZE to 2K

This allows using the command line with longer lines like
large scripts in env variables.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Remove custom board_boot_order() workaround
Frieder Schrempf [Wed, 24 Aug 2022 13:59:04 +0000 (15:59 +0200)]
imx: kontron-sl-mx8mm: Remove custom board_boot_order() workaround

Nowadays detecting the SPI NOR as boot device from the ROMAPI is
fixed and works even if the SPI NOR is used as fallback boot device.

Therefore we don't need this workaround anymore.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Add support for loading from SPI NOR in SPL
Frieder Schrempf [Wed, 24 Aug 2022 13:52:24 +0000 (15:52 +0200)]
imx: kontron-sl-mx8mm: Add support for loading from SPI NOR in SPL

This was initially enabled, but got accidentally dropped while
migrating Kconfig options and resyncing the defconfig in:

commit 9802154a94d6 ("configs: Resync with savedefconfig")

Let's enable this again to be able to boot from SPI NOR.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: kontron-sl-mx8mm: Remove LVDS board type and devicetrees
Frieder Schrempf [Wed, 24 Aug 2022 13:52:23 +0000 (15:52 +0200)]
imx: kontron-sl-mx8mm: Remove LVDS board type and devicetrees

The display isn't and won't be used in U-Boot. Also the display setup
is not yet supported in mainline Linux, so even for cases where the
U-Boot devicetree is passed to the kernel there is currently no use
for this configuration.

Selecting the proper configuration in the kernel FIT image automatically
depending on the detected hardware can be handled by a script in the
environment.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: imx6ul: kontron-sl-mx6ul: Sync devicetrees
Frieder Schrempf [Tue, 23 Aug 2022 14:29:15 +0000 (16:29 +0200)]
imx: imx6ul: kontron-sl-mx6ul: Sync devicetrees

Sync the devicetrees with Linux and adjust the board names.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoimx: imx6ul: kontron-sl-mx6ul: Migrate to use CONFIG_EXTRA_ENV_TEXT
Frieder Schrempf [Tue, 23 Aug 2022 14:29:14 +0000 (16:29 +0200)]
imx: imx6ul: kontron-sl-mx6ul: Migrate to use CONFIG_EXTRA_ENV_TEXT

Move the environment from the board header to a separate text file
and also drop those variables that are already set in env_default.h
from the Kconfig options or are not needed anymore.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoimx: imx6ul: kontron-sl-mx6ul: Select correct boot and env device
Frieder Schrempf [Tue, 23 Aug 2022 14:29:13 +0000 (16:29 +0200)]
imx: imx6ul: kontron-sl-mx6ul: Select correct boot and env device

Instead of checking both, SPI NOR and MMC for loading U-Boot proper
and the environment, implement a way to detect the actual boot
device even if the BootROM doesn't report it and we can't rely
solely on the fuse settings, as by default we use MMC as primary
boot device and boot from SPI NOR via the secondary fallback device
(EEPROM Recovery Mode).

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoimx: imx6ul: kontron-sl-mx6ul: Fix CONFIG_ENV_SPI_BUS
Frieder Schrempf [Tue, 23 Aug 2022 14:29:12 +0000 (16:29 +0200)]
imx: imx6ul: kontron-sl-mx6ul: Fix CONFIG_ENV_SPI_BUS

The SPI NOR is on ECSPI1 so CONFIG_ENV_SPI_BUS should be 1
to detect the environment on the SPI NOR.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoimx: imx6ul: kontron-sl-mx6ul: Enable migrated Kconfig options
Frieder Schrempf [Tue, 23 Aug 2022 14:29:11 +0000 (16:29 +0200)]
imx: imx6ul: kontron-sl-mx6ul: Enable migrated Kconfig options

The board support was merged at the same time as some Kconfig options
for SPL were migrated/renamed. As a result some essential features
like serial output, MMC support, etc. are currently missing. Fix this
by enabling the required options.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoMakefile: Make flash.bin target available for all platforms
Frieder Schrempf [Tue, 23 Aug 2022 14:29:10 +0000 (16:29 +0200)]
Makefile: Make flash.bin target available for all platforms

There is no reason for restricting the use of the flash.bin target
to the i.MX8 platform. Others can benefit from this as well.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
19 months agoboard: gateworks: venice: rename eeprom_init
Tim Harvey [Thu, 11 Aug 2022 19:04:01 +0000 (12:04 -0700)]
board: gateworks: venice: rename eeprom_init

rename eeprom_init to avoid build failure when using CMD_EEPROM.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoarm: dts: imx8mm-venice-gw7902: add LTE modem gpios
Tim Harvey [Thu, 11 Aug 2022 19:02:48 +0000 (12:02 -0700)]
arm: dts: imx8mm-venice-gw7902: add LTE modem gpios

Add missing LTE_PWR# and LTE_RST gpio pinmux.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8*_venice_defconfig: configure default MMC env device
Tim Harvey [Thu, 11 Aug 2022 18:53:32 +0000 (11:53 -0700)]
imx8*_venice_defconfig: configure default MMC env device

When booting from USB/SDP mmc_get_env_dev() returns
CONFIG_SYS_MMC_ENV_DEV as the MMC env device (while booting from MMC
will call board_mmc_get_env_dev() to get this). Configure
CONFIG_SYS_MMC_ENV_DEV for SDHC3 (devno=2) as all Gateworks Venice
boards use SDHC3 as eMMC so that persistent env works when booting from
USB/SDP.

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoMerge branch '2022-10-18-TI-platform-updates'
Tom Rini [Tue, 18 Oct 2022 22:13:39 +0000 (18:13 -0400)]
Merge branch '2022-10-18-TI-platform-updates'

- Assorted fixes and improvements to some TI platforms

19 months agowatchdog: omap_wdt: Switch required include for watchdog defines
Tom Rini [Mon, 10 Oct 2022 20:29:17 +0000 (16:29 -0400)]
watchdog: omap_wdt: Switch required include for watchdog defines

All of the required values for using the omap_wdt.c driver are found in
<asm/ti-common/omap_wdt.h> and this is what is indirectly pulled in via
<asm/arch/hardware.h> when it exists.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoNokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE
Pali Rohár [Sun, 9 Oct 2022 19:37:13 +0000 (21:37 +0200)]
Nokia RX-51: Fix compilation with non-zero CONFIG_SYS_TEXT_BASE

For some unknown reason GNU assembler version 2.31.1 (arm-linux-gnueabi-as
from Debian Buster) cannot compile following code from located in file
board/nokia/rx51/lowlevel_init.S:

  kernoffs:
    .word  KERNEL_OFFSET - (. - CONFIG_SYS_TEXT_BASE)

when CONFIG_SYS_TEXT_BASE is set to 0x80008000. It throws strange compile
error which is even without line number:

    AS      board/nokia/rx51/lowlevel_init.o
  {standard input}: Assembler messages:
  {standard input}: Error: attempt to get value of unresolved symbol `L0'
  make[2]: *** [scripts/Makefile.build:293: board/nokia/rx51/lowlevel_init.o] Error 1

I have no idea about this error and my experiments showed that ARM GNU
assembler is happy with negation of that number. So changing code to:

  kernoffs:
    .word  . - CONFIG_SYS_TEXT_BASE - KERNEL_OFFSET

and then replacing mathematical addition by substraction of "kernoffs"
value (so calculation of address does not change) compiles assembler file
without any error now.

There should be not any functional change.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agoarm: mach-k3: Move hardware handling to common files
Andrew Davis [Fri, 7 Oct 2022 19:22:05 +0000 (14:22 -0500)]
arm: mach-k3: Move hardware handling to common files

These hardware register definitions are common for all K3, remove
duplicate data them by moving them to hardware.h.

While here do some minor whitespace cleanup + grouping.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agoarm: mach-k3: security: Use dma-mapping for cache ops
Andrew Davis [Fri, 7 Oct 2022 17:12:29 +0000 (12:12 -0500)]
arm: mach-k3: security: Use dma-mapping for cache ops

This matches how this would be done in Linux and these functions
do the alignment for us which makes the code look cleaner.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agodma: Transfer dma_ops should use DMA address types
Andrew Davis [Fri, 7 Oct 2022 17:11:13 +0000 (12:11 -0500)]
dma: Transfer dma_ops should use DMA address types

DMA operations should function on DMA addresses, not virtual addresses.
Although these are usually the same in U-Boot, it is more correct
to be explicit with our types here.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agodma: ti-edma3: Add DMA map operations before and after transfers
Andrew Davis [Fri, 7 Oct 2022 17:11:12 +0000 (12:11 -0500)]
dma: ti-edma3: Add DMA map operations before and after transfers

We should clean the caches before any DMA operation and clean+invalidate
after. This matches what the DMA framework does for us already but adds
it to the two functions here in this driver that don't yet go through the
new DMA framework.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agodma: Use dma-mapping for cache ops and sync after write
Andrew Davis [Fri, 7 Oct 2022 17:11:11 +0000 (12:11 -0500)]
dma: Use dma-mapping for cache ops and sync after write

The DMA'd memory area needs cleaned and invalidated after the DMA
write so that any stale cache lines do not mask new data.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agoarm: mach-k3: common: Set boot_fit on non-GP devices
Andrew Davis [Fri, 7 Oct 2022 16:27:46 +0000 (11:27 -0500)]
arm: mach-k3: common: Set boot_fit on non-GP devices

This matches what we did for pre-K3 devices. This allows us to build
boot commands that can check for our device type at runtime.

Signed-off-by: Andrew Davis <afd@ti.com>
19 months agophy: ti: j721e-wiz: add j784s4-wiz-10g module support
Matt Ranostay [Wed, 5 Oct 2022 20:51:30 +0000 (13:51 -0700)]
phy: ti: j721e-wiz: add j784s4-wiz-10g module support

Add support for j784s4-wiz-10g device which has two core reference
clocks (e.g core_ref_clk, core_ref1_clk) which requires an additional
mux selection option.

Signed-off-by: Matt Ranostay <mranostay@ti.com>
19 months agoarm: dts: k3-am64-evm: EMIF tool update to v0.08.40 for 1600MT/s DDR4
Dave Gerlach [Thu, 29 Sep 2022 17:35:49 +0000 (12:35 -0500)]
arm: dts: k3-am64-evm: EMIF tool update to v0.08.40 for 1600MT/s DDR4

Move to latest DDR4 1600MT/s for k3-am64-evm based on EMIF tool
v0.08.40.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
19 months agoarm: dts: k3-am64-sk: EMIF tool update to v0.08.40 and move to 1600MT/s LPDDR4
Dave Gerlach [Thu, 29 Sep 2022 17:35:48 +0000 (12:35 -0500)]
arm: dts: k3-am64-sk: EMIF tool update to v0.08.40 and move to 1600MT/s LPDDR4

Move k3-am64-sk to use 1600MT/s LPDDR4 configuration and update to latest EMIF
tool v0.08.40.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
19 months agoMerge tag 'dm-pull-18oct22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Tue, 18 Oct 2022 11:36:52 +0000 (07:36 -0400)]
Merge tag 'dm-pull-18oct22' of https://source.denx.de/u-boot/custodians/u-boot-dm

Update uclass iterators to work better when devices fail to probe
Support VBE OS requests / fixups
Minor error-handling tweaks to bootm command

19 months agoMerge tag 'u-boot-stm32-20221018' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Tue, 18 Oct 2022 11:36:39 +0000 (07:36 -0400)]
Merge tag 'u-boot-stm32-20221018' of https://source.denx.de/u-boot/custodians/u-boot-stm

- stm32mp: fix compilation issue with DEBUG_UART
- DT update :
  - Remove buck3 regulator-always-on on AV96
  - Enable btrfs support on DHSOM
  - Drop extra newline from AV96 U-Boot extras DT
  - Add DHCOR based Testbench board
  - Fix and expand PLL configuration comments
  - update SCMI dedicated file

19 months agostm32mp: fix compilation issue with DEBUG_UART
Patrick Delaunay [Tue, 11 Oct 2022 14:44:26 +0000 (16:44 +0200)]
stm32mp: fix compilation issue with DEBUG_UART

Fix the compilation issue when CONFIG_DEBUG_UART is activated

 drivers/serial/serial_stm32.o: in function `debug_uart_init':
 drivers/serial/serial_stm32.c:291: undefined reference to \
    `board_debug_uart_init'

The board_debug_uart_init is needed for SPL boot, called in
cpu.c::mach_cpu_init(); it is defined in board/st/stm32mp1/spl.c.

But with the removal #ifdefs patch, the function debug_uart_init() is
always compiled even if not present in the final U-Boot image.

This patch adds a file to provided this function when DEBUG_UART and SPL
are activated.

Fixes: c8b2eef52b6c ("stm32mp15: tidy up #ifdefs in cpu.c")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agoARM: dts: stm32: update SCMI dedicated file
Patrick Delaunay [Mon, 10 Oct 2022 08:56:14 +0000 (10:56 +0200)]
ARM: dts: stm32: update SCMI dedicated file

The PWR regulators don't need be removed as they are already deactivated.
This patches is a alignment with the accepted patch in Linux device tree
in commit a34b42f8690c ("ARM: dts: stm32: fix pwr regulators references
to use scmi").

Fixes: 69ef98b209e7 ("ARM: dts: stm32mp15: alignment with v5.19")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agoARM: dts: stm32: Fix and expand PLL configuration comments
Marek Vasut [Tue, 11 Oct 2022 20:42:44 +0000 (22:42 +0200)]
ARM: dts: stm32: Fix and expand PLL configuration comments

Fix the frequencies listed in PLL configuration comments to match
the actual frequencies programmed into hardware. Furthermore, add
a comment which explains how those frequencies are calculated, so
it won't be necessary to look it up all over the datasheet and
make more mistakes in the calculation in the future.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
19 months agoARM: dts: stm32: Add DHCOR based Testbench board
Marek Vasut [Mon, 26 Sep 2022 16:50:00 +0000 (18:50 +0200)]
ARM: dts: stm32: Add DHCOR based Testbench board

Add DT for DHCOR Testbench board, which is a testbench for testing of
DHCOR SoM during manufacturing. This is effectively a trimmed down
version of AV96 board with CSI-2 bridge, HDMI bridge, WiFi, Audio and
LEDs removed and used as GPIOs instead. Furthermore, the PMIC Buck3
is always configured from PMIC NVM to cater for both 1V8 and 3V3 SoM
variant.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agoARM: dts: stm32: Drop extra newline from AV96 U-Boot extras DT
Marek Vasut [Mon, 26 Sep 2022 16:46:31 +0000 (18:46 +0200)]
ARM: dts: stm32: Drop extra newline from AV96 U-Boot extras DT

Remove duplicate newline, no functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agoARM: stm32: Enable btrfs support on DHSOM
Marek Vasut [Mon, 26 Sep 2022 16:44:58 +0000 (18:44 +0200)]
ARM: stm32: Enable btrfs support on DHSOM

The btrfs filesystem provides advanced functionality like copy-on-write
and snapshots, as well as metadata and data duplication and checksumming.
Enable btrfs in U-Boot to permit even the primary partition to be btrfs
and let system boot from it.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agoARM: dts: stm32: Remove buck3 regulator-always-on on AV96
Marek Vasut [Fri, 23 Sep 2022 01:31:22 +0000 (03:31 +0200)]
ARM: dts: stm32: Remove buck3 regulator-always-on on AV96

In case the regulator-always-on is present in regulator DT node,
the regulator is always reconfigured to the voltage set in DT on
probe, even if regulator_set_value() has been called before. Drop
the property from AV96 U-Boot DT and enable the regulator manually
in code, as the board already reconfigures the Buck3 regulator in
code per PMIC NVM content instead.

Fixes: 0adf10a87b1 ("ARM: dts: stm32: Configure Buck3 voltage per PMIC NVM on Avenger96")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
19 months agovbe: Add a test for VBE device tree fixups
Simon Glass [Tue, 11 Oct 2022 15:47:20 +0000 (09:47 -0600)]
vbe: Add a test for VBE device tree fixups

When a FIT includes some OS requests, U-Boot should process these and add
the requested info to corresponding subnodes of the /chosen node. Add a
pytest for this, which sets up the FIT, runs bootm and then uses a C
unit test to check that everything looks OK.

The test needs to run on sandbox_flattree since we don't support
device tree fixups on sandbox (live tree) yet. So enable BOOTMETH_VBE and
disable bootflow_system(), since EFI is not supported on
sandbox_flattree.

Add a link to the initial documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Update docs about oftree_from_fdt()
Simon Glass [Tue, 11 Oct 2022 15:47:19 +0000 (09:47 -0600)]
dm: core: Update docs about oftree_from_fdt()

Update this function's comment and also the livetree documentation, so it
is clear when to use the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agovbe: Add fixups for a basic set of OS requests
Simon Glass [Tue, 11 Oct 2022 15:47:18 +0000 (09:47 -0600)]
vbe: Add fixups for a basic set of OS requests

As a starting point, add support for providing random data, if requested
by the OS. Also add ASLR, as a placeholder for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed up to use uclass_first_device_err() instead)

19 months agotest: Move common FIT code into a separate fit_util file
Simon Glass [Tue, 11 Oct 2022 15:47:17 +0000 (09:47 -0600)]
test: Move common FIT code into a separate fit_util file

To avoid duplicating code, create a new fit_util module which provides
various utility functions for FIT. Move this code out from the existing
test_fit.py and refactor it with addition parameters.

Fix up pylint warnings in the conversion.

This involves no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Tidy up logging and naming in vbe_simple
Simon Glass [Tue, 11 Oct 2022 15:47:16 +0000 (09:47 -0600)]
boot: Tidy up logging and naming in vbe_simple

Make sure the log_msg_ret() values are unique so that the log trace is
unambiguous with LOG_ERROR_RETURN. Also avoid reusing the 'node' variable
for two different nodes in bootmeth_vbe_simple_ft_fixup(), since this is
confusing.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Pass the correct FDT to the EVT_FT_FIXUP event
Simon Glass [Tue, 11 Oct 2022 15:47:15 +0000 (09:47 -0600)]
boot: Pass the correct FDT to the EVT_FT_FIXUP event

Now that we support multiple device trees with the ofnode interface, we
can pass the correct FDT to this event. This allows the 'working' FDT to
be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled.

Also make sure we don't try to do this with livetree, which does not
support fixups yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agosandbox: Support FDT fixups
Simon Glass [Tue, 11 Oct 2022 15:47:14 +0000 (09:47 -0600)]
sandbox: Support FDT fixups

Add support for doing device tree fixups in sandbox. This allows us to
test that functionality in CI.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootstd: Move VBE setup into a shared function
Simon Glass [Tue, 11 Oct 2022 15:47:13 +0000 (09:47 -0600)]
bootstd: Move VBE setup into a shared function

This information needs to be set up by the bootstd tests as well. Move it
into a common function and ensure it is executed before any bootstd test
is run.

Make sure the 'images' parameter is set correctly for fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agofdt: Show a message when the working FDT changes
Simon Glass [Tue, 11 Oct 2022 15:47:12 +0000 (09:47 -0600)]
fdt: Show a message when the working FDT changes

The working FDT is the one which comes from the OS and is fixed up by
U-Boot. When the bootm command runs, it sets up the working FDT to be the
one it is about to pass to the OS, so that fixups can happen.

This seems like an important step, so add a message indicating that the
working FDT has changed. This is shown during the running of the bootm
command.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agofs: Quieten down the filesystems more
Simon Glass [Tue, 11 Oct 2022 15:47:11 +0000 (09:47 -0600)]
fs: Quieten down the filesystems more

When looking for a filesystem on a partition we should do so quietly. At
present if the filesystem is very small (e.g. 512 bytes) we get a host of
messages.

Update these to only show when debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoboot: Correct handling of addresses in boot_relocate_fdt()
Simon Glass [Tue, 11 Oct 2022 15:47:10 +0000 (09:47 -0600)]
boot: Correct handling of addresses in boot_relocate_fdt()

This code uses casts between addresses and pointers, so does not work with
sandbox. Update it so we can allow sandbox to do device tree fixups.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Drop #ifdef from do_bootm()
Simon Glass [Tue, 11 Oct 2022 15:47:09 +0000 (09:47 -0600)]
bootm: Drop #ifdef from do_bootm()

Drop the #ifdefs from this command by using a variable to hold the states
that should be executed.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Avoid returning error codes from command
Simon Glass [Tue, 11 Oct 2022 15:47:08 +0000 (09:47 -0600)]
bootm: Avoid returning error codes from command

Functions which implement commands must return a CMD_RET_... error code.
At present bootm can return a negative errno value in some cases, thus
causing strange behaviour such as trying to exit the shell and printing
usage information.

Fix this by returning the correct value.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agobootm: Change incorrect 'unsupported' error
Simon Glass [Tue, 11 Oct 2022 15:47:07 +0000 (09:47 -0600)]
bootm: Change incorrect 'unsupported' error

At present when bootm fails, it says:

    subcommand not supported

and then prints help for the bootm command. This is not very useful, since
generally the error is related to something else, such as fixups failing.
It is quite confusing to see this in a test run.

Change the error and show the error code.

We could update the OS functions to return -ENOSYS when they do not
support the bootm subcommand. But this involves some thought since this is
arch-specific code and proper errno error codes are not always returned.
Also, with the code as is, all required subcommands are of course
supported - a problem would only come if someone added a new one or
removed support for one from an existing OS. Therefore it seems better to
leave that sort of effort for when our bootm tests are improved.

Note: v1 of this patch generated a discussion[1] about printing error
strings automatically using printf(). That is outside the scope of this
patch but will be dealt with separately.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20220909151801.336551-3-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Switch uclass_*_device_err to use uclass_*_device_check
Michal Suchanek [Wed, 12 Oct 2022 19:58:06 +0000 (21:58 +0200)]
dm: core: Switch uclass_*_device_err to use uclass_*_device_check

The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: core: Switch uclass_foreach_dev_probe to use simple iterator
Michal Suchanek [Wed, 12 Oct 2022 19:58:05 +0000 (21:58 +0200)]
dm: core: Switch uclass_foreach_dev_probe to use simple iterator

The return value is not used for anythig, and in a later patch the
behavior of the _err iterator will change in an incompatible way.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Update pvblock_probe() to avoid using internal var:
Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agompc83xx: gazerbeam: Update sysinfo_get error handling
Michal Suchanek [Wed, 12 Oct 2022 19:58:04 +0000 (21:58 +0200)]
mpc83xx: gazerbeam: Update sysinfo_get error handling

In a later patch sysinfo_get will be changed to return the device in cae
of an error. Set sysinfo to NULL on error to preserve previous behavior.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agonet: eth-uclass: Do not set device on error
Michal Suchanek [Wed, 12 Oct 2022 19:58:02 +0000 (21:58 +0200)]
net: eth-uclass: Do not set device on error

eth_get_dev relies on the broken behavior that returns an error but not
the device on which the error happened which gives the caller no
reasonable way to report or handle the error.

In a later patch uclass_first_device_err will be changed to return the
device on error but eth_get_dev stores the returned device pointer
directly in a global state without checking the return value. Unset the
pointer again in the error case.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: blk: Do not use uclass_next_device_err
Michal Suchanek [Wed, 12 Oct 2022 19:58:01 +0000 (21:58 +0200)]
dm: blk: Do not use uclass_next_device_err

blk_first_device_err/blk_next_device_err uses
uclass_first_device_err/uclass_next_device_err for device iteration.

Although the function names superficially match the return value from
uclass_first_device_err/uclass_next_device_err is never used
meaningfully, and uclass_first_device/uclass_next_device works equally
well for this purpose.

In the following patch the semantic of
uclass_first_device_err/uclass_next_device_err will be changed to be
based on uclass_first_device_check/uclass_next_device_check breaking
this sole user that uses uclass_next_device_err for iteration.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: treewide: Use uclass_next_device_err when accessing second device
Michal Suchanek [Wed, 12 Oct 2022 19:58:00 +0000 (21:58 +0200)]
dm: treewide: Use uclass_next_device_err when accessing second device

There are a couple users of uclass_next_device return value that get the
first device by other means and use uclass_next_device assuming the
following device in the uclass is related to the first one.

Use uclass_next_device_err because the return value from
uclass_next_device will be removed in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agodm: treewide: Use uclass_first_device_err when accessing one device
Michal Suchanek [Wed, 12 Oct 2022 19:57:59 +0000 (21:57 +0200)]
dm: treewide: Use uclass_first_device_err when accessing one device

There is a number of users that use uclass_first_device to access the
first and (assumed) only device in uclass.

Some check the return value of uclass_first_device and also that a
device was returned which is exactly what uclass_first_device_err does.

Some are not checking that a device was returned and can potentially
crash if no device exists in the uclass. Finally there is one that
returns NULL on error either way.

Convert all of these to use uclass_first_device_err instead, the return
value will be removed from uclass_first_device in a later patch.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agocmd: List all uclass devices regardless of probe error
Michal Suchanek [Wed, 12 Oct 2022 19:57:58 +0000 (21:57 +0200)]
cmd: List all uclass devices regardless of probe error

There are a few commands that iterate uclass with
uclass_first_device/uclass_next_device or the _err variant.

Use the _check class iterator variant to get devices that fail to probe
as well, and print the status.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agow1: Fix bus counting in w1_get_bus
Michal Suchanek [Wed, 12 Oct 2022 19:57:57 +0000 (21:57 +0200)]
w1: Fix bus counting in w1_get_bus

Use uclass_first_device_check/uclass_next_device_check to correctly
count buses that fail to probe.

Fixes: d3e19cf919 ("w1: Add 1-Wire uclass")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>