]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
19 months agoboard: cssi: Load CMPC885's motherboard FPGA earlier
Christophe Leroy [Wed, 3 May 2023 06:38:16 +0000 (08:38 +0200)]
board: cssi: Load CMPC885's motherboard FPGA earlier

In order to know the motherboard type earlier, perform I/O ports
initialisation and FPGA loading in board_early_init_f() instead
of board_early_init_r().

This is needed to be able to load mpc8xx CPM microcode base on
motherboard type and before starting to use the CPM.

Console is not available yet so remove the printfs.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
19 months agoboard: cssi: Remove stale macro from cmpcpro.c
Christophe Leroy [Wed, 3 May 2023 06:21:46 +0000 (08:21 +0200)]
board: cssi: Remove stale macro from cmpcpro.c

Three unused macros were left over. Remove them.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
19 months agoboard: cssi: Remove duplicated FPGA loading sequence on CMPC885
Christophe Leroy [Wed, 3 May 2023 05:46:20 +0000 (07:46 +0200)]
board: cssi: Remove duplicated FPGA loading sequence on CMPC885

A duplicated FPGA loading sequence appears after FPGA reset.

Remove it.

Fixes: dac3c6f625 ("board: cssi: Add new board MCR3000_2G")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
19 months agoPrepare v2023.07-rc1
Tom Rini [Mon, 1 May 2023 16:02:02 +0000 (12:02 -0400)]
Prepare v2023.07-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 1 May 2023 15:50:26 +0000 (11:50 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 1 May 2023 01:29:50 +0000 (21:29 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

Please pull the second part of the sunxi pull request for this cycle.
Another bunch of patches that replace old-school U-Boot hacks with
proper DM based code, this time for the raw NAND flash driver, and the
USB PHY VBUS detection code. Plus two smaller patches that were sitting
in my inbox for a while.

Gitlab CI passed. In lack of some supported board with NAND flash I
couldn't really test this part, but apparently this was tested by the
reviewer. I briefly ran the branch on some boards with USB-OTG, and
this still worked.

20 months agoMerge branch 'for-2023.07' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx
Tom Rini [Sat, 29 Apr 2023 13:29:41 +0000 (09:29 -0400)]
Merge branch 'for-2023.07' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx

This pull request adds support for the last CPU board from
CS GROUP France (previously CSSI).

That CPU board called CMPCPRO has a mpc8321E CPU (Family PQII PRO hence
its name) and can be plugged in place of the CMPC885 board.

In order to support that new board, the following changes are included
in this series:
- Make the mpc8xx watchdog driver more generic for reusing it
with mpc83xx
- Fix various small problems on mpc83xx platform
- Add a GPIO Driver for QE GPIOs
- Add support for mpc832x into mpc83xx SPI driver
- Refactor existing board code that will be shared with new board
- Add the new board

20 months agoMerge tag 'dm-pull-28apr23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Fri, 28 Apr 2023 23:00:01 +0000 (19:00 -0400)]
Merge tag 'dm-pull-28apr23' of https://source.denx.de/u-boot/custodians/u-boot-dm

sandbox and fdt bug fixes / tweaks
various other minor fixes

20 months agofdt: Indicate that people should use the ofnode API
Simon Glass [Tue, 25 Apr 2023 16:27:21 +0000 (10:27 -0600)]
fdt: Indicate that people should use the ofnode API

Add a note to the comment at the top of this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agofdt_support: fix comments syntax error
Hugo Villeneuve [Mon, 24 Apr 2023 20:51:50 +0000 (16:51 -0400)]
fdt_support: fix comments syntax error

Fix comments syntax error in fdt_node_offset_by_compat_reg()
description:
    compatiable -> compatible

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocore: fdtaddr: use map_sysmem() as cast for the return
Johan Jonker [Sun, 23 Apr 2023 09:19:41 +0000 (11:19 +0200)]
core: fdtaddr: use map_sysmem() as cast for the return

For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr()
function use map_sysmem() function as cast for the return for use in
sandbox. Also fix sandbox test.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Drop second hunk:
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agotools: Fall back to importlib_resources on Python 3.6
Jan Kiszka [Sat, 22 Apr 2023 14:42:48 +0000 (16:42 +0200)]
tools: Fall back to importlib_resources on Python 3.6

importlib.resources became part of 3.7 only. Allow using distros with
3.6 and the importlib_resources backport.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: fdt: Fix copyright message
Marek Vasut [Sat, 22 Apr 2023 12:59:58 +0000 (14:59 +0200)]
test: fdt: Fix copyright message

Drop the map_to_sysmem() copy paste error. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agopatman: fix class TestFunctional
Heinrich Schuchardt [Thu, 20 Apr 2023 18:07:29 +0000 (20:07 +0200)]
patman: fix class TestFunctional

Variable orig_dir cannot be used in the finally block if it has not be
assigned outside of the try block.

tools/patman/func_test.py:523:21:
E0601: Using variable 'orig_dir' before assignment
(used-before-assignment)

tools/patman/func_test.py:691:21:
E0601: Using variable 'orig_dir' before assignment
(used-before-assignment)

Fixes: fd70986a62af ("patman: Add a test that uses gitpython")
Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agobinman: Use expanduser instead of HOME
Simon Glass [Wed, 19 Apr 2023 21:21:14 +0000 (15:21 -0600)]
binman: Use expanduser instead of HOME

There may not be a HOME environment variable, so use the os.expanduser()
function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: introduce uclass_get_device_by_of_path()
Rasmus Villemoes [Thu, 13 Apr 2023 15:17:03 +0000 (17:17 +0200)]
dm: core: introduce uclass_get_device_by_of_path()

There's quite a few instances of board-specific code doing

  off = fdt_path_offset(gd->fdt_blob, ...);
  ...
  ret = uclass_get_device_by_of_offset(..., off, &dev);

looking for an eeprom or a pmic via some alias. Such code can be
simplified a little if we have a helper for directly getting a device
via device tree path (including being given as an alias).

Implement it in terms of ofnode rather than raw offsets so that this
will work whether live tree is enabled or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
20 months agouclass: add uclass_find_device_by_phandle_id() helper
Rasmus Villemoes [Thu, 13 Apr 2023 15:16:11 +0000 (17:16 +0200)]
uclass: add uclass_find_device_by_phandle_id() helper

The functions uclass_find_device_by_phandle() and
uclass_get_device_by_phandle_id() both loop over a given uclass
looking for a device with a given phandle. Factor that out to a common
helper.

For now, there are no (known potential) users of the new helper
outside uclass.c, so make it static.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix warning on sandbox_spl; fix code style:
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: disable tracing before unmapping RAM
Pavel Skripkin [Wed, 12 Apr 2023 18:55:44 +0000 (21:55 +0300)]
sandbox: disable tracing before unmapping RAM

Currently doing 'reset' command in sandbox with tracing enabled causes
SIGSEV

```
Hit any key to stop autoboot:  0
=>
=>
=> reset
resetting ...
Segmentation fault (core dumped)

```

Tracing callback uses RAM buffer for storing tracing reports, but
state_uninit() function unmaps whole RAM, which causes SIGSEV on umapped
memory inside tracing subsystem.

Fix it by disabling tracing before unmapping memory

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Add missing check for CONFIG_TRACE:
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: correct posix_types.h define
Heinrich Schuchardt [Mon, 17 Apr 2023 07:08:56 +0000 (09:08 +0200)]
sandbox: correct posix_types.h define

arch/arm/include/asm/posix_types.h and
arch/sandbox/include/asm/posix_types.h should use different defines.

Add SPDX header.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agobootflow: Rework do_bootflow_menu() slightly
Tom Rini [Thu, 6 Apr 2023 14:03:33 +0000 (10:03 -0400)]
bootflow: Rework do_bootflow_menu() slightly

When building this with clang, we get a warning such as:
cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized]
        printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
                                 ^~~~~

And a suggestion to just initialize bflow to NULL. This would however
would be ensuring a bad dereference. Instead, looking at the function we
rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we
error early and would never reach this point in the code.  Simplify the
rest slightly as well while at this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agodm: core: Make aliases_lookup static
Bin Meng [Wed, 5 Apr 2023 14:37:55 +0000 (22:37 +0800)]
dm: core: Make aliases_lookup static

aliases_lookup is only referenced in of_access.c

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agodrivers: tee: sandbox: Fix SCP03 control emulator
Jorge Ramirez-Ortiz [Sat, 8 Apr 2023 15:35:31 +0000 (17:35 +0200)]
drivers: tee: sandbox: Fix SCP03 control emulator

Fix and document the Secure Channel Protocol03 emulator.

Fixes: 5a8783c80c39 ("drivers: tee: sandbox: SCP03 control emulator")
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
20 months agosandbox: fix return type of os_filesize()
Heinrich Schuchardt [Wed, 5 Apr 2023 09:34:15 +0000 (11:34 +0200)]
sandbox: fix return type of os_filesize()

Given a file ../img of size 4294967296 with GPT partition table and
partitions:

=> host bind 0 ../img
=> part list host 0
Disk host-0.blk not ready

The cause is os_filesize() returning int. File sizes must use off_t.

Correct all uses of os_filesize() too.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoMAINTAINERS: assign include/os.h
Heinrich Schuchardt [Wed, 5 Apr 2023 09:26:38 +0000 (11:26 +0200)]
MAINTAINERS: assign include/os.h

os.h is only used by the sandbox.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agobinman: Use unsigned long over typedef ulong
Andrew Davis [Tue, 4 Apr 2023 18:45:41 +0000 (13:45 -0500)]
binman: Use unsigned long over typedef ulong

The header binman_sym.h depends on ulong typedef but does not include
types.h. This means the header must be included after including types.h
or a header that includes it.

We could include types.h but instead let's just switch from ulong
to directly using unsigned long. This removes the need for typedef'ing
it in some of the tests, so also remove those.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocommon: static fdt_simplefb_enable_existing_node()
Heinrich Schuchardt [Mon, 3 Apr 2023 18:46:50 +0000 (20:46 +0200)]
common: static fdt_simplefb_enable_existing_node()

Function fdt_simplefb_enable_existing_node() should be static as it is not
used outside common/fdt_simplefb.c.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoboot: vbe_simple: Fix vbe_simple_read_bootflow() dependency
Bin Meng [Mon, 3 Apr 2023 03:40:26 +0000 (11:40 +0800)]
boot: vbe_simple: Fix vbe_simple_read_bootflow() dependency

vbe_simple_read_bootflow() calls vbe_simple_read_bootflow_fw()
which is only available when BOOTMETH_VBE_SIMPLE_FW is on.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: mark sandbox_exit() as no return.
Heinrich Schuchardt [Sat, 1 Apr 2023 07:54:25 +0000 (09:54 +0200)]
sandbox: mark sandbox_exit() as no return.

Fix a -Wimplicit-fallthrough warning in sandbox_sysreset_request().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: spi: sandbox_sf_process_cmd() missing fallthrough
Heinrich Schuchardt [Sat, 1 Apr 2023 07:38:05 +0000 (09:38 +0200)]
sandbox: spi: sandbox_sf_process_cmd() missing fallthrough

Add a missing fallthrough macro to avoid a -Wimplicit-fallthrough warning.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: fix sandbox_hub_submit_control_msg()
Heinrich Schuchardt [Sat, 1 Apr 2023 06:57:33 +0000 (08:57 +0200)]
sandbox: fix sandbox_hub_submit_control_msg()

Avoid incorrect fall through:
A USB_RT_HUB request should not be treated as USB_RT_PORT.

Simplify the coding:
Avoid duplicate debug() statements.

This fixes all -Wimplicit-fallthrough warnings.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: fix fall through in sandbox_flash_bulk()
Heinrich Schuchardt [Sat, 1 Apr 2023 06:24:52 +0000 (08:24 +0200)]
sandbox: fix fall through in sandbox_flash_bulk()

Handling of SANDBOX_FLASH_EP_OUT should never fall through to
SANDBOX_FLASH_EP_IN.

This addresses a warning shown when compiling with
-Wimplicit-fallthrough.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoboard: cssi: Add CPU board CMPCPRO
Christophe Leroy [Tue, 4 Apr 2023 11:09:36 +0000 (13:09 +0200)]
board: cssi: Add CPU board CMPCPRO

CSSI has another CPU board, similar to the CMPC885 board
that get plugged on the two base boards MCR3000_2G and MIAE.

That CPU board is called CMPCPRO because it has a MPC8321E CPU,
also known as Power QUICC II PRO.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Move all mother board code into common.c
Christophe Leroy [Wed, 5 Apr 2023 16:50:23 +0000 (18:50 +0200)]
board: cssi: Move all mother board code into common.c

All the code used to manage the mother boards will be
common to soon to come CPU board.

Move all that code into common.c

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Refactor EEPROM read
Christophe Leroy [Wed, 5 Apr 2023 14:05:36 +0000 (16:05 +0200)]
board: cssi: Refactor EEPROM read

On cmpc885 board, the ethernet addresses are stored in an
EEPROM that is accessed through SPI.

A 3 bytes command is sent to the chip then the content
gets read. At the time being a single block access is
performed, ignoring the first 3 bytes read.

Reword the SPI transfer to first send 3 bytes then
receive the content of the EEPROM so that there don't be
3 dummy bytes at the beginning of the buffer.

And move the function into common.c so that it can be
reused by the board that will be added in a future patch.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Create dedicated file for common sources
Christophe Leroy [Tue, 4 Apr 2023 10:42:15 +0000 (12:42 +0200)]
board: cssi: Create dedicated file for common sources

In preparation of the new cssi board called cmpcpro which
we be introduce in a future patch, move common
functions into a dedicated file in a common directory.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoboard: cssi: Migrate to hashed password
Christophe Leroy [Fri, 28 Apr 2023 15:42:33 +0000 (17:42 +0200)]
board: cssi: Migrate to hashed password

Use a hashed password instead of clear text in order to
improve board security.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
20 months agoKconfig: Remove an impossible condition
Samuel Holland [Sun, 22 Jan 2023 17:23:51 +0000 (11:23 -0600)]
Kconfig: Remove an impossible condition

ARCH_SUNXI selects BINMAN, so the condition "!BINMAN && ARCH_SUNXI"
is impossible to satisfy.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agophy: sun4i-usb: Do not drive VBUS with external VBUS present
Samuel Holland [Fri, 15 Jul 2022 03:34:53 +0000 (22:34 -0500)]
phy: sun4i-usb: Do not drive VBUS with external VBUS present

It is possible to use host-side USB with externally-provided VBUS. For
example, some USB OTG cables have an extra power input which powers
both the board and the USB peripheral.

To support this setup, skip enabling the VBUS switch/regulator if VBUS
voltage is already present. This behavior matches the Linux PHY driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agogpio: axp/sunxi: Remove virtual VBUS detection GPIO
Samuel Holland [Sun, 22 Jan 2023 23:46:22 +0000 (17:46 -0600)]
gpio: axp/sunxi: Remove virtual VBUS detection GPIO

Now that this functionality is modeled using the device tree and
regulator uclass, the named GPIO is not referenced anywhere. Remove it.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agosunxi: Switch to PMIC USB power supply VBUS detection
Samuel Holland [Sun, 22 Jan 2023 23:46:21 +0000 (17:46 -0600)]
sunxi: Switch to PMIC USB power supply VBUS detection

Update boards to use the USB power supply driver, as referenced in the
device tree, instead of a virtual GPIO. This removes the need for some
DM-incompatible special cases in the GPIO driver.

The following five boards used AXP0-VBUS-DETECT in their config, but are
missing the "usb0_vbus_power-supply" property in their device tree:
 - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1
 - Cubieboard4_defconfig / sun9i-a80-cubieboard4
 - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus
 - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078
 - Yones_Toptech_BS1078_V2_defconfig /
   sun6i-a31s-yones-toptech-bs1078-v2

None of those five boards have the MUSB controller (USB OTG) enabled in
their device trees, so this change should not break anything for them.

Additionally, the following board intentionally omits the property
because VBUS is always enabled:
 - Nintendo_NES_Classic_Edition_defconfig /
   sun8i-r16-nintendo-nes-classic

The PHY driver already assumes VBUS is enabled when no detection method
is available, so again this will not cause any problems.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agopower: regulator: Add a driver for the AXP USB power supply
Samuel Holland [Sun, 22 Jan 2023 23:46:20 +0000 (17:46 -0600)]
power: regulator: Add a driver for the AXP USB power supply

This driver reports the presence/absence of voltage on the PMIC's USB
VBUS pin. This information is used by the USB PHY driver. The
corresponding Linux driver uses the power supply class, which does not
exist in U-Boot. UCLASS_REGULATOR seems to be the closest match.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agomtd: nand: sunxi: Pass the device to the init function
Samuel Holland [Sun, 22 Jan 2023 22:06:36 +0000 (16:06 -0600)]
mtd: nand: sunxi: Pass the device to the init function

This more closely matches the U-Boot driver to the Linux version.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Michael Trimarchi <micahel@amarulasolutions.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agomtd: nand: sunxi: Convert to the driver model
Samuel Holland [Sun, 22 Jan 2023 22:06:35 +0000 (16:06 -0600)]
mtd: nand: sunxi: Convert to the driver model

Clocks, resets, and pinmuxes are now handled by the driver model, so the
only thing the "board" code needs to do is load the driver. This matches
the pattern used by other DM raw NAND drivers (there is no NAND uclass).

The actual board code is now only needed in SPL.

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agomtd: nand: sunxi: Convert from fdtdec to ofnode
Samuel Holland [Sun, 22 Jan 2023 22:06:34 +0000 (16:06 -0600)]
mtd: nand: sunxi: Convert from fdtdec to ofnode

As a first step toward converting this driver to the driver model, use
the ofnode abstraction to replace direct references to the FDT blob.

Using ofnode_read_u32_index removes an extra pair of loops and makes the
allwinner,rb property optional, matching the devicetree binding.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agomtd: nand: sunxi: Remove an unnecessary check
Samuel Holland [Sun, 22 Jan 2023 22:06:33 +0000 (16:06 -0600)]
mtd: nand: sunxi: Remove an unnecessary check

Each chip is required to have a unique CS number ("reg" property) in the
range 0-7, so there is no need to separately count the number of chips.

Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agopinctrl: sunxi: Add NAND pinmuxes
Samuel Holland [Sun, 22 Jan 2023 22:06:32 +0000 (16:06 -0600)]
pinctrl: sunxi: Add NAND pinmuxes

NAND is always at function 2 on port C.

Pin lists and mux values were taken from the Linux drivers.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agoclk: sunxi: Add NAND clocks and resets
Samuel Holland [Sun, 22 Jan 2023 22:06:31 +0000 (16:06 -0600)]
clk: sunxi: Add NAND clocks and resets

Currently NAND clock setup is done in board code, both in SPL and in
U-Boot proper. Add the NAND clocks/resets here so they can be used by
the "full" NAND driver once it is converted to the driver model.

The bit locations are copied from the Linux CCU drivers.

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agosunxi: binman: Fix U-Boot offset when SPL is not 32 KiB
Samuel Holland [Sat, 21 Jan 2023 23:25:17 +0000 (17:25 -0600)]
sunxi: binman: Fix U-Boot offset when SPL is not 32 KiB

On sunxi boards, SPL looks for U-Boot at a 32 KiB offset, unless SPL is
larger than 32 KiB, in which case U-Boot immediately follows SPL. See
the logic in spl_mmc_get_uboot_raw_sector() and spl_spi_load_image().

In two cases, the existing binman description mismatches the SPL code.
For 64-bit boards, binman would place U-Boot immediately following SPL,
even if SPL is smaller than 32 KiB. This can happen when SPL MMC support
is disabled (i.e. when booting from SPI flash).

In contrast, for 32-bit boards, binman would place U-Boot at 32 KiB,
even if SPL is larger than that. This happens because the 'offset'
property does not consider the size of previous entries.

Fix both issues by setting a minimum size for the SPL entry, which
exactly matches the logic in the SPL code. Unfortunately, this size must
be provided as a magic number, since none of the relevant config symbols
(SPL_PAD_TO, SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, and SYS_SPI_U_BOOT_OFFS)
are guaranteed to be defined in all cases.

Fixes: cfa3db602caf ("sunxi: Convert 64-bit boards to use binman")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 months agoMerge branch '2023-04-27-introduce-nvm-xip-block-storage-emulation'
Tom Rini [Thu, 27 Apr 2023 23:22:38 +0000 (19:22 -0400)]
Merge branch '2023-04-27-introduce-nvm-xip-block-storage-emulation'

To quote the author:
Adding block storage emulation for NVM XIP flash devices.

Some paltforms such as Corstone-1000 need to see NVM XIP raw flash
as a block storage device with read only capability.

Here NVM flash devices are devices with addressable
memory (e.g: QSPI NOR flash).

The NVM XIP block storage emulation provides the following features:

- Emulate NVM XIP raw flash as a block storage device with read only capability
- Being generic by design and can be used by any platform
- Device tree node
- Platforms can use multiple NVM XIP devices at the same time by defining a
  DT node for each one of them
- A generic NVMXIP block driver allowing to read from the XIP flash
- A generic NVMXIP Uclass driver for binding the block device
- A generic NVMXIP QSPI driver
- Implemented on top of memory-mapped IO (using readq macro)
- Enabling NVMXIP in sandbox64
- A sandbox test case
- Enabling NVMXIP in Corstone1000 platform as a use case

For more details please refer to doc/develop/driver-model/nvmxip.rst

20 months agosandbox64: add a test case for UCLASS_NVMXIP
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:58 +0000 (10:11 +0100)]
sandbox64: add a test case for UCLASS_NVMXIP

provide a test for NVM XIP devices

The test case allows to make sure of the following:

- The NVM XIP QSPI devices are probed
- The DT entries are read correctly
- the data read from the flash by the NVMXIP block driver is correct

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
20 months agocorstone1000: enable NVM XIP QSPI flash
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:57 +0000 (10:11 +0100)]
corstone1000: enable NVM XIP QSPI flash

add the QSPI flash device with block storage capability

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
20 months agocorstone1000: add NVM XIP QSPI device tree node
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:56 +0000 (10:11 +0100)]
corstone1000: add NVM XIP QSPI device tree node

add QSPI flash device node for block storage access

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
20 months agosandbox64: add support for NVMXIP QSPI
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:55 +0000 (10:11 +0100)]
sandbox64: add support for NVMXIP QSPI

enable NVMXIP QSPI for sandbox 64-bit

Adding two NVM XIP QSPI storage devices.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox64: fix: return unsigned long in readq()
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:54 +0000 (10:11 +0100)]
sandbox64: fix: return unsigned long in readq()

make readq return unsigned long

readq should return 64-bit data

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agodrivers/mtd/nvmxip: introduce QSPI XIP driver
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:53 +0000 (10:11 +0100)]
drivers/mtd/nvmxip: introduce QSPI XIP driver

add nvmxip_qspi driver under UCLASS_NVMXIP

The device associated with this driver is the parent of the blk#<id> device
nvmxip_qspi can be reused by other platforms. If the platform
has custom settings to apply before using the flash, then the platform
can provide its own parent driver belonging to UCLASS_NVMXIP and reuse
nvmxip-blk driver. The custom driver can be implemented like nvmxip_qspi in
addition to the platform custom settings.

Platforms can use multiple NVM XIP devices at the same time by defining a
DT node for each one of them.

For more details please refer to doc/develop/driver-model/nvmxip_qspi.rst

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
20 months agodrivers/mtd/nvmxip: introduce NVM XIP block storage emulation
Abdellatif El Khlifi [Mon, 17 Apr 2023 09:11:52 +0000 (10:11 +0100)]
drivers/mtd/nvmxip: introduce NVM XIP block storage emulation

add block storage emulation for NVM XIP flash devices

Some paltforms such as Corstone-1000 need to see NVM XIP raw flash
as a block storage device with read only capability.

Here NVM flash devices are devices with addressable
memory (e.g: QSPI NOR flash).

The implementation is generic and can be used by different platforms.

Two drivers are provided as follows.

  nvmxip-blk :

    a generic block driver allowing to read from the XIP flash

  nvmxip Uclass driver :

        When a device is described in the DT and associated with
        UCLASS_NVMXIP, the Uclass creates a block device and binds it with
 the nvmxip-blk.

Platforms can use multiple NVM XIP devices at the same time by defining a
DT node for each one of them.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
20 months agoMerge branch '2023-04-27-IDE-code-cleanups'
Tom Rini [Thu, 27 Apr 2023 20:33:58 +0000 (16:33 -0400)]
Merge branch '2023-04-27-IDE-code-cleanups'

To quote the author:
This code was converted to driver model a long time again but it was a
pretty rough conversion. It introduced a few minor bugs, e.g. the device
capacity is incorrect and some flags are lost (such as lba48).

This series tidies up the code and fixes these bugs. This involves quite
a bit of refactoring, so it is done one patch at a time for easier
review.

20 months agoide: Make use of U-Boot types
Simon Glass [Tue, 25 Apr 2023 16:54:55 +0000 (10:54 -0600)]
ide: Make use of U-Boot types

Use standard U-Boot types in the file to make the code less verbose.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Simplify expressions and hex values
Simon Glass [Tue, 25 Apr 2023 16:54:54 +0000 (10:54 -0600)]
ide: Simplify expressions and hex values

The code has quite a few unnecessary brackets and comparisons to zero,
etc. Fix these up as well as some upper-case hex values and use of 0x in
printf() strings.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Convert to use log_debug()
Simon Glass [Tue, 25 Apr 2023 16:54:53 +0000 (10:54 -0600)]
ide: Convert to use log_debug()

Avoid the use of the function name in a few of the debug() calls, since
this causes a checkpatch warning. Convert all other calls too.

Use lower-case hex consistently.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Tidy up ide_reset()
Simon Glass [Tue, 25 Apr 2023 16:54:52 +0000 (10:54 -0600)]
ide: Tidy up ide_reset()

Avoid using #ifdef and use a single function declaration, so it is easier
to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Correct LBA setting
Simon Glass [Tue, 25 Apr 2023 16:54:51 +0000 (10:54 -0600)]
ide: Correct LBA setting

Fix a longstanding bug where the LBA is calculated as the size of the
media instead of the number of blocks. This was perhaps not noticed
earlier since it prints the correct value first, before setting the wrong
value.

Drop the unnecessary blksz variable while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
20 months agoide: Use a single local blk_desc for ide_ident()
Simon Glass [Tue, 25 Apr 2023 16:54:50 +0000 (10:54 -0600)]
ide: Use a single local blk_desc for ide_ident()

We only use one member of the ide_dev_desc[] array at a time and it does
not stick around outside ide_probe(). Use a single element instead.

Copy over the missing members of blk_desc at the same, since this was
missing from the previous code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 68e6f221ed0 ("block: ide: Fix block read/write with driver model")
20 months agoide: Move all blk_desc init into ide_ident()
Simon Glass [Tue, 25 Apr 2023 16:54:49 +0000 (10:54 -0600)]
ide: Move all blk_desc init into ide_ident()

Rather than having the caller fill some of this in, do it all in the
ide_ident() function, since it knows all the values.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Make ide_ident() return an error code
Simon Glass [Tue, 25 Apr 2023 16:54:48 +0000 (10:54 -0600)]
ide: Make ide_ident() return an error code

Update ide_ident() to indicate whether it finds a device or not. Use
that to decide whether to create a block device for it, rather than
looking DEV_TYPE_UNKNOWN.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Use desc consistently for struct blk_desc
Simon Glass [Tue, 25 Apr 2023 16:54:47 +0000 (10:54 -0600)]
ide: Use desc consistently for struct blk_desc

Most of the code uses 'desc' as the variable name for a blk descriptor.
Change ide to do the same.

Tidy up some extra brackets and types while we are here.

Leave the code in ide_probe() alone since it is about to be refactored.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Combine the two loops in ide_probe()
Simon Glass [Tue, 25 Apr 2023 16:54:46 +0000 (10:54 -0600)]
ide: Combine the two loops in ide_probe()

The two loops in this function operate on the same ide_dev_desc[] array.
Combine them to reduce duplication.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move ide_init() entirely within ide_probe()
Simon Glass [Tue, 25 Apr 2023 16:54:45 +0000 (10:54 -0600)]
ide: Move ide_init() entirely within ide_probe()

Now that ide_probe() is the only caller of ide_init(), move all the code
into the probe function, so it is easier to refactor it.

Move ide_dev_desc[] into ide_probe() to, since it is the only user.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move setting of vendor strings into ide_probe()
Simon Glass [Tue, 25 Apr 2023 16:54:44 +0000 (10:54 -0600)]
ide: Move setting of vendor strings into ide_probe()

The current implementation adds this information in the block device's
probe() function, which is called in the blk_probe_or_unbind() in
ide_probe().

It is simpler to do this in ide_probe() itself, since the effect is the
same. This helps to consolidate use of ide_dev_desc[] which we would like
to remove.

Use strlcpy() to keep checkpatch happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Make ide_bus_ok a local variable
Simon Glass [Tue, 25 Apr 2023 16:54:43 +0000 (10:54 -0600)]
ide: Make ide_bus_ok a local variable

This is only used in one place now, so make it a local variable.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move bus init into a function
Simon Glass [Tue, 25 Apr 2023 16:54:42 +0000 (10:54 -0600)]
ide: Move bus init into a function

Move this code into a separate function which returns whether the bus was
found, or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Avoid preprocessor for CONFIG_LBA48
Simon Glass [Tue, 25 Apr 2023 16:54:41 +0000 (10:54 -0600)]
ide: Avoid preprocessor for CONFIG_LBA48

Use IS_ENABLED() instead for all conditions. Add the 'lba48' flag into
struct blk_desc always, since it uses very little space. Use a bool so
the meaning is clearer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
20 months agoide: Avoid preprocessor for CONFIG_ATAPI
Simon Glass [Tue, 25 Apr 2023 16:54:40 +0000 (10:54 -0600)]
ide: Avoid preprocessor for CONFIG_ATAPI

Use IS_ENABLED() instead for all conditions.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Simplify success condition
Simon Glass [Tue, 25 Apr 2023 16:54:39 +0000 (10:54 -0600)]
ide: Simplify success condition

Change the if() to remove extra brackets and check for the positive case
first, i.e. when a device is found. Exit the loop in that case, with the
retry logic in the 'else' part.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Refactor confusing loop code
Simon Glass [Tue, 25 Apr 2023 16:54:38 +0000 (10:54 -0600)]
ide: Refactor confusing loop code

This code is hard to follow as it uses #ifdef in a strange way. Adjust
it to avoid the preprocessor. Drop the special return for the non-ATAPI
case since we can rely on tries becoming 0 and exiting the loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Change the retries variable
Simon Glass [Tue, 25 Apr 2023 16:54:37 +0000 (10:54 -0600)]
ide: Change the retries variable

Use a 'tries' variable which starts at the number of tries we want to do,
rather than a 'retries' one that stops at either 1 or 2. This will make it
easier to refactor the code to avoid the horrible #ifdefs

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Make function static
Simon Glass [Tue, 25 Apr 2023 16:54:36 +0000 (10:54 -0600)]
ide: Make function static

Only one function is called from outside this file. Make all the others
static.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Correct use of ATAPI
Simon Glass [Tue, 25 Apr 2023 16:54:35 +0000 (10:54 -0600)]
ide: Correct use of ATAPI

The use of atapi_read() was incorrect dropped. Fix this so that it will
be used when needed. Use a udevice for the first argument of atapi_read()
so it is consistent with ide_read().

This requires much of the ATAPI code to be brought out from behind the
existing #ifdef. It will still be removed by the compiler if it is not
needed.

Add an atapi flag to struct blk_desc so the information can be retained.

Fixes: 145df842b44 ("dm: ide: Add support for driver-model block devices")
Fixes: d0075059e4d ("ide: Drop non-DM code for BLK")
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Create a prototype for ide_set_reset()
Simon Glass [Tue, 25 Apr 2023 16:54:34 +0000 (10:54 -0600)]
ide: Create a prototype for ide_set_reset()

This is used by a board so should be in the header file. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Drop weak functions
Simon Glass [Tue, 25 Apr 2023 16:54:33 +0000 (10:54 -0600)]
ide: Drop weak functions

These are not used from outside this file anymore. Make them static and
remove them from the header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move a few functions further up the file
Simon Glass [Tue, 25 Apr 2023 16:54:32 +0000 (10:54 -0600)]
ide: Move a few functions further up the file

Move these functions so they appear before they are used.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Drop ide_device_present()
Simon Glass [Tue, 25 Apr 2023 16:54:31 +0000 (10:54 -0600)]
ide: Drop ide_device_present()

This function is not used anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move ide_init() into probing
Simon Glass [Tue, 25 Apr 2023 16:54:30 +0000 (10:54 -0600)]
ide: Move ide_init() into probing

At present the code does ide_init() as a separate operation, then calls
device_probe() to copy over the information. We can call ide_init() from
probe just as easily.

The only difference is that using 'ide init' twice will do nothing.
However it already fails to copy over the new data in that case, so the
effect is the same. For now, unbind the block devices and remove the IDE
device, which causes the bus to be probed again. Later patches will fix
this up fully, so that all blk_desc data is copied across.

Since ide_reset() is only called from ide_init(), there is no need to init
the ide_dev_desc[] array. This is already done at the end of ide_init() so
drop this code.

The call to uclass_first_device() is now within the probe() function of
the same device, so does nothing. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Drop init for not using BLK
Simon Glass [Tue, 25 Apr 2023 16:54:29 +0000 (10:54 -0600)]
ide: Drop init for not using BLK

ALl boards use CONFIG_BLK now so this code is not used. Drop it and the
header-file #ifdef

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Drop CONFIG_START_IDE
Simon Glass [Tue, 25 Apr 2023 16:54:28 +0000 (10:54 -0600)]
ide: Drop CONFIG_START_IDE

This is not used by any board. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Use mdelay() for long delays
Simon Glass [Tue, 25 Apr 2023 16:54:27 +0000 (10:54 -0600)]
ide: Use mdelay() for long delays

Rather than using very large numbers with udelay(), use mdelay(), which
is easier to follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoide: Move ATA_CURR_BASE to C file
Simon Glass [Tue, 25 Apr 2023 16:54:26 +0000 (10:54 -0600)]
ide: Move ATA_CURR_BASE to C file

This is not used outside one C file. Move it out of the header to
reduce its visbility.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoMerge branch '2023-04-26-enable-bootstd-for-all-rockchip'
Tom Rini [Wed, 26 Apr 2023 17:29:49 +0000 (13:29 -0400)]
Merge branch '2023-04-26-enable-bootstd-for-all-rockchip'

- Merge Simon's series that enables bootstd and the distro bootmeth
  there for all of Rockchip.

20 months agorockchip: Use the same boot_targets for all boards
Simon Glass [Mon, 24 Apr 2023 01:49:52 +0000 (13:49 +1200)]
rockchip: Use the same boot_targets for all boards

It doesn't really matter if we mention things which are not present. For
example, if 'nvme' is included but the board does not support it, it just
continues with the next item in the list.

It is simpler to use the same target list for all boards, so drop the
different one for rk3399.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agorockchip: Move to standard boot
Simon Glass [Mon, 24 Apr 2023 01:49:51 +0000 (13:49 +1200)]
rockchip: Move to standard boot

Drop the distro-boot scripts and use standard boot instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Jonas Karlman <jonas@kwiboo.se>
20 months agobootstd: Use blk uclass device numbers to set efi bootdev
Mathew McBride [Mon, 24 Apr 2023 01:49:50 +0000 (13:49 +1200)]
bootstd: Use blk uclass device numbers to set efi bootdev

When loading a file from a block device, efiload_read_file
was using the seq_num of the device (e.g "35" of virtio_blk#35)
instead of the block device id (e.g what you get from running
the corresponding device scan command, like "virtio 0")

This cause EFI booting from these devices to fail as an
invalid device number is passed to blk_get_device_part_str:

  Scanning bootdev 'virtio-blk#35.bootdev':
  distro_efi_read_bootflow_file start (efi,fname=<NULL>)
  distro_efi_read_bootflow_file start (efi,fname=<NULL>)
  setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800
  efi_dp_from_name calling blk_get_device_part_str
  dev=virtio devnr=35 path=efi/boot/bootaa64.efi
  blk_get_device_part_str (virtio,35)
  blk_get_device_by_str (virtio, 35)
  ** Bad device specification virtio 35 **
  Using default device tree: dtb/qemu-arm.dtb
  No device tree available
  0  efi          ready   virtio       1  virtio-blk#35.bootdev.par efi/boot/bootaa64.efi
  ** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi
  blk_get_device_part_str (virtio,0:1)
  blk_get_device_by_str (virtio, 0)
  No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000)
  Boot failed (err=-22)

Signed-off-by: Mathew McBride <matt@traverse.com.au>
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agobootstd: Adjust code ordering to work around compiler quirk
Simon Glass [Mon, 24 Apr 2023 01:49:49 +0000 (13:49 +1200)]
bootstd: Adjust code ordering to work around compiler quirk

At present when debugging is off, bootdev_find_in_blk() sometimes fails
to find a valid bootflow, e.g. with virtio. Accessing the 'blk' variable
later in the function seems to correct it.

Move the 'ret' check before the debug statement and set the block device
again aftewards, to work around this.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agobootstd: Show a message sometimes if no bootflows are found
Simon Glass [Mon, 24 Apr 2023 01:49:48 +0000 (13:49 +1200)]
bootstd: Show a message sometimes if no bootflows are found

Enable some messages that might provide hints, but only for
CMD_BOOTFLOW_FULL since otherwise the -l flag is not available.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
20 months agobootstd: Report missing labels only when asked
Simon Glass [Mon, 24 Apr 2023 01:49:47 +0000 (13:49 +1200)]
bootstd: Report missing labels only when asked

Use the -l flag to indicate whether to report missing uclasses.

Also try to be more helpful when no devices are found. For example, when
we see something 'scsi0' requested and nothing was found, this indicates
that there are no SCSI devices, so show a suitable message.

Move messages out of the low-level functions so that silent operation
is possible.

This means they are never reported unless BOOTSTD_FULL is enabled, since
the -l flag cannot otherwise be set.

Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agobootstd: Support booting EFI where multiple options exist
Simon Glass [Mon, 24 Apr 2023 01:49:46 +0000 (13:49 +1200)]
bootstd: Support booting EFI where multiple options exist

The current EFI implementation has a strange quirk where it watches
loaded files and uses the last-loaded file to determine the device that
is being booted from.

This is confusing with bootstd, where multiple options may exist. Even
loading a device tree will cause it to go wrong. There is no API for
passing this information, since the only entry into booting an EFI image
is the 'bootefi' command.

To work around this, call efi_set_bootdev() for EFI images, if possible,
just before booting.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agovirtio: Ensure PCI is set up first
Simon Glass [Mon, 24 Apr 2023 01:49:45 +0000 (13:49 +1200)]
virtio: Ensure PCI is set up first

Sometimes virtio may rely on PCI, or at least that is what the
distro_bootcmd script suggests. Add this in.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agobootstd: Tweak bootflow logic for device tree
Simon Glass [Mon, 24 Apr 2023 01:49:44 +0000 (13:49 +1200)]
bootstd: Tweak bootflow logic for device tree

We should only store the FDT filename if we were able to determine one.
Adjust the logic for this.

This corrects the case where no FDT is needed to boot, such as with EFI
using ACPI.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoMerge branch '2023-04-25-assorted-updates-and-fixes'
Tom Rini [Wed, 26 Apr 2023 12:24:34 +0000 (08:24 -0400)]
Merge branch '2023-04-25-assorted-updates-and-fixes'

- A few TI, mpc8379erdb and vexpress64 updates, some arm64 core updates,
  test cleanups, Xen cleanups, assorted code and Kconfig cleanups (many
  in preparation for using clang on ARM), psci pre-reloc fixes, enable
  PCI bus mastering for ATA devices, and a gpio-uclass bugfix

20 months agogpio-uclass: fix off-by-one in gpio_request_list_by_name_nodev()
Rasmus Villemoes [Wed, 19 Apr 2023 10:10:13 +0000 (12:10 +0200)]
gpio-uclass: fix off-by-one in gpio_request_list_by_name_nodev()

By the time we jump to the err label, count represents the number of
gpios we've successfully requested. So by subtracting one, we fail to
free the most recently requested.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoxen: Limit execution to EL1 only
Michal Simek [Tue, 18 Apr 2023 12:51:56 +0000 (14:51 +0200)]
xen: Limit execution to EL1 only

Xen core_init() is calling HVC which should be called from EL1 level that's
why do Xen initialization only when U-Boot runs in EL1.

Signed-off-by: Michal Simek <michal.simek@amd.com>