platform/kernel/u-boot.git
2 years agomips: octeon: cpu.c: Move bootmem init to arch_early_init_r()
Stefan Roese [Thu, 7 Apr 2022 07:11:46 +0000 (09:11 +0200)]
mips: octeon: cpu.c: Move bootmem init to arch_early_init_r()

Call octeon_bootmem_init() earlier in the boot process, so that this
bootmemory infrastructure is already initialized when e.g. the
networking support gets probed.

Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Makefile: Enable building of the newly added C files
Stefan Roese [Thu, 7 Apr 2022 07:11:45 +0000 (09:11 +0200)]
mips: octeon: Makefile: Enable building of the newly added C files

This patch adds the newly added C files to the Makefile to enable
compilation. This is done in a separate step, to not introduce build
breakage while adding the single files with potentially missing
externals.

Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Misc changes to existing C files for upcoming eth support
Stefan Roese [Thu, 7 Apr 2022 07:11:44 +0000 (09:11 +0200)]
mips: octeon: Misc changes to existing C files for upcoming eth support

This patch includes misc changes to already present Octeon MIPS C files
files, which are necessary for the upcoming ethernet support.

The changes are mostly:
- DM GPIO & I2C infrastructure
- Coding style cleanup while reworking of the code

Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-range.c
Aaron Williams [Thu, 6 May 2021 07:40:43 +0000 (09:40 +0200)]
mips: octeon: Add cvmx-range.c

Import cvmx-range.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-qlm-tables.c
Aaron Williams [Thu, 7 Apr 2022 07:11:42 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-qlm-tables.c

Import cvmx-qlm-tables.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko-internal-ports-range.c
Aaron Williams [Thu, 7 Apr 2022 07:11:41 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pko-internal-ports-range.c

Import cvmx-pko-internal-ports-range.c from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko3-resources.c
Aaron Williams [Thu, 7 Apr 2022 07:11:40 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pko3-resources.c

Import cvmx-pko3-resources.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko3-compat.c
Aaron Williams [Thu, 7 Apr 2022 07:11:39 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pko3-compat.c

Import cvmx-pko3-compat.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko3-queue.c
Aaron Williams [Thu, 6 May 2021 10:26:07 +0000 (12:26 +0200)]
mips: octeon: Add cvmx-pko3-queue.c

Import cvmx-pko3-queue.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko3.c
Aaron Williams [Thu, 7 Apr 2022 07:11:37 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pko3.c

Import cvmx-pko3.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pko.c
Aaron Williams [Thu, 7 Apr 2022 07:11:36 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pko.c

Import cvmx-pko.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pki-resources.c
Aaron Williams [Thu, 7 Apr 2022 07:11:35 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pki-resources.c

Import cvmx-pki-resources.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pki.c
Aaron Williams [Thu, 6 May 2021 06:03:04 +0000 (08:03 +0200)]
mips: octeon: Add cvmx-pki.c

Import cvmx-pki.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-ipd.c
Aaron Williams [Mon, 10 May 2021 13:15:39 +0000 (15:15 +0200)]
mips: octeon: Add cvmx-ipd.c

Import cvmx-ipd.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-ilk.c
Aaron Williams [Thu, 7 Apr 2022 07:11:32 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-ilk.c

Import cvmx-ilk.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-global-resource.c
Aaron Williams [Thu, 6 May 2021 07:17:53 +0000 (09:17 +0200)]
mips: octeon: Add cvmx-global-resource.c

Import cvmx-global-resource.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-fpa-resource.c
Aaron Williams [Mon, 10 May 2021 13:19:12 +0000 (15:19 +0200)]
mips: octeon: Add cvmx-fpa-resource.c

Import cvmx-fpa-resource.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-fpa.c
Aaron Williams [Thu, 7 Apr 2022 07:11:29 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-fpa.c

Import cvmx-fpa.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-fau-compat.c
Aaron Williams [Thu, 7 Apr 2022 07:11:28 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-fau-compat.c

Import cvmx-fau-compat.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-cmd-queue.c
Aaron Williams [Mon, 10 May 2021 11:45:15 +0000 (13:45 +0200)]
mips: octeon: Add cvmx-cmd-queue.c

Import cvmx-cmd-queue.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-agl.c
Aaron Williams [Thu, 7 Apr 2022 07:11:26 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-agl.c

Import cvmx-agl.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-xaui.c
Aaron Williams [Thu, 7 Apr 2022 07:11:25 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-xaui.c

Import cvmx-helper-xaui.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-sfp.c
Aaron Williams [Thu, 6 May 2021 09:32:54 +0000 (11:32 +0200)]
mips: octeon: Add cvmx-helper-sfp.c

Import cvmx-helper-sfp.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-sgmii.c
Aaron Williams [Thu, 7 Apr 2022 07:11:23 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-sgmii.c

Import cvmx-helper-sgmii.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-rgmii.c
Aaron Williams [Thu, 7 Apr 2022 07:11:22 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-rgmii.c

Import cvmx-helper-rgmii.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-pko3.c
Aaron Williams [Thu, 7 Apr 2022 07:11:21 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-pko3.c

Import cvmx-helper-pko3.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-pko.c
Aaron Williams [Thu, 7 Apr 2022 07:11:20 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-pko.c

Import cvmx-helper-pko.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-pki.c
Aaron Williams [Thu, 7 Apr 2022 07:11:19 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-pki.c

Import cvmx-helper-pki.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-npi.c
Aaron Williams [Thu, 7 Apr 2022 07:11:18 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-npi.c

Import cvmx-helper-npi.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-loop.c
Aaron Williams [Thu, 7 Apr 2022 07:11:17 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-loop.c

Import cvmx-helper-loop.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-ipd.c
Aaron Williams [Thu, 7 Apr 2022 07:11:16 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-ipd.c

Import cvmx-helper-ipd.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-ilk.c
Aaron Williams [Thu, 7 Apr 2022 07:11:15 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-ilk.c

Import cvmx-helper-ilk.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-fpa.c
Aaron Williams [Thu, 7 Apr 2022 07:11:14 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-fpa.c

Import cvmx-helper-fpa.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-board.c
Aaron Williams [Thu, 7 Apr 2022 07:11:13 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-board.c

Import cvmx-helper-board.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-bgx.c
Aaron Williams [Thu, 7 Apr 2022 07:11:12 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-bgx.c

Import cvmx-helper-bgx.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-helper-agl.c
Aaron Williams [Thu, 7 Apr 2022 07:11:11 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-helper-agl.c

Import cvmx-helper-agl.c from 2013 U-Boot. It will be used by the later
added drivers to support networking on the MIPS Octeon II / III
platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Misc changes to existing headers for upcoming eth support
Stefan Roese [Thu, 7 Apr 2022 07:11:10 +0000 (09:11 +0200)]
mips: octeon: Misc changes to existing headers for upcoming eth support

This patch includes misc changes to already present Octeon MIPS header
files, which are necessary for the upcoming ethernet support.

The changes are mostly:
- DM GPIO & I2C infrastructure
- Coding style cleanup while reworking the headers

Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-xcv-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:09 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-xcv-defs.h header file

Import cvmx-xcv-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-pcsxx-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:08 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-pcsxx-defs.h header file

Import cvmx-pcsxxx-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-npei-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:07 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-npei-defs.h header file

Import cvmx-npei-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-lbk-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:06 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-lbk-defs.h header file

Import cvmx-lbk-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-iob-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:05 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-iob-defs.h header file

Import cvmx-iob-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add cvmx-ilk-defs.h header file
Aaron Williams [Thu, 7 Apr 2022 07:11:04 +0000 (09:11 +0200)]
mips: octeon: Add cvmx-ilk-defs.h header file

Import cvmx-igl-defs.h header file from 2013 U-Boot. It will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agomips: octeon: Add misc cvmx-* header files
Aaron Williams [Thu, 7 Apr 2022 07:11:03 +0000 (09:11 +0200)]
mips: octeon: Add misc cvmx-* header files

Import misc cvmx-helper header files from 2013 U-Boot. They will be used
by the later added drivers to support networking on the MIPS Octeon II /
III platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2022-05-03-virtio-pci-add-and-fix-consistency-checks'
Tom Rini [Tue, 3 May 2022 22:33:46 +0000 (18:33 -0400)]
Merge branch '2022-05-03-virtio-pci-add-and-fix-consistency-checks'

To quote the author:
The virtio PCI drivers forgo a number of consistency checks,
particularly around pointer validation and bounds checking. This series
focuses on the modern driver to add those checks.

The start of the series adds and fixes some basic bounds checks. Later
patches ensure PCI addresses fall within the expected regions rather
than any arbitrary address. This is acheived by introducing range
parameters to a few of the dm_pci_* functions that allow the ranges to
be checked.

The series also adds a few new configs to allow parts of virtio and PCI
to be disabled where the features may be unused and the current
implementations don't have the needed consistencty checks.

2 years agopci: Add config for Enhanced Allocation
Andrew Scull [Thu, 21 Apr 2022 16:11:16 +0000 (16:11 +0000)]
pci: Add config for Enhanced Allocation

Add a config to control whether Enhanced Allocation is supported by the
driver.

Signed-off-by: Andrew Scull <ascull@google.com>
2 years agovirtio: pci: Make use of dm_pci_map_bar()
Andrew Scull [Thu, 21 Apr 2022 16:11:15 +0000 (16:11 +0000)]
virtio: pci: Make use of dm_pci_map_bar()

The virtio PCI capabilities describe regions of memory that should be
mapped. Map those with dm_pci_map_bar() which will ensure they are valid
PCI regions.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Check virtio configs are mapped
Andrew Scull [Thu, 21 Apr 2022 16:11:14 +0000 (16:11 +0000)]
virtio: pci: Check virtio configs are mapped

Prepare for calls to `virtio_pci_map_capability()` failing by returning
NULL on error. If this happens, later accesses to the pointers would be
unsafe so cause the probe to fail if such an error occurs.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Add mask parameter to dm_pci_map_bar()
Andrew Scull [Thu, 21 Apr 2022 16:11:13 +0000 (16:11 +0000)]
pci: Add mask parameter to dm_pci_map_bar()

Add a mask parameter to control the lookup of the PCI region from which
the mapping can be made.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Update dm_pci_bus_to_virt() parameters
Andrew Scull [Thu, 21 Apr 2022 16:11:12 +0000 (16:11 +0000)]
pci: Update dm_pci_bus_to_virt() parameters

Add mask parameter and reorder length parameter to match the other PCI
address conversion functions. Using PCI_REGION_TYPE as the mask gives
the old behaviour.

It's converted from a macro to an inline function as the length
parameter is now used twice, but should only be calculated once.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Match region flags using a mask
Andrew Scull [Thu, 21 Apr 2022 16:11:11 +0000 (16:11 +0000)]
pci: Match region flags using a mask

When converting addresses, apply a mask to the region flags during
lookup. This allows the caller to specify which flags are important and
which are not, for example to exclude system memory regions.

The behaviour of the function is changed such that they don't
preferentially search for a non-system memory region. However, system
memory regions are added after other regions in decode_regions() leading
to a similar outcome.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Map bars with offset and length
Andrew Scull [Thu, 21 Apr 2022 16:11:10 +0000 (16:11 +0000)]
pci: Map bars with offset and length

Evolve dm_pci_map_bar() to include an offset and length parameter. These
allow a portion of the memory to be mapped and range checks to be
applied.

Passing both the offset and length as zero results in the previous
behaviour and this is used to migrate the previous callers.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agotest: pci: Test PCI address conversion functions
Andrew Scull [Thu, 21 Apr 2022 16:11:09 +0000 (16:11 +0000)]
test: pci: Test PCI address conversion functions

Add tests for the functions dm_pci_bus_to_phys() and
dm_pci_phys_to_bus() which convert between PCI bus addresses and
physical addresses based on the ranges declared for the PCI controller.

The ranges of bus#1 are used for the tests, adding a translation to one
of the ranges to cover more cases.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Range check address conversions
Andrew Scull [Thu, 21 Apr 2022 16:11:08 +0000 (16:11 +0000)]
pci: Range check address conversions

When converting between PCI bus and physical addresses, include a length
parameter that can be used to check that the entire range fits within
one of the PCI regions. This prevents an address being returned that
might be only partially valid for the range it is going to be used for.

Where the range check is not wanted, passing a length of 0 will have the
same behaviour as before this change.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Check region ranges are addressable
Andrew Scull [Thu, 21 Apr 2022 16:11:07 +0000 (16:11 +0000)]
pci: Check region ranges are addressable

When parsing the `ranges` DT node, check that both extremes of the
regions are addressable without overflow. This assumption can then be
safely made when processing the regions.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agopci: Fix use of flags in dm_pci_map_bar()
Andrew Scull [Thu, 21 Apr 2022 16:11:06 +0000 (16:11 +0000)]
pci: Fix use of flags in dm_pci_map_bar()

The flags parameter of dm_pci_map_bar() is used for PCI region flags
rather than memory mapping flags. Fix the type to match that of the
region flags and stop using the regions flags as memory mapping flags.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Read entire capability into memory
Andrew Scull [Thu, 21 Apr 2022 16:11:05 +0000 (16:11 +0000)]
virtio: pci: Read entire capability into memory

Read the virtio PCI capability out of the device configuration space to
a struct rather than accessing fields directly from the configuration
space as they are needed. This both makes access to the fields easier
and avoids re-reading fields.

Re-reading fields could result in time-of-check to time-of-use problems,
should the value in the configuration space change. The range check of
the `bar` field and the later call to `dm_pci_read_bar32()` is an
example of where this could happen.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Check virtio capability is in bounds
Andrew Scull [Thu, 21 Apr 2022 16:11:04 +0000 (16:11 +0000)]
virtio: pci: Check virtio capability is in bounds

Ensure the virtio PCI capabilities are contained within the bounds of
the device's configuration space. The expected size of the capability is
passed when searching for the capability to enforce this check.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Check virtio common config size
Andrew Scull [Thu, 21 Apr 2022 16:11:03 +0000 (16:11 +0000)]
virtio: pci: Check virtio common config size

Check that the common config is at least as large as the struct it is
expected to contain. Only then is it safe to cast the pointer and be
safe from out-of-bounds accesses.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Bounds check notification writes
Andrew Scull [Thu, 21 Apr 2022 16:11:02 +0000 (16:11 +0000)]
virtio: pci: Bounds check notification writes

Make sure virtio notifications are written within their allocated
buffer.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Bounds check device config access
Andrew Scull [Thu, 21 Apr 2022 16:11:01 +0000 (16:11 +0000)]
virtio: pci: Bounds check device config access

The device config is optional, so check it was present and mapped before
trying to use the pointer. Bounds violations are an error, not just a
warning, so bail if the checks fail.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Fix discovery of device config length
Andrew Scull [Thu, 21 Apr 2022 16:11:00 +0000 (16:11 +0000)]
virtio: pci: Fix discovery of device config length

The length of the device config was erroneously being taken from the
notify capability. Correct this by finding the length in the device
capability.

Fixes: 550435edf810 ("virtio: pci: Support non-legacy PCI transport device")
Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agovirtio: pci: Allow exclusion of legacy driver
Andrew Scull [Thu, 21 Apr 2022 16:10:59 +0000 (16:10 +0000)]
virtio: pci: Allow exclusion of legacy driver

Add a new config to control whether the driver for legacy virtio PCI
devices is included in the build. VIRTIO_PCI_LEGACY is included by
default when VIRTIO_PCI is selected, but it can also be independently
toggled.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoCI: Azure: Rework how we update MSYS2
Tom Rini [Tue, 3 May 2022 12:30:14 +0000 (08:30 -0400)]
CI: Azure: Rework how we update MSYS2

Based on reading https://www.msys2.org/docs/ci/ and "Other Systems"
rework how we update MSYS2 to the current version.  We run it once, to
perform nothing other than being the first run, then we run pacman
twice.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-05-02-add-verifying-program-loader'
Tom Rini [Mon, 2 May 2022 23:02:44 +0000 (19:02 -0400)]
Merge branch '2022-05-02-add-verifying-program-loader'

To quote the author:

U-Boot provides a verified-boot feature based around FIT, but there is
no standard way of implementing it for a board. At present the various
required pieces must be built up separately, to produce a working
implementation. In particular, there is no built-in support for selecting
A/B boot or recovery mode.

This series introduces VPL, a verified program loader phase for U-Boot.
Its purpose is to run the verified-boot process and decide which SPL
binary should be run. It is critical that this decision happens before
SPL runs, since SPL sets up SDRAM and we need to be able to update the
SDRAM-init code in the field.

Adding VPL into the boot flow provides a standard place to implement
verified boot. This series includes the phase itself, some useful Kconfig
options and a sandbox_vpl build for sandbox. No verfied-boot support is
provided in this series.

Most of the patches in this series are fixes and improvements to docs and
various Kconfig conditions for SPL.

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 2 May 2022 23:00:42 +0000 (19:00 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- Misc turris_omnia/mox related Fixes and impovements (Pali)
- Turris Omnia: Add support for configuring mSATA and WWAN slots
  via env variables (Pali)
- net: mvgbe: Set PHY page 0 before phy_connect (Tony)
- kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver (Tony)
- mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names (Pali)
- mvebu: clearfog_defconfig: enable setexpr command (Josef)
- mvebu: x530: set MPP55 to gpio (Chris)

2 years agoCI: Run VPL tests
Simon Glass [Sat, 30 Apr 2022 06:56:57 +0000 (00:56 -0600)]
CI: Run VPL tests

Add tests for VPL into the mix. For now this just runs the help test and
a few SPL ones.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Test that VPL runs correctly through to U-Boot proper
Simon Glass [Sat, 30 Apr 2022 06:56:56 +0000 (00:56 -0600)]
vpl: Test that VPL runs correctly through to U-Boot proper

Check the TPL -> VPL -> SPL -> U-Boot path by running the 'help' command
in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Support running vpl tests
Simon Glass [Sat, 30 Apr 2022 06:56:55 +0000 (00:56 -0600)]
vpl: Support running vpl tests

Add support for these to the pytest system.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Add a build for VPL
Simon Glass [Sat, 30 Apr 2022 06:56:54 +0000 (00:56 -0600)]
sandbox: Add a build for VPL

Add an initial VPL build for sandbox. This includes the flow:

   TPL (with of-platdata) -> VPL -> SPL -> U-Boot

To run it:

   ./tpl/u-boot-tpl -D

The -D is needed to get the default device tree, which includes the serial
console info.

Add a Makefile check for OF_HOSTFILE which is the option that enables
devicetree control on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agovpl: Add Kconfig options for VPL
Simon Glass [Sat, 30 Apr 2022 06:56:53 +0000 (00:56 -0600)]
vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoIntroduce Verifying Program Loader (VPL)
Simon Glass [Sat, 30 Apr 2022 06:56:52 +0000 (00:56 -0600)]
Introduce Verifying Program Loader (VPL)

Add support for VPL, a new phase of U-Boot. This runs after TPL. It is
responsible for selecting which SPL binary to run, based on a
verified-boot process.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Tidy up the TPL build rules
Simon Glass [Sat, 30 Apr 2022 06:56:51 +0000 (00:56 -0600)]
Makefile: Tidy up the TPL build rules

These should follow the same pattern as SPL, for consistency. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Simplify devicetree rules for SPL/TPL
Simon Glass [Sat, 30 Apr 2022 06:56:50 +0000 (00:56 -0600)]
Makefile: Simplify devicetree rules for SPL/TPL

The current logic checks several options to decide whether SPL/TPL need
the U-Boot devicetree to be built. In fact we can check OF_CONTROL, which
is enabled in all cases that matter.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoavb: Don't build in SPL
Simon Glass [Sat, 30 Apr 2022 06:56:49 +0000 (00:56 -0600)]
avb: Don't build in SPL

This feature is not used in SPL at present. Update the Makefile to avoid
it being built.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Correct Kconfig dependencies
Simon Glass [Sat, 30 Apr 2022 06:56:48 +0000 (00:56 -0600)]
bloblist: Correct Kconfig dependencies

This feature is not available in SPL unless common/ and lib/ are built.
Update the Kconfig to avoid build errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agotest: Tidy up test building with SPL
Simon Glass [Sat, 30 Apr 2022 06:56:47 +0000 (00:56 -0600)]
test: Tidy up test building with SPL

We can in principle add tests to any SPL build, e.g. TPL or VPL. Update
the build rules to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Expand SPL docs to explain the phase and config
Simon Glass [Sat, 30 Apr 2022 06:56:46 +0000 (00:56 -0600)]
doc: Expand SPL docs to explain the phase and config

Add a bit more information about how to use SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodoc: Convert SPL documentation to ReST
Simon Glass [Sat, 30 Apr 2022 06:56:45 +0000 (00:56 -0600)]
doc: Convert SPL documentation to ReST

Move this documentation over to .rst format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoARM: mvebu: x530: set MPP55 to gpio
Chris Packham [Mon, 2 May 2022 03:16:25 +0000 (15:16 +1200)]
ARM: mvebu: x530: set MPP55 to gpio

MPP55 is used as a reset connected to the L3 switch chip. This doesn't
matter for u-boot as it doesn't use the L3 switch but it is useful to
be able to toggle the switch in/out of reset for the OS.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: clearfog_defconfig: enable setexpr command
Josef Schlehofer [Fri, 29 Apr 2022 15:49:14 +0000 (17:49 +0200)]
arm: mvebu: clearfog_defconfig: enable setexpr command

This command is useful in U-boot scripts and it is being used by
OpenWrt bootscript for this board [1]. Otherwise shell scripting
commands are enabled by default in cmd/Kconfig.

[1] https://github.com/openwrt/openwrt/blob/852126680e21edc71c0c66561ae5a6d7479dcc67/target/linux/mvebu/image/clearfog.bootscript#L7

[2] https://source.denx.de/u-boot/u-boot/-/blob/e95afa56753cebcd20a5114b6d121f281b789006/cmd/Kconfig#L1504

Fixes: 0299c90f396c5b2971a4bac596339f4b03661c27 ("arm: mvebu: Add
SolidRun ClearFog Armada 38x initial support")

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names
Pali Rohár [Fri, 29 Apr 2022 11:53:25 +0000 (13:53 +0200)]
arm: mvebu: turris_omnia: Fix SYS_RSTOUT_* macro names

This is A385 register.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet
Tony Dinh [Sun, 17 Apr 2022 20:42:42 +0000 (13:42 -0700)]
arm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet

The Zyxel NSA310s board has the network chip Marvell Alaska 88E1318S.
Use uclass mvgbe and the compatible driver M88E1310 driver to bring
up Ethernet.

- Use uclass mvgbe to bring up the network. And remove ad-hoc code.
- Remove CONFIG_RESET_PHY_R.
- Enable CONFIG_PHY_MARVELL to properly configure the network.
- Add phy mode RGMII to kirkwood-nsa310s.dts
- Miscellaneous changes: Move constants to .c file and remove header file
board/zyxel/nsa310s/nsa310s.h, add support for large USB and SATA HDDs,
use BIT macro, add/cleanup comments, and cosmetic changes.

Note that this patch is depended on the following patch:
https://patchwork.ozlabs.org/project/uboot/patch/20220412201820.10291-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agonet: marvell: mvgbe: Set PHY page 0 before phy_connect
Tony Dinh [Tue, 12 Apr 2022 20:18:19 +0000 (13:18 -0700)]
net: marvell: mvgbe: Set PHY page 0 before phy_connect

For most Kirkwood boards, the PHY page is already set to page 0
(in register 22) before phy_connect is invoked. But some board like
the Zyxel NSA310S (which uses the network chip MV88E1318S), the PHY page
is not set to page 0. There seems to be some bad data remained in
register 22 when the uclass MVGBE about to invoke phy_connect().

This patch enables the uclass MVGBE to always set the PHY page to 0
before phy_connect.

For reference, please see this discussion:
[RFC PATCH v2] arm: kirkwood: nsa310s: Use Marvell uclass mvgbe
and PHY driver for DM Ethernet.
https://lists.denx.de/pipermail/u-boot/2022-April/480946.html

This patch has been tested with the following Kirkwood boards:

NSA310S (88F6702, network chip MV88E1318S)
Sheevaplug (88F6281, network chip MV88E1318)
Pogo V4 (88F6192, network chip 88E1116R)
GF Home(88F6281, network chip 88E1116R)
Dreamplug (88F6281, network chip MV88E1318)
Dell Kace M300 (88F6282, network chip MV88E1318) - out of tree u-boot

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agoarm: mvebu: turris_mox: Add NVMe and SCSI to boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:36 +0000 (11:39 +0200)]
arm: mvebu: turris_mox: Add NVMe and SCSI to boot targets

U-Boot for Turris Mox has already enabled NVMe and SCSI support. So add
NVMe and SCSI to boot targets.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Add NVMe to boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:35 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Add NVMe to boot targets

U-Boot for Turris Omnia has already enabled NVMe support. So add NVMe to
boot targets.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Always enable MMC, SCSI and USB boot targets
Pali Rohár [Wed, 6 Apr 2022 09:39:34 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Always enable MMC, SCSI and USB boot targets

U-Boot for Turris Omnia is always compiled with MMC, SCSI and USB support,
so always enable macros for booting from these devices.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Define CONFIG_ETHPRIME instead of ethact= ENV
Pali Rohár [Wed, 6 Apr 2022 09:39:33 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Define CONFIG_ETHPRIME instead of ethact= ENV

CONFIG_ETHPRIME defines primary ethernet device and env variable $ethact
stores currently active ethernet device.

So there is no point to set ethact= in default environment. Instead set
CONFIG_ETHPRIME properly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: turris_omnia: Fix RESET button message
Pali Rohár [Wed, 6 Apr 2022 09:39:32 +0000 (11:39 +0200)]
arm: mvebu: turris_omnia: Fix RESET button message

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: turris_omnia: Add support for USB3.0 mode in WWAN MiniPCIe slot
Pali Rohár [Wed, 2 Mar 2022 11:47:58 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Add support for USB3.0 mode in WWAN MiniPCIe slot

PCIe Mini CEM 2.1 spec added support for USB3.0 mode on MiniPCIe cards.
USB3.0 and PCIe share same pins and only one function can be active at the
same time. PCIe Mini CEM 2.1 spec says that determining function is
platform specific and spec does not define any dedicated pin which could
say if card is USB3.0-based or PCIe-based.

Implement this platform specific decision (USB3.0 vs PCIe) for WWAN
MiniPCIe slot on Turris Omnia via U-Boot env variable "omnia_wwan_slot",
similarly like is implemented forced mode for MiniPCIe/mSATA slot via
"omnia_msata_slot" env variable. Value "usb3" for "omnia_wwan_slot" would
mean to set USB3.0 mode and value "pcie" original PCIe mode.

A385 SoC on Turris Omnia has configurable fifth SerDes line (exported to
MiniPCIe WWAN slot with SIM card) either to USB3.0 or PCIe functionality,
so implementation of this new PCIe Mini CEM 2.1 feature is simple, by just
configuring SerDes to USB 3.0 mode.

Other twos MiniPCIe slots on Turris Omnia do not have this new
functionality as their SerDes lines cannot be switched to USB3.0
functionality.

Note that A385 SoC does not have too many USB3.0 blocks, so activating
USB3.0 in MiniPCIe cause that one external USB3.0 USB-A port would loose
USB3.0 functionality and would be downgraded just to USB2.0.

By default this MiniPCIe WWAN slot is in PCIe mode, like before.

To set this MiniPCIe WWAN slot to USB3.0 mode, call U-Boot commands:

  => setenv omnia_wwan_slot usb3
  => saveenv
  => reset

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Signal error when sata/pcie DT mode
Pali Rohár [Wed, 2 Mar 2022 11:47:57 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Signal error when sata/pcie DT mode

Show error message when DT file does not contain sata or pcie node which
should be explicitly disabled. This can happen when U-Boot code for finding
those nodes is incomplete or when those DT nodes are in different
unexpected location. In any case it is needed to know if DT not was not
explicitly disabled as it could mean that combo slots where setup
incorrectly.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Extract code for disabling sata/pcie
Pali Rohár [Wed, 2 Mar 2022 11:47:56 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Extract code for disabling sata/pcie

Move code for disabling sata and pcie DT nodes to own functions, so this
code can be called from other places in follow up patches.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Allow to configure mSATA slot via env variable
Pali Rohár [Wed, 2 Mar 2022 11:47:55 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Allow to configure mSATA slot via env variable

Some PCIe-based MiniPCIe cards are broken and they do not ground PIN 43
which is required by PCIe mini CEM specs. Such broken cards are incorrectly
detected as mSATA cards because SATA specs requires that PIN 43 on mSATA
cards has to be disconnected.

PIN 43 on Turris Omnia is used only for MiniPCIe/mSATA card detection by
software in U-Boot SPL. Allow to override that U-Boot SPL detection by a
new "omnia_msata_slot" env variable (to value "pcie" or "sata") so broken
MiniPCIe cards can be used in combo mSATA/MiniPCIe slot too.

As configuration of PCIe vs SATA functionality is done in U-Boot SPL,
it is required to change env variable in permanent storage and reset the
board to take effect.

To force PCIe mode for broken MiniPCIe cards, call U-Boot commands:

  => setenv omnia_msata_slot pcie
  => saveenv
  => reset

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Define only one serdes map variable
Pali Rohár [Wed, 2 Mar 2022 11:47:54 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Define only one serdes map variable

By default use primary serdes map with PCIe function in combined
miniPCIe/mSATA slot. When SATA is detected change serdes map variable at
runtime.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Enable ENV support in SPL
Pali Rohár [Wed, 2 Mar 2022 11:47:53 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Enable ENV support in SPL

Allow to read ENV variables also in SPL on Turris Omnia.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function
Pali Rohár [Wed, 2 Mar 2022 11:47:52 +0000 (12:47 +0100)]
arm: mvebu: turris_omnia: Provide env_sf_get_env_addr() function

BootROM maps SPI Flash to fixed address 0xD4000000 and this mapping is
active also when BootROM is executing binary kwbimage headers, which
includes also U-Boot SPL.

Therefore no initialization code is required to access SPI Flags from
U-Boot SPL. In proper U-Boot it is remapped to other location.

So in mvebu implementation of env_sf_get_env_addr() function returns
0xD4000000 when running in SPL and NULL when in proper U-Boot.

This change would allow to use U-Boot ENV in U-Boot SPL. Normally it is not
possible to read ENV because it is too big and U-Boot SPL does not have
such big malloc() pool to real all ENV variables.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoenv: sf: Allow to use env_sf_init_addr() at any stage
Pali Rohár [Wed, 2 Mar 2022 11:47:51 +0000 (12:47 +0100)]
env: sf: Allow to use env_sf_init_addr() at any stage

In some cases it makes sense to use env_sf_init_addr() also in SPL mode.
Allow it for boards by providing custom implementation of weak function
env_sf_get_env_addr(). When this function returns NULL it signals that
address is invalid, like config option CONFIG_ENV_ADDR.

There is no change in default behavior or in config options.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMerge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 29 Apr 2022 18:04:08 +0000 (14:04 -0400)]
Merge tag 'efi-2022-07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-07-rc2

UEFI:

* fix UEFI booting after integration of UEFI sub-system with driver model
* avoid random return values from devpath_is_partition()
* minor code clean ups

2 years agoMerge branch '2022-04-29-fuzzing-and-asan-fixes'
Tom Rini [Fri, 29 Apr 2022 15:25:06 +0000 (11:25 -0400)]
Merge branch '2022-04-29-fuzzing-and-asan-fixes'

To quote the author:

I've been experimenting with ASAN on sandbox and turned up a few issues
that are fixed in this series.

Basic ASAN was easy to turn on, but integrating with dlmalloc was
messier and fairly intrusive. Even when I had it working, there was only
a small redzone between allocations which limits the usefulness.

I saw another series on the list by Sean Anderson to enable valgrind
which was finding a different set of issues, though there was one
overlap that Sean is fixing with
"[PATCH] IOMUX: Fix access past end of console_devices".

With these issues fixed, I was able to run the dm tests without any ASAN
issues. There are a couple of leaks reported at the end, but that's for
another day.

2 years agotest: dm: devres: Remove use-after-free
Andrew Scull [Sun, 3 Apr 2022 10:39:15 +0000 (10:39 +0000)]
test: dm: devres: Remove use-after-free

Use-after-free shouldn't be used, even in tests. It's bad practice and
makes the test brittle.

Signed-off-by: Andrew Scull <ascull@google.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>