platform/kernel/u-boot.git
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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

2 years 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

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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)

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years agovideo: ipuv3: Fix error handling when getting the display
Michal Suchanek [Wed, 12 Oct 2022 19:57:56 +0000 (21:57 +0200)]
video: ipuv3: Fix error handling when getting the display

The code checks that uclass_first_device returned a device but the
returned value that is assigned is never used. Use
uclass_first_device_err instead, and move the error return outside of
the if block.

Fixes: f4ec1ae08e ("mxc_ipuv3_fb.c: call display_enable")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agostdio: Fix class iteration in stdio_add_devices()
Michal Suchanek [Wed, 12 Oct 2022 19:57:55 +0000 (21:57 +0200)]
stdio: Fix class iteration in stdio_add_devices()

There is a complaint in the code that iterates keyboards that we don't
have the _check variant of class iterator but we in fact do, use it.

In the code that iterates video devices there is an attempt to print
errors but the simple iterator does not return a device when there is an
error. Use the _check variant of the iterator as well.

Also format error messages consistently.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agousb: ether: Fix error handling in usb_ether_init
Michal Suchanek [Wed, 12 Oct 2022 19:57:54 +0000 (21:57 +0200)]
usb: ether: Fix error handling in usb_ether_init

The code checks the return value from uclass_first_device as well as
that the device exists but it passes on the return value which may be
zero if there are no gadget devices. Just check that a device was
returned and return -ENODEV otherwise.

Also remove the dev variable which is not really used for anything.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootstd: Fix listing boot devices
Michal Suchanek [Wed, 12 Oct 2022 19:57:53 +0000 (21:57 +0200)]
bootstd: Fix listing boot devices

bootdev_list() uses uclass_*_device_err() to iterate devices.
However, the only value _err adds is returning an error when the device
pointer is null, and that's checked anyway.

Also there is some intent to report errors, and that's what
uclass_*_device_check() is for, use it.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: pci: Fix device PCI iteration
Michal Suchanek [Wed, 12 Oct 2022 19:57:52 +0000 (21:57 +0200)]
dm: pci: Fix device PCI iteration

When there is no PCI bus uclass_first_device will return no bus and no
error which will result in pci_find_first_device calling
skip_to_next_device with no bus, and the bus is only checked at the end
of the while cycle, not the beginning.

Fixes: 76c3fbcd3d ("dm: pci: Add a way to iterate through all PCI devices")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: treewide: Do not opencode uclass_probe_all()
Michal Suchanek [Wed, 12 Oct 2022 19:57:51 +0000 (21:57 +0200)]
dm: treewide: Do not opencode uclass_probe_all()

We already have a function for probing all devices of a specific class,
use it.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Fix uclass_probe_all to really probe all devices
Michal Suchanek [Wed, 12 Oct 2022 19:57:50 +0000 (21:57 +0200)]
dm: core: Fix uclass_probe_all to really probe all devices

uclass_probe_all uses uclass_first_device/uclass_next_device assigning
the return value.

The interface for getting meaningful error is
uclass_first_device_check/uclass_next_device_check, use it.

Also do not stop iteration when an error is encountered. Probing all
devices includes those that happen to be after a failing device in the
uclass order.

Fixes: a59153dfeb ("dm: core: add function uclass_probe_all() to probe all devices")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodm: regmap: Disable range checks in SPL
Simon Glass [Sat, 15 Oct 2022 14:08:54 +0000 (08:08 -0600)]
dm: regmap: Disable range checks in SPL

A recent change to regmap breaks building of phycore-rk3288 for me. The
difference is only a few bytes. Somehow CI seems to pass, even though it
fails when I run docker locally. But it prevents me from sending any more
pull requests.

In any case this board is clearly near the limit. We could revert the
offending change, but it is needed for sandbox tests.

Instead, add a way to drop the range checks in SPL, since they end up
doing nothing if everything is working as expected.

This makes phycore-rk3288 build again for me and reduces the size of SPL
slightly for a number of boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 947d4f132b4 ("regmap: fix range checks")

2 years agoCI: Update to jammy-20221003-17Oct2022 tag
Tom Rini [Mon, 17 Oct 2022 15:10:32 +0000 (11:10 -0400)]
CI: Update to jammy-20221003-17Oct2022 tag

This includes python3-pyelftools so we can drop it from one of the tests
directly.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agodocker: Install pyelftools for builds
Simon Glass [Thu, 13 Oct 2022 12:25:57 +0000 (06:25 -0600)]
docker: Install pyelftools for builds

Binman needs this module to build sandbox_vpl and it is needed elsewhere
in CI.

Add it to the docker file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xpyron.glpk@gmx.de>
2 years agoMerge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 17 Oct 2022 00:23:47 +0000 (20:23 -0400)]
Merge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc1-3

UEFI:
* replace EFI_CALL() by internal functions
* delete loadfile2 handle by uninstalling all protocols

Other:

* Provide spi_set_speed() needed for implementation of
  EFI SPI I/O protocol

2 years agoefi_loader: remove efi_delete_handle on loadfile2
Ilias Apalodimas [Sun, 16 Oct 2022 08:36:32 +0000 (11:36 +0300)]
efi_loader: remove efi_delete_handle on loadfile2

Loadfile2 code is installing two protocols on it's own handle
and uses efi_delete_handle() to clean it up on failure(s). However
commit 05c4c9e21ae6 ("efi_loader: define internal implementations of
install/uninstallmultiple") prepares the ground for us to clean up
efi_delete_handle() used in favor of Install/UninstallMultipleProtocol.

While at it clean up the non needed void casts to (void *) on the
protolcol installation.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agocmd: simplify efidebug
Heinrich Schuchardt [Sat, 15 Oct 2022 11:21:01 +0000 (13:21 +0200)]
cmd: simplify efidebug

* don't use EFI_CALL() for variable services
* don't use runtime pointer to access exported function

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: avoid EFI_CALL() when draining console
Heinrich Schuchardt [Sat, 15 Oct 2022 10:22:37 +0000 (12:22 +0200)]
efi_loader: avoid EFI_CALL() when draining console

Use internal function.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: avoid EFI_CALL() for clearing screen
Heinrich Schuchardt [Sat, 15 Oct 2022 09:13:59 +0000 (11:13 +0200)]
efi_loader: avoid EFI_CALL() for clearing screen

Carve out function efi_clear_screen.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agospi: Implement spi_set_speed
Paul Barker [Wed, 5 Oct 2022 12:18:34 +0000 (13:18 +0100)]
spi: Implement spi_set_speed

This function is already defined in spi.h but no implementation of it
currently exists in the tree. The implementation is based on the static
function spi_set_speed_mode(). The function prototype is modified so
that an success or error condition can be returned to the caller.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoMerge branch '2022-10-12-additional-fixes'
Tom Rini [Wed, 12 Oct 2022 19:12:42 +0000 (15:12 -0400)]
Merge branch '2022-10-12-additional-fixes'

- Add "ubi list", Nokia RX51 fixes, other assorted fixes

2 years agoNokia RX-51: Fix double space key press
Pali Rohár [Sun, 9 Oct 2022 19:38:25 +0000 (21:38 +0200)]
Nokia RX-51: Fix double space key press

Space key is indicated by two different bits. Some HW models indicate press
of space key only by the first bit. Qemu indicates it by both bits at the
same time, which is currently interpreted by u-boot as double key press.

Fix this issue by setting first bit when only second is set (to support HW
models which indicate press only by second bit) and always clearing second
bit before processing to not report double space key press.

Signed-off-by: Pali Rohár <pali@kernel.org>