platform/kernel/u-boot.git
2 years agoMerge branch '2021-07-24-arm-and-platform-updates'
Tom Rini [Sat, 24 Jul 2021 20:38:09 +0000 (16:38 -0400)]
Merge branch '2021-07-24-arm-and-platform-updates'

- dragonboard410c, synquacer, aspeed fixes / updates
- pl011 serial driver fixes
- Two generic arm bugfixes

2 years agoserial: pl011: Enable DEBUG_UART_PL011 in SPL
Chen Baozi [Wed, 21 Jul 2021 06:11:26 +0000 (14:11 +0800)]
serial: pl011: Enable DEBUG_UART_PL011 in SPL

Commit b81406db51a6 ("arm: serial: Add debug UART capability to the
pl01x driver") add supports to use pl01x as a debug UART. However,
due to CONFIG_IS_ENABLED macro requires CONFIG_SPL_* prefix, the
_debug_uart_init() would not choose TYPE_PL011 in SPL build. This
patch fixes the bug by judging CONFIG_DEBUG_UART_PL011 explicitly.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoreset: ast2600: Fix missing reference operator
Chia-Wei Wang [Tue, 20 Jul 2021 07:01:36 +0000 (15:01 +0800)]
reset: ast2600: Fix missing reference operator

Fix missing reference operator '&' to correctly get
HW register addresses for writel().

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2 years agoserial: pl011: Resend the character if FIFO is full in debug uart
Chen Baozi [Mon, 19 Jul 2021 07:36:04 +0000 (15:36 +0800)]
serial: pl011: Resend the character if FIFO is full in debug uart

pl01x_putc() might return -EAGAIN if there was no space in FIFO. In that
case, high-level caller should wait until there is space and resend the
character.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommand: Fix SMC and HVC maximum number of arguments
Siew Chin Lim [Thu, 15 Jul 2021 04:38:54 +0000 (12:38 +0800)]
command: Fix SMC and HVC maximum number of arguments

smc and hvc commands take upto 8 user input arguments, the maximum
number of arguments of the U_BOOT_CMD macro should set to 9.

Besides, fix the typo (arg7 -> arg6) in hvc command's help message.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoarmv8: Initialize CNTFRQ if at highest exception level
Peter Hoyes [Mon, 12 Jul 2021 14:04:21 +0000 (15:04 +0100)]
armv8: Initialize CNTFRQ if at highest exception level

CNTFRQ_EL0 is only writable from the highest supported exception
level on the platform. For Armv8-A, this is typically EL3, but
technically EL2 and EL3 are optional so it may need to be
initialized at EL2 or EL1. For Armv8-R, the highest exception
level is always EL2.

This patch moves the initialization outside of the switch_el
block and uses a new macro branch_if_not_highest_el which
dynamically detects whether it is at the highest supported
exception level.

Linux's docs state that CNTFRQ_EL0 should be initialized by the
bootloader. If not set, the the U-Boot prompt countdown hangs.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
2 years agoserial: serial_msm: Delay initialization to let pins stabilize
Stephan Gerhold [Wed, 14 Jul 2021 08:56:26 +0000 (10:56 +0200)]
serial: serial_msm: Delay initialization to let pins stabilize

For some reason, the DragonBoard 410c aborts autoboot immediately if
U-Boot is started without LK. It looks like it picks up a single broken
character via serial and therefore believes a key was pressed to abort
autoboot.

After some debugging, it seems like adding some delay after pinctrl
setup but before UART initialization fixes the issue. It's also worth
mentioning that unlike when booting from LK, the pinctrl setup is
actually necessary when booting U-Boot without LK since UART is broken
if the pinctrl line is removed.

I suspect that reconfiguring the pins might take some time to stabilize
and if the UART controller is enabled too quickly it will pick up some
random noise. Adding a few milliseconds of delay fixes the issue and
shouldn't have any other negative side effects.

3ms seems to be the minimum delay required in my tests, use 5ms instead
just to be sure.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2 years agoboard: dragonboard410c: Fix fastboot
Stephan Gerhold [Wed, 14 Jul 2021 08:56:25 +0000 (10:56 +0200)]
board: dragonboard410c: Fix fastboot

At the moment pressing the volume down key does not actually launch
fastboot. This is because setting "bootdelay" to "-1" actually
disables autoboot and drops to the U-Boot console. It does not execute
the "bootcmd".

The correct value for "bootdelay" here would be "-2", which disables
the delay and key checking and would immediately execute the "bootcmd".

However, even better in this case is using "preboot" to trigger Fastboot.
The advantage is that running "fastboot continue" will actually continue
the autoboot process instead of ending up in the U-Boot shell.

Also make sure to unset "preboot" again immediately in case the user
saves the environment after triggering fastboot.

Cc: Ramon Fried <rfried.dev@gmail.com>
Fixes: aa043ee91a47 ("db410c: automatically launch fastboot")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoboard: dragonboard410c: Fix PHYS_SDRAM_1_SIZE
Stephan Gerhold [Wed, 14 Jul 2021 08:56:24 +0000 (10:56 +0200)]
board: dragonboard410c: Fix PHYS_SDRAM_1_SIZE

The DragonBoard 410c has proprietary firmware from Qualcomm that
reserves 8 MiB of memory for tz/smem/hyp/rmtfs/rfsa from 0x86000000
to 0x86800000. I'm not aware of any ATF (ARM Trusted Firmware) port
for DB410c that would reserve 30 MiB of memory at the end of RAM.
I suspect the comment might have been copied from hikey.h which has
a very similar comment (and which actually does have an ATF port).

Reducing the memory size just prevents U-Boot from using the end of
the RAM, not the reserved region inbetween. Therefore we might as well
display the correct DRAM size (1 GiB) instead of strange 986 MiB.

Fixes: 626f048bbc14 ("board: Add Qualcomm Dragonboard 410C support")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoboard: dragonboard410c: Load U-Boot directly without LK
Stephan Gerhold [Wed, 7 Jul 2021 09:06:02 +0000 (11:06 +0200)]
board: dragonboard410c: Load U-Boot directly without LK

At the moment the U-Boot port for the DragonBoard 410c is designed
to be loaded as an Android boot image after Qualcomm's Little Kernel (LK)
bootloader. This is simple to set up but LK is redundant in this case,
since everything done by LK can be also done directly by U-Boot.

Dropping LK entirely has at least the following advantages:
  - Easier installation/board code (no need for Android boot images)
  - (Slightly) faster boot
  - Boot directly in 64-bit without a round trip to 32-bit for LK

So far this was not possible yet because of unsolved problems:

  1. Signing tool: The firmware expects a "signed" ELF image with extra
     (Qualcomm-specific) ELF headers, usually used for secure boot.
     The DragonBoard 410c does not have secure boot by default but the
     extra ELF headers are still required.

  2. PSCI bug: There seems to be a bug in the PSCI implementation
     (part of the TrustZone/tz firmware) that causes all other CPU cores
     to be started in 32-bit mode if LK is missing in the boot chain.
     This causes Linux to hang early during boot.

There is a solution for both problems now:

  1. qtestsign (https://github.com/msm8916-mainline/qtestsign)
     can be used as a "signing" tool for U-Boot and other firmware.

  2. A workaround for the "PSCI bug" is to execute the TZ syscall when
     entering U-Boot. That way PSCI is made aware of the 64-bit switch
     and starts all other CPU cores in 64-bit mode as well.

Simplify the dragonboard410c board by removing all the extra code that
is only used to build an Android boot image that can be loaded by LK.
This allows dropping the custom linker script, special image magic,
as well as most of the special build/installation instructions.

CONFIG_REMAKE_ELF is used to build a new ELF image that has both U-Boot
and the appended DTB combined. The resulting u-boot.elf can then be
passed to the "signing" tool (e.g. qtestsign).

The PSCI workaround is placed in the "boot0" hook that is enabled
with CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK. The extra check for EL1 allows
compatibility with custom firmware that enters U-Boot in EL2 or EL3,
e.g. qhypstub (https://github.com/msm8916-mainline/qhypstub).

As a first step these changes apply only to DragonBoard410c.
Similar changes could likely also work for the DragonBoard 820c.

Note that removing LK wouldn't be possible that easily without a lot of
work already done three years ago by Ramon Fried. A lot of missing
initialization, pinctrl etc was already added back then even though
it was not strictly needed yet.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2 years agoconfigs: synquacer: Ignore OsIndications on DeveloperBox
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:49 +0000 (19:36 +0900)]
configs: synquacer: Ignore OsIndications on DeveloperBox

Since we can not set OsIndications from Runtime Services
SetVariables at this moment, it is better to ignore the
OsIndications if there is any capsule file in the
correct place.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoconfigs: synquacer: Use RAW capsule image instead of FIT
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:39 +0000 (19:36 +0900)]
configs: synquacer: Use RAW capsule image instead of FIT

Since the recent commit;

 commit b891ff18f899 ("efi_loader: Force a single FMP instance per hardware store")

forces a single FMP instances for a storage, we can not
enable both RAW and FIT capsule image support at once.
Since RAW capsule image support is simpler than FIT,
enable RAW capsule image instead of FIT by default.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoconfigs: synquacer: Enable UEFI secure boot
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:30 +0000 (19:36 +0900)]
configs: synquacer: Enable UEFI secure boot

Enable UEFI secure boot on synquacer. Note that unless user
setup their keys, the secure boot will not work.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoconfigs: synquacer: Drop Ext2/4 support by default
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:21 +0000 (19:36 +0900)]
configs: synquacer: Drop Ext2/4 support by default

Since the U-Boot for the SynQuacer DeveloperBox is designed for
compatible with EDK2 boot, we don't need to support Ext2/4 fs
support by default. Drop it.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoconfigs: synquacer: Remove mtdparts settings and update DFU setting
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:12 +0000 (19:36 +0900)]
configs: synquacer: Remove mtdparts settings and update DFU setting

Since MTD partitions are based on the devicetree name,
remove unneeded mtdparts settings and update DFU setting.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agodts: synquacer: Add partition information to the spi-nor
Masami Hiramatsu [Mon, 12 Jul 2021 10:36:03 +0000 (19:36 +0900)]
dts: synquacer: Add partition information to the spi-nor

Add partition information to the spi-nor flash.
This is required for accessing NOR flash via mtdparts.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
2 years agoconfigs: synquacer: Make U-Boot binary position independent
Masami Hiramatsu [Mon, 12 Jul 2021 10:35:54 +0000 (19:35 +0900)]
configs: synquacer: Make U-Boot binary position independent

Make the U-Boot binary for SynQuacer position independent so
that the previous bootloader (SCP firmware or BL2) can load
the U-Boot anywhere.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoboard: synquacer: Initialize SCBM SMMU at board_init()
Masami Hiramatsu [Mon, 12 Jul 2021 10:35:44 +0000 (19:35 +0900)]
board: synquacer: Initialize SCBM SMMU at board_init()

Since the SCBM SMMU is not only connected to the NETSEC
but also shared with the F_SDH30 (eMMC controller), that
should be initialized at board level instead of NETSEC.

Move the SMMU initialization code into board support
and call it from board_init().

Without this fix, if the NETSEC is disabled, the Linux
eMMC ADMA cause an error because SMMU is not initialized.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agoMerge branch '2021-07-23-reboot-mode-and-cryptfs-passwd-support'
Tom Rini [Fri, 23 Jul 2021 18:50:43 +0000 (14:50 -0400)]
Merge branch '2021-07-23-reboot-mode-and-cryptfs-passwd-support'

- A new driver uclass is created to handle the reboot mode control.
- Add support for libcrypt-style passwords for autoboot

2 years agotest: add first autoboot unit tests
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:40 +0000 (15:57 +0200)]
test: add first autoboot unit tests

This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: add support to fallback to plain SHA256
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:39 +0000 (15:57 +0200)]
common: add support to fallback to plain SHA256

In case crypt-based hashing is enabled this will be the default mechanism
that is used. If a user wants to have support for both, the environment
variable `bootstopusesha256` can be set to `true` to allow plain SHA256
based hashing of the password.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: add AUTOBOOT_FLUSH_STDIN option
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:38 +0000 (15:57 +0200)]
common: add AUTOBOOT_FLUSH_STDIN option

The key-sequence based unlock mechanisms are sensitive to junk symbols
that could have been sent to stdin and are still waiting to be retrieved.
Enabling this option will read all symbols off stdin before displaying the
autoboot prompt (and starting to read the password from stdin).

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: allow disabling of timeout for password entry
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:37 +0000 (15:57 +0200)]
common: allow disabling of timeout for password entry

In case a user has to enter a complicated password it is sometimes
desireable to give the user more time than the default timeout.
Enabling this feature will disable the timeout entirely in case the user
presses the <Enter> key before entering any other character.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: Rename macro appropriately
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:36 +0000 (15:57 +0200)]
common: Rename macro appropriately

While doing code-review internally this got nitpicked by 2 reviewers, so
I decided to include this here.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agocommon: integrate crypt-based passwords
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:35 +0000 (15:57 +0200)]
common: integrate crypt-based passwords

Hook into the autoboot flow as an alternative to the existing
mechanisms.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agolib: wrap crypt API to hide errno usage
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:34 +0000 (15:57 +0200)]
lib: wrap crypt API to hide errno usage

In order to prevent using the global errno, replace it with a static
version and create a wrapper function which returns the error value.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agolib: add crypt subsystem
Steffen Jaeckel [Thu, 8 Jul 2021 13:57:33 +0000 (15:57 +0200)]
lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agoreboot-mode: read the boot mode from RTC memory
Nandor Han [Thu, 10 Jun 2021 13:56:45 +0000 (16:56 +0300)]
reboot-mode: read the boot mode from RTC memory

RTC devices could provide battery-backed memory that can be used for
storing the reboot mode magic value.

Add a new reboot-mode back-end that uses RTC to store the reboot-mode
magic value. The driver also supports both endianness modes.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoreboot-mode: read the boot mode from GPIOs status
Nandor Han [Thu, 10 Jun 2021 13:56:44 +0000 (16:56 +0300)]
reboot-mode: read the boot mode from GPIOs status

A use case for controlling the boot mode is when the user wants
to control the device boot by pushing a button without needing to
go in user-space.

Add a new backed for reboot mode where GPIOs are used to control the
reboot-mode. The driver is able to scan a predefined list of GPIOs
and return the magic value. Having the modes associated with
the magic value generated based on the GPIO values, allows the
reboot mode uclass to select the proper mode.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoreboot-mode: add support for reboot mode control
Nandor Han [Thu, 10 Jun 2021 13:56:43 +0000 (16:56 +0300)]
reboot-mode: add support for reboot mode control

A new driver uclass is created to handle the reboot mode control.

The new uclass driver is updating an environment variable with the
configured reboot mode. The mode is extracted from a map provided
at initialization time. The map contains a list of modes
and associated ids.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch '2021-07-23-assorted-fixes'
Tom Rini [Fri, 23 Jul 2021 12:30:48 +0000 (08:30 -0400)]
Merge branch '2021-07-23-assorted-fixes'

- Assorted FIT, optee, pcf8575, mux, vexpress64 and distro bootcmd fixes.
- Allow pinmux status to take pin names

2 years agonet: remove CONFIG_NET_MULTI (again)
Michal Simek [Wed, 14 Jul 2021 07:12:41 +0000 (09:12 +0200)]
net: remove CONFIG_NET_MULTI (again)

CONFIG_NET_MULTI has been removed long time ago by commit 795428fc679f
("net: remove CONFIG_NET_MULTI") but 4 boards were added later which wasn't
found.  The patch is removing this reference from 4 boards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
2 years agomux: correct prototype for mux_control_try_select()
Patrick Wildt [Tue, 13 Jul 2021 21:02:18 +0000 (23:02 +0200)]
mux: correct prototype for mux_control_try_select()

The macro should be passed a state, which should be passed
to the actual function.  Otherwise using that macro would
yield a build error.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
2 years agoarm: vexpress64: juno: Enable distro_bootcmd functionality
Andre Przywara [Sun, 11 Jul 2021 23:25:15 +0000 (00:25 +0100)]
arm: vexpress64: juno: Enable distro_bootcmd functionality

The ARM Juno boards can be used as somewhat decent machines to run
off-the-shelf distributions, with USB, SATA, GBit Ethernet and 8GB of
DRAM.

With stable DTs in the board's NOR flash this would work really nicely,
however the default boot command is to fetch a kernel and an initrd from
the on-board NOR flash, which sounds somewhat embedded.

Include the config_distro_bootcmd.h header and define the available
devices (starting with USB, to catch USB installer sticks) to make
distributions and UEFI work out of the box.
The NOR flash kernel functionality is still preserved as the last
resort, should all other methods fail.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2 years agodistro_boot: Fix block device after DHCP boot sequence
Andre Przywara [Sun, 11 Jul 2021 23:07:09 +0000 (00:07 +0100)]
distro_boot: Fix block device after DHCP boot sequence

The generic distro boot sequence iterates over several types of devices,
trying one after another. In doing do, it starts with setting the
"devtype" variable, then uses this later in more generic commands.

Now most (block) device types use a local variable for that, but DHCP
puts the type into the environment, where it shadows any local variables.
As a consequence any boot attempt after bootcmd_dhcp has been run fails:
===========================
VExpress64# run bootcmd_dhcp
...
VExpress64# run bootcmd_sata0
SATA#0:
        (3.0 Gbps)
SATA#1:
        (No RDY)
Device 0: Model: 16GB SATA Flash Drive  ....
... is now current device
Couldn't find partition dhcp 0:1
===========================
This problem typically doesn't show, because DHCP is mostly the last
command to try, but is a problem when this order is different, or when
distro_bootcmd or bootcmd_xxx are run separately or multiple times.

Let bootcmd_dhcp use a local variable, as the other kids do, to make the
order of boot commands irrelevant, and allow repeated calls.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoKconfig.boot: Make 0x0 the default SYS_TEXT_BASE for POSITION_INDEPENDENT
Tom Rini [Fri, 9 Jul 2021 14:39:21 +0000 (10:39 -0400)]
Kconfig.boot: Make 0x0 the default SYS_TEXT_BASE for POSITION_INDEPENDENT

When we build U-Boot with POSITION_INDEPENDENT we must have
SYS_TEXT_BASE be set to zero.  Make this the default in that case.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2 years agofit: Allow external data for FDTs
John Keeping [Fri, 25 Jun 2021 16:58:04 +0000 (17:58 +0100)]
fit: Allow external data for FDTs

Switch to fit_image_get_data_and_size() for consistency with all other
data loaded from FIT.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: part: Correct error handling
Anders Dellien [Tue, 22 Jun 2021 09:40:01 +0000 (10:40 +0100)]
cmd: part: Correct error handling

As 'part_get_info_by_name' now returns more status codes than just
-1 to indicate failure, we need to update the return value check.

Signed-off-by: Anders Dellien <anders.dellien@arm.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2 years agoi2c: pcf8575: Add support for 8 bit I2C IO expanders (like pca8574)
Lukasz Majewski [Mon, 7 Jun 2021 12:26:34 +0000 (14:26 +0200)]
i2c: pcf8575: Add support for 8 bit I2C IO expanders (like pca8574)

This patch add support for using NXP's pca8574 I2C IO expander, which
has only 8 IO lines.

After this change the .data member's information from struct udevice_id
are used to either sent one or two bytes.

Moreover, the '_le16' suffix from pcf8575_i2c_{write|read}_le16()
functions have been removed as now we also sent 8 bit data.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agoi2c: pcf8575: Remove not used members of pcf8575_chip structure
Lukasz Majewski [Mon, 7 Jun 2021 12:26:33 +0000 (14:26 +0200)]
i2c: pcf8575: Remove not used members of pcf8575_chip structure

Those members are not used anymore as ones from gpio_dev_priv
structure (when DM_GPIO support is enabled) are used instead.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
2 years agocmd: pinmux: support pin name in status command
Patrick Delaunay [Fri, 21 May 2021 07:47:32 +0000 (09:47 +0200)]
cmd: pinmux: support pin name in status command

Allow pin name parameter for pimux staus command,
as gpio command to get status of one pin.

The possible usage of the command is:

> pinmux dev pinctrl
> pinmux status

> pinmux status -a

> pinmux status <pin-name>

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocmd: pinmux: update result of do_status
Patrick Delaunay [Fri, 21 May 2021 07:47:31 +0000 (09:47 +0200)]
cmd: pinmux: update result of do_status

Update the result of do_status and always returns a CMD_RET_ value
(-ENOSYS was a possible result of show_pinmux).

This patch also adds pincontrol name in error messages (dev->name)
and treats correctly the status sub command when pin-controller device is
not selected.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotee: optee: sync cache on pre-reloc OP-TEE invocation
Etienne Carriere [Wed, 19 May 2021 14:27:41 +0000 (16:27 +0200)]
tee: optee: sync cache on pre-reloc OP-TEE invocation

This change ensures both U-Boot and OP-TEE see the same content
from shared memory when OP-TEE is invoked prior U-Boot relocation.

This change is required since U-Boot may execute with data cache off
while OP-TEE always enables cache on memory shared with U-Boot.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agospl: use CONFIG_IS_ENABLED(LOAD_FIT_FULL)
John Keeping [Wed, 19 May 2021 14:05:53 +0000 (15:05 +0100)]
spl: use CONFIG_IS_ENABLED(LOAD_FIT_FULL)

It's possible that LOAD_FIT_FULL will have different values for TPL and
SPL, in which case just checking CONFIG_SPL_LOAD_FIT_FULL causes this to
be compiled in to the TPL even though functions and struct members it
depends on are not.

Use CONFIG_IS_ENABLED() to ensure the correct TPL/SPL variant is
checked.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot-net
Tom Rini [Fri, 23 Jul 2021 03:05:28 +0000 (23:05 -0400)]
Merge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot-net

2 years agonet: fsl-mc: fix logically dead code
Cosmin-Florin Aluchenesei [Wed, 21 Jul 2021 16:13:33 +0000 (19:13 +0300)]
net: fsl-mc: fix logically dead code

The result of dpio_close() is actually taken into account.

Signed-off-by: Cosmin-Florin Aluchenesei <aluchenesei.cosmin-florin@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agodrivers: net: aquantia: fix unsigned compared against 0
Cosmin-Florin Aluchenesei [Wed, 21 Jul 2021 16:13:11 +0000 (19:13 +0300)]
drivers: net: aquantia: fix unsigned compared against 0

Change the reg variable to not be unsigned so that we not get into an
unsigned compared against 0.

Signed-off-by: Cosmin-Florin Aluchenesei <aluchenesei.cosmin-florin@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: define LOG_CATEGORY
Patrick Delaunay [Tue, 20 Jul 2021 18:15:30 +0000 (20:15 +0200)]
net: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc_eth_qos: define LOG_CATEGORY
Patrick Delaunay [Tue, 20 Jul 2021 18:15:29 +0000 (20:15 +0200)]
net: dwc_eth_qos: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: eth-phy: define LOG_CATEGORY
Patrick Delaunay [Tue, 20 Jul 2021 18:15:28 +0000 (20:15 +0200)]
net: eth-phy: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc: add a common empty ops eqos_null_ops
Patrick Delaunay [Tue, 20 Jul 2021 18:09:56 +0000 (20:09 +0200)]
net: dwc: add a common empty ops eqos_null_ops

Add a common empty ops: eqos_null_ops() to remove the duplicated empty
functions and reduce the driver size for stm32 and imx config.

This patch also aligns the prototype of ops 'eqos_stop_clks' with other
eqos ops by adding return value.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agonet: dwc_eth_qos: use generic ethernet phy for stm32 variant
Patrick Delaunay [Tue, 20 Jul 2021 18:09:55 +0000 (20:09 +0200)]
net: dwc_eth_qos: use generic ethernet phy for stm32 variant

Use the generic ethernet phy which already manages the correct binding
for gpio reset, including the assert an deassert delays.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agonet: dwc_eth_qos: remove the field phyaddr of the struct eqos_priv
Patrick Delaunay [Tue, 20 Jul 2021 18:09:54 +0000 (20:09 +0200)]
net: dwc_eth_qos: remove the field phyaddr of the struct eqos_priv

Since the commit commit 6a895d039ba7 ("net: Update eQos driver and FEC
driver to use eth phy interfaces") the field phyaddr of driver private data
struct eqos_priv is no more used in eqos_start() for the phy_connect()
parameter.

Now this variable is only initialized in eqos_probe_resources_stm32()
it can be removed.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agonet: eth-phy: manage subnode mdio0
Patrick Delaunay [Tue, 20 Jul 2021 18:09:53 +0000 (20:09 +0200)]
net: eth-phy: manage subnode mdio0

Bind any subnode with name beginning by mdio, mdio0 for example,
and not only the "mdio" as namei of subnode.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agonet: eth-phy: use dev_dbg and log_notice
Patrick Delaunay [Tue, 20 Jul 2021 18:09:52 +0000 (20:09 +0200)]
net: eth-phy: use dev_dbg and log_notice

Replace debug trace and printf to log macros:
- debug() replaced by dev_dbg() when device is available, this macro
indicate the device name since commit ceb70bb870ac ("dm: Print device
name in dev_xxx like Linux")
- printf() replaced by log_notice() to allow  dispatch to log backends.

Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agonet: eth-phy: add support of device tree configuration for gpio reset
Patrick Delaunay [Tue, 20 Jul 2021 18:09:51 +0000 (20:09 +0200)]
net: eth-phy: add support of device tree configuration for gpio reset

The gpio reset and the assert or deassert delay are defined in generic
binding of the ethernet phy in Linux:
Documentation/devicetree/bindings/net/ethernet-phy.yaml

  reset-gpios:
    maxItems: 1
    description:
      The GPIO phandle and specifier for the PHY reset signal.

  reset-assert-us:
    description:
      Delay after the reset was asserted in microseconds. If this
      property is missing the delay will be skipped.

  reset-deassert-us:
    description:
      Delay after the reset was deasserted in microseconds. If
      this property is missing the delay will be skipped.

See also U-Boot: doc/device-tree-bindings/net/phy.txt

This patch adds the parsing of this common DT properties in the
u-class "eth_phy_generic", used by default in the associated driver
"eth_phy_generic_drv"

This parsing function eth_phy_of_to_plat can be reused by other
ethernet phy drivers for this uclass UCLASS_ETH_PHY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: Use phys_addr_t for SMC net device addresses
Peter Hoyes [Fri, 9 Jul 2021 09:52:06 +0000 (10:52 +0100)]
net: Use phys_addr_t for SMC net device addresses

Use same type as eth_device->iobase and support addresses greater
than INT_MAX.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 22 Jul 2021 15:15:52 +0000 (11:15 -0400)]
Merge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

dtoc improvements to show better warnings
minor test build fixes
sandbox fixes for SDL2 and running TPL
bloblist resize feature
binman multithreading

2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Thu, 22 Jul 2021 12:45:32 +0000 (08:45 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

fsl-qoriq: Update mc firmware size, address in LS1088A, LS2088A, LX2
Updates on ls1043aqds, ls1043ardb
Refactor I2C MUX Code on fsl-qoriq platforms.

2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 22 Jul 2021 02:46:18 +0000 (22:46 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

2 years agodm: core: fix no null pointer detection in ofnode_get_addr_size_index()
Chen Guanqiao [Mon, 12 Jul 2021 07:40:20 +0000 (15:40 +0800)]
dm: core: fix no null pointer detection in ofnode_get_addr_size_index()

Fixed a defect of a null pointer being discovered by Coverity Scan:
   CID 331544:  Null pointer dereferences  (REVERSE_INULL)
   Null-checking "size" suggests that it may be null, but it has already been
   dereferenced on all paths leading to the check.

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
2 years agosandbox: don't set SA_NODEFER in signal handler
Heinrich Schuchardt [Mon, 5 Jul 2021 17:43:00 +0000 (19:43 +0200)]
sandbox: don't set SA_NODEFER in signal handler

The sandbox can handle signals. Due to a damaged global data pointer
additional exceptions in the signal handler may occur leading to an endless
loop. In this case leave the handling of the secondary exception to the
operating system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Add basic support for debugging performance
Simon Glass [Tue, 6 Jul 2021 16:36:41 +0000 (10:36 -0600)]
binman: Add basic support for debugging performance

One of binman's attributes is that it is extremely fast, at least for a
Python program. Add some simple timing around operations that might take
a while, such as reading an image and compressing it. This should help
to maintain the performance as new features are added.

This is for debugging purposes only.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agopatman: Use bytearray instead of string
Simon Glass [Tue, 6 Jul 2021 16:36:40 +0000 (10:36 -0600)]
patman: Use bytearray instead of string

If the process outputs a lot of data on stdout this can be quite slow,
since the bytestring is regenerated each time. Use a bytearray instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Use bytearray instead of string
Simon Glass [Tue, 6 Jul 2021 16:36:39 +0000 (10:36 -0600)]
binman: Use bytearray instead of string

This is faster if data is being concatenated. Update the section and
collection etypes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Split node-reading out from constructor in files
Simon Glass [Tue, 6 Jul 2021 16:36:38 +0000 (10:36 -0600)]
binman: Split node-reading out from constructor in files

The constructor should not read the node information. Move it to the
ReadNode() method instead. This allows this etype to be subclassed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobinman: Support multithreading for building images
Simon Glass [Tue, 6 Jul 2021 16:36:37 +0000 (10:36 -0600)]
binman: Support multithreading for building images

Some images may take a while to build, e.g. if they are large and use slow
compression. Support compiling sections in parallel to speed things up.

Signed-off-by: Simon Glass <sjg@chromium.org>
(fixed to use a separate test file to fix flakiness)

2 years agobinman: Put compressed data into separate files
Simon Glass [Tue, 6 Jul 2021 16:36:36 +0000 (10:36 -0600)]
binman: Put compressed data into separate files

At present compression uses the same temporary file for all invocations.
With multithreading this causes the data to become corrupted. Use a
different filename each time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agolog: Allow padding of the function name
Simon Glass [Mon, 5 Jul 2021 22:33:00 +0000 (16:33 -0600)]
log: Allow padding of the function name

At present when function names are logged, the output is a little hard to
read since every function is a different length. Add a way to pad the
names so that the log messages line up vertically. This doesn't work if
the function name is very long, but it makes a big difference in most
cases.

Use 20 characters as a default since this covers the vast majority of
functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoblk: Support iteration
Simon Glass [Mon, 5 Jul 2021 22:32:59 +0000 (16:32 -0600)]
blk: Support iteration

It is useful to be able to iterate over block devices. Typically there
are fixed and removable devices. For security reasons it is sometimes
useful to ignore removable devices since they are under user control.

Add iterators which support selecting the block-device type.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: mmc: Support fixed MMC devices
Simon Glass [Mon, 5 Jul 2021 22:32:58 +0000 (16:32 -0600)]
sandbox: mmc: Support fixed MMC devices

Add support for reading devicetree flags for MMC devices. With this we
can distinguish between fixed and removable drives. Note that this
information is only available when the device is probed, not when it is
bound, since it is read in the of_to_plat() method. This could be changed
if needed later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agospl: Provide more information on boot failure
Simon Glass [Mon, 5 Jul 2021 22:32:57 +0000 (16:32 -0600)]
spl: Provide more information on boot failure

If SPL fails to boot, try to provide an error code to indicate what is
wrong. For example, if a uclass is missing, this can return -EPFNOSUPPORT
(-96) which provides useful information.

Add a helper for accessing the image-loader name so we can drop the use
of #ifdefs in this code.

Put this feature behind a CONFIG_SHOW_ERRORS option to avoid increasing
the code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoimage: Allow @ in node names when not using signatures
Simon Glass [Mon, 5 Jul 2021 22:32:56 +0000 (16:32 -0600)]
image: Allow @ in node names when not using signatures

If signature verification is not in use we don't need to worry about
the risk of using @ in node names. Update fit_image_verify() to allow
it if the function is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Correct condition in bloblist_addrec()
Simon Glass [Mon, 5 Jul 2021 22:32:55 +0000 (16:32 -0600)]
bloblist: Correct condition in bloblist_addrec()

It is possible to add a blob that ends at the end of the bloblist, but at
present this is not supported. Fix it and add a regression test for this
case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Tidy up a few API comments
Simon Glass [Mon, 5 Jul 2021 22:32:54 +0000 (16:32 -0600)]
bloblist: Tidy up a few API comments

Some comments for struct bloblist_hdr are a bit ambiguous. Update them to
clarify the meaning more precisely. Also document bloblist_get_stats()
properly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Support resizing a blob
Simon Glass [Mon, 5 Jul 2021 22:32:53 +0000 (16:32 -0600)]
bloblist: Support resizing a blob

Sometimes a blob needs to expand, e.g. because it needs to hold more log
data. Add support for this. Note that the bloblist must have sufficient
spare space for this to work.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocros_ec: Use standard calls for recovery-request checking
Simon Glass [Mon, 5 Jul 2021 22:32:52 +0000 (16:32 -0600)]
cros_ec: Use standard calls for recovery-request checking

Rather than calling directly into the sandbox SDL code, we can use the
normal U-Boot console handling for this feature. Update the code, to make
it more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocros_ec: Support the full-size vboot context
Simon Glass [Mon, 5 Jul 2021 22:32:51 +0000 (16:32 -0600)]
cros_ec: Support the full-size vboot context

The v2 format is 64-bytes in size. Support this and drop v1 since it is
not used anymore.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocros_ec: Drop cros_ec_entering_mode()
Simon Glass [Mon, 5 Jul 2021 22:32:50 +0000 (16:32 -0600)]
cros_ec: Drop cros_ec_entering_mode()

This function is not needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocros_ec: Allow reading the battery-charge state
Simon Glass [Mon, 5 Jul 2021 22:32:49 +0000 (16:32 -0600)]
cros_ec: Allow reading the battery-charge state

Add a function to read this information from the EC. It is useful for
determining whether the battery has enough charge to boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Adjust the bloblist default address
Simon Glass [Mon, 5 Jul 2021 22:32:48 +0000 (16:32 -0600)]
sandbox: Adjust the bloblist default address

Move this down to provide more space for the bloblist.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Use hinting with the display
Simon Glass [Mon, 5 Jul 2021 22:32:47 +0000 (16:32 -0600)]
sandbox: Use hinting with the display

SDL provides a hinting feature which provides a higher-quality image
with the double-display option (-K). Enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Add work-around for SDL2 display
Simon Glass [Mon, 5 Jul 2021 22:32:46 +0000 (16:32 -0600)]
sandbox: Add work-around for SDL2 display

At present the display does not show on some machines, e.g. Ubunutu
20.04 but the reason is unknown. Add a work-around until this can be
determined.

Also include more error checking just in case.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Support executables for more phases
Simon Glass [Mon, 5 Jul 2021 22:32:45 +0000 (16:32 -0600)]
sandbox: Support executables for more phases

The SPL header has a function for obtaining the phase in capital letters,
e.g. 'SPL'. Add one for lower-case also, as used by sandbox.

Use this to generalise the sandbox logic for determining the filename of
the next sandbox executable. This can provide support for VPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Avoid a build error with SPL
Simon Glass [Mon, 5 Jul 2021 22:32:43 +0000 (16:32 -0600)]
test: Avoid a build error with SPL

At present this fails to build chromeos_sandbox due to a rebase error
in dm_test_pre_run(). Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Add DM_DMA to be disabled
Simon Glass [Mon, 5 Jul 2021 22:32:42 +0000 (16:32 -0600)]
test: Add DM_DMA to be disabled

At present if DM_DMA is disabled on a sandbox build, the build fails.
Make the test conditional.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Allow CONFIG_SPL_LOAD_FIT to be disabled
Simon Glass [Mon, 5 Jul 2021 22:32:41 +0000 (16:32 -0600)]
test: Allow CONFIG_SPL_LOAD_FIT to be disabled

At present if this is not enabled on a sandbox build, the build fails. Add
a condition to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: Support lzma in the flashmap
Simon Glass [Mon, 5 Jul 2021 22:32:40 +0000 (16:32 -0600)]
dm: Support lzma in the flashmap

Allow lzma compression as well as lz4.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Add logging for DM_SEQ_ALIAS
Simon Glass [Mon, 5 Jul 2021 22:32:39 +0000 (16:32 -0600)]
dm: core: Add logging for DM_SEQ_ALIAS

It is sometimes helpful to see which sequence is assigned to a device.
Add debugging info for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Update documentation to cover warnings in more detail
Simon Glass [Sun, 4 Jul 2021 18:19:50 +0000 (12:19 -0600)]
dtoc: Update documentation to cover warnings in more detail

When things go wrong it can be confusing to figure out what to change.
Add a few more details to the documentation.

Fix a 'make htmldocs' warning while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agodtoc: Detect drivers which do not parse correctly
Simon Glass [Sun, 4 Jul 2021 18:19:49 +0000 (12:19 -0600)]
dtoc: Detect drivers which do not parse correctly

At present if a driver is missing a uclass or compatible stirng, this
is silently ignored. This makes sense in most cases, particularly for
the compatible string, since it is not required except when the driver
is used with of-platdata.

But it is also not very helpful. When there is some sort of problem
with a driver, the missing compatible string (for example) may be the
cause.

Add a warning in this case, showing it only for drivers which are used
by the build.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agodtoc: Detect unexpected suffix on .of_match
Simon Glass [Sun, 4 Jul 2021 18:19:48 +0000 (12:19 -0600)]
dtoc: Detect unexpected suffix on .of_match

Some rockchip drivers use a suffix on the of_match line which is not
strictly valid. At present this causes the parsing to fail. Fix this
and offer a warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Add a stdout check in test_normalized_name()
Simon Glass [Sun, 4 Jul 2021 18:19:47 +0000 (12:19 -0600)]
dtoc: Add a stdout check in test_normalized_name()

This test captures output but does not always check it. Add the missing
code and drop the old comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodtoc: Correct the re_compat regular expression
Simon Glass [Sun, 4 Jul 2021 18:19:46 +0000 (12:19 -0600)]
dtoc: Correct the re_compat regular expression

This expects a . before the field name (.e.g '.compatible = ...) but
presently accepts anything at all. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agodtoc: Allow multiple warnings for a driver
Simon Glass [Sun, 4 Jul 2021 18:19:45 +0000 (12:19 -0600)]
dtoc: Allow multiple warnings for a driver

At present we show when a driver is missing but this is not always that
useful. There are various reasons why a driver may appear to be missing,
such as a parse error in the source code or a missing field in the driver
declaration.

Update the implementation to record all warnings for each driver, showing
only those which relate to drivers that are actually used. This avoids
spamming the user with warnings related to a driver for a different board.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agodtoc: Convert to use ArgumentParser
Simon Glass [Sun, 4 Jul 2021 18:19:44 +0000 (12:19 -0600)]
dtoc: Convert to use ArgumentParser

Use this parser instead of OptionParser, which is deprecated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agodtoc: Avoid using subscripts on match objects
Simon Glass [Sun, 4 Jul 2021 18:19:43 +0000 (12:19 -0600)]
dtoc: Avoid using subscripts on match objects

These are not supported before Python 3.6 so avoid them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2 years agoboard: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device in SPL
Vincent Chen [Thu, 8 Jul 2021 01:08:21 +0000 (09:08 +0800)]
board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device in SPL

Ensure USB hub, PCIe-USB bridge, and ULPI device to be reset
even if the rebooting is without power-cycling.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2 years agoboard: sifive: unmatched: refine GEMGXL initialized function in SPL
Vincent Chen [Thu, 8 Jul 2021 01:08:20 +0000 (09:08 +0800)]
board: sifive: unmatched: refine GEMGXL initialized function in SPL

Create a new function spl_reset_device_by_gpio to reset the device
whose reset pin is connected to the GPIO. Then, using this function
to initialize GEMGXL.

Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2 years agoboard: sifive: drop stuff related to unmatched revision 1
Zong Li [Tue, 20 Jul 2021 06:26:08 +0000 (14:26 +0800)]
board: sifive: drop stuff related to unmatched revision 1

This patch reverts the following commits:
 - 4b4159d0f3 ("riscv: dts: add dts for unmatched rev1")
 - ffe9a394df ("board: sifive: support spl multi-dtb on unmatched board")

We won't plan to support unmatched that the revision below 3 in u-boot,
so they can be dropped because they might be useless.

Changed in v2:
 - rebase codebase to the latest master branch

Signed-off-by: Zong Li <zong.li@sifive.com>
Suggested-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>