platform/kernel/u-boot.git
3 years agotest: Add a test for print_buffer()
Simon Glass [Sat, 8 May 2021 12:59:59 +0000 (06:59 -0600)]
test: Add a test for print_buffer()

Add a test for this function, to cover the various features. Expand the
expect_str length to take acount of the ~300-bytes lines generated in one
case.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Convert print tests to use ut framework
Simon Glass [Sat, 8 May 2021 12:59:58 +0000 (06:59 -0600)]
test: Convert print tests to use ut framework

This test predates the test framework in U-Boot. It uses #define DEBUG and
assert() to check the result. Update it to use the framework so it can
report failure constitent with other tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Detect when expect_str is too small
Simon Glass [Sat, 8 May 2021 12:59:57 +0000 (06:59 -0600)]
test: Detect when expect_str is too small

If a line of more than 256 bytes is generated, the test will fail but the
reason is not clear. Add a check for this condition and print a helpful
message.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: Report an error when output buffer is exhausted
Simon Glass [Sat, 8 May 2021 12:59:56 +0000 (06:59 -0600)]
console: Report an error when output buffer is exhausted

If the console output buffer is exhausted, characters are silently dropped
from the end. Detect this condition and report an error when reading back
the characters.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-06-07-arm-cache-cp15-improvements' into next
Tom Rini [Mon, 7 Jun 2021 23:12:04 +0000 (19:12 -0400)]
Merge branch '2021-06-07-arm-cache-cp15-improvements' into next

To quote the series author, Patrick Delaunay:

On STM32MP15x platform we can use OP-TEE, loaded in DDR in a region
protected by a firewall. This region is reserved in the device with
the "no-map" property as defined in the binding file
doc/device-tree-bindings/reserved-memory/reserved-memory.txt.

Sometime the platform boot failed in U-Boot on a Cortex A7 access to
this region (depending of the binary and the issue can change with compiler
version or with code alignment), then the firewall raise an error,
for example:

E/TC:0   tzc_it_handler:19 TZC permission failure
E/TC:0   dump_fail_filter:420 Permission violation on filter 0
E/TC:0   dump_fail_filter:425 Violation @0xde5c6bf0, non-secure privileged read,
         AXI ID 5c0
E/TC:0   Panic

After investigation, the forbidden access is a speculative request performed
by the Cortex A7 because all the DDR is mapped as MEMORY with CACHEABLE
property.

The issue is solved only when the region reserved by OP-TEE is no more
mapped in U-Boot as it is already done in Linux kernel.

Tested on DK2 board with OP-TEE 3.12 / TF-A 2.4:

With hard-coded address for OP-TEE reserved memory,
the error doesn't occur.

 void dram_bank_mmu_setup(int bank)
 {
 ....

     for (i = start >> MMU_SECTION_SHIFT;
       i < (start >> MMU_SECTION_SHIFT) + (size >> MMU_SECTION_SHIFT);
       i++) {
  option = DCACHE_DEFAULT_OPTION;
  if (i >= 0xde0)
  option = INVALID_ENTRY;
  set_section_dcache(i, option);
  }
 }

Just by modifying the test on 0xde0 to 0xdf0, the OP-TEE memory protected
by firewall is mapped cacheable and the error occurs.

I think that it can be a general issue for ARM architecture: the "no-map" tag
of reserved memory in device should be respected by U-Boot if firewall
is configured before U-Boot execution.

But I don't propose a generic solution in
arm/lib/cache-cp15.c:dram_bank_mmu_setup()
because the device tree parsing done in lmb_init_and_reserve() takes a
long time when it is executed without data cache.

3 years agostm32mp: don't map the reserved region with no-map property
Patrick Delaunay [Fri, 7 May 2021 12:50:35 +0000 (14:50 +0200)]
stm32mp: don't map the reserved region with no-map property

No more map the reserved region with "no-map" property by marking
the corresponding TLB entries with invalid entry (=0) to avoid
speculative access.

The device tree parsing done in lmb_init_and_reserve() takes a
long time when it is executed without data cache, so it is called in
enable_caches() before to disable it.

This patch fixes an issue where predictive read access on secure DDR
OP-TEE reserved area are caught by firewall.

  Series-cc: marex
  Series-cc: pch
  Series-cc: marek.bykowski@gmail.com
  Series-cc: Ard Biesheuvel <ardb@kernel.org>
  Series-cc: Etienne Carriere <etienne.carriere@linaro.org>

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agostm32mp: Increase the reserved memory in board_get_usable_ram_top
Patrick Delaunay [Fri, 7 May 2021 12:50:34 +0000 (14:50 +0200)]
stm32mp: Increase the reserved memory in board_get_usable_ram_top

Add 8M for the U-Boot reserved memory (display, fdt, gd, ...)
mapped cacheable before relocation.

Without this patch the device tree, located before the MALLOC area
is not tagged cacheable just after relocation, before mmu reconfiguration.

This patch reduces the duration for device tree parsing in
lmb_init_and_reserve.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoimage-fdt: save no-map parameter of reserve-memory
Patrick Delaunay [Fri, 7 May 2021 12:50:33 +0000 (14:50 +0200)]
image-fdt: save no-map parameter of reserve-memory

Save the 'no-map' information present in 'reserved-memory' node to allow
correct handling when the MMU is configured in board to avoid
speculative access.

This binding is defined in
doc/device-tree-bindings/reserved-memory/reserved-memory.txt

Additional properties:
...
no-map (optional) - empty property
    - Indicates the operating system must not create a virtual mapping
      of the region as part of its standard mapping of system memory,
      nor permit speculative access to it under any circumstances other
      than under the control of the device driver using the region.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agotest: lmb: add test for lmb_reserve_flags
Patrick Delaunay [Fri, 7 May 2021 12:50:32 +0000 (14:50 +0200)]
test: lmb: add test for lmb_reserve_flags

Add a test to check the management of reserved region with flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolmb: add lmb_dump_region() function
Patrick Delaunay [Fri, 7 May 2021 12:50:31 +0000 (14:50 +0200)]
lmb: add lmb_dump_region() function

Add lmb_dump_region() function, to simplify lmb_dump_all_force().
This patch is based on Linux memblock dump function.

An example of bdinfo output is:

.....
fdt_size    = 0x000146a0
FB base     = 0xfdd00000
lmb_dump_all:
 memory.cnt  = 0x1
 memory[0] [0xc0000000-0xffffffff], 0x40000000 bytes flags: 0
 reserved.cnt  = 0x6
 reserved[0] [0x10000000-0x10045fff], 0x00046000 bytes flags: 4
 reserved[1] [0x30000000-0x3003ffff], 0x00040000 bytes flags: 4
 reserved[2] [0x38000000-0x3800ffff], 0x00010000 bytes flags: 4
 reserved[3] [0xe8000000-0xefffffff], 0x08000000 bytes flags: 4
 reserved[4] [0xfbaea344-0xfdffffff], 0x02515cbc bytes flags: 0
 reserved[5] [0xfe000000-0xffffffff], 0x02000000 bytes flags: 4
arch_number = 0x00000000
TLB addr    = 0xfdff0000
....

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolmb: add lmb_is_reserved_flags
Patrick Delaunay [Fri, 7 May 2021 12:50:30 +0000 (14:50 +0200)]
lmb: add lmb_is_reserved_flags

Add a new function lmb_is_reserved_flags to check if
an address is reserved with a specific flags.

This function can be used to check if an address was
reserved with no-map flags with:

lmb_is_reserved_flags(lmb, addr, LMB_NOMAP);

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agolmb: Add support of flags for no-map properties
Patrick Delaunay [Fri, 7 May 2021 12:50:29 +0000 (14:50 +0200)]
lmb: Add support of flags for no-map properties

Add "flags" in lmb_property to save the "no-map" property of
reserved region and a new function lmb_reserve_flags() to check
this flag.

The default allocation use flags = LMB_NONE.

The adjacent reserved memory region are merged only when they have
the same flags value.

This patch is partially based on flags support done in Linux kernel
mm/memblock .c (previously lmb.c); it is why LMB_NOMAP = 0x4, it is
aligned with MEMBLOCK_NOMAP value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoPrepare v2021.07-rc4
Tom Rini [Mon, 7 Jun 2021 13:26:39 +0000 (09:26 -0400)]
Prepare v2021.07-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 7 Jun 2021 12:09:35 +0000 (08:09 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'u-boot-rockchip-20210606' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 7 Jun 2021 11:22:14 +0000 (07:22 -0400)]
Merge tag 'u-boot-rockchip-20210606' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

3 years agoMerge tag 'dm-pull-6jun21' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 6 Jun 2021 17:00:23 +0000 (13:00 -0400)]
Merge tag 'dm-pull-6jun21' of https://source.denx.de/u-boot/custodians/u-boot-dm

Minor fixes for sandbox and handling of dm-ranges

3 years agoMerge tag 'video-for-2021-07-rc3' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 5 Jun 2021 15:17:55 +0000 (11:17 -0400)]
Merge tag 'video-for-2021-07-rc3' of https://source.denx.de/u-boot/custodians/u-boot-video

 - disable legacy video for brxre1, mx28evk, pico-imx6ul,
   pxm2 and rut boards after DM_VIDEO conversion deadline

3 years agotest: add dm_test_read_resource
Patrick Delaunay [Fri, 21 May 2021 10:25:00 +0000 (12:25 +0200)]
test: add dm_test_read_resource

Add a test of dev_read_resource with translation or without translation

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: luton: remove address translation after ofnode_read_resource
Patrick Delaunay [Fri, 21 May 2021 10:24:59 +0000 (12:24 +0200)]
net: luton: remove address translation after ofnode_read_resource

Removed call of ofnode_translate_address() after ofnode_read_resource
in luton_switch.c:luton_probe(); it is unnecessary since
the commit feb7ac457c20 ("dm: core: Add address translation in
fdt_get_resource").

Fixes: feb7ac457c20 ("dm: core: Add address translation in fdt_get_resource")
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reported-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agopwm: cros_ec: Rename "priv_auto_alloc_size" to "priv_auto"
Alper Nebi Yasak [Fri, 14 May 2021 13:48:40 +0000 (16:48 +0300)]
pwm: cros_ec: Rename "priv_auto_alloc_size" to "priv_auto"

With commit 41575d8e4c33 ("dm: treewide: Rename auto_alloc_size members
to be shorter") "priv_auto_alloc_size" was renamed to "priv_auto". This
driver was sent to the mailing list before that change, merged after it,
and still has the old form. Apply the rename here as well.

Fixes: 1b9ee2882e6b ("pwm: Add a driver for Chrome OS EC PWM")
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: correct determination of the text base
Heinrich Schuchardt [Sat, 15 May 2021 17:29:13 +0000 (19:29 +0200)]
sandbox: correct determination of the text base

os_find_text_base() assumes that first line of /proc/self/maps holds
information about the text. Hence we must call the function before calling
os_malloc() which calls mmap(0x10000000,).

Failure to do so has led to incorrect values for pc_reloc when an
exception was reported

    => exception undefined

    Illegal instruction
    pc = 0x5628d82e9d3c, pc_reloc = 0x5628c82e9d3c

as well as incorrect output of the bdinfo command

    => bdinfo
    relocaddr   = 0x0000000007858000
    reloc off   = 0x0000000010000000

Fixes: b308d9fd18fa ("sandbox: Avoid using malloc() for system state")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoof: addr: Remove call to dev_count_cells() in of_get_address()
Bin Meng [Fri, 30 Apr 2021 13:16:59 +0000 (21:16 +0800)]
of: addr: Remove call to dev_count_cells() in of_get_address()

In of_get_address(), there is:

  dev_count_cells(dev, &na, &ns);

followed by:

  bus->count_cells(dev, &na, &ns);

but no codes in between use na/ns, hence the first call is useless.
By dropping the first call, dev_count_cells() is now useless too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoof: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
Bin Meng [Fri, 30 Apr 2021 13:16:58 +0000 (21:16 +0800)]
of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'

'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
While this is an error for 'ranges', this is fine because DMA capable
devices always have a translatable DMA address. Also, with no
'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
no restrictions unless perhaps the device itself has implicit
restrictions.

This keeps in sync with Linux kernel commit:

  81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopico-imx6ul: disable video after DM_VIDEO conversion deadline
Anatolij Gustschin [Mon, 24 May 2021 15:31:26 +0000 (17:31 +0200)]
pico-imx6ul: disable video after DM_VIDEO conversion deadline

These boards were not converted to DM_VIDEO before deadline,
so disable video support for now.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Richard Hu <richard.hu@technexion.com>
Cc: Fabio Estevam <festevam@gmail.com>
3 years agobrxre1: disable video after DM_VIDEO conversion deadline
Anatolij Gustschin [Mon, 24 May 2021 15:19:56 +0000 (17:19 +0200)]
brxre1: disable video after DM_VIDEO conversion deadline

The board was not converted to DM_VIDEO before deadline, so disable
video support for now.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
3 years agomx28evk: disable video after DM_VIDEO conversion deadline
Anatolij Gustschin [Mon, 24 May 2021 14:45:29 +0000 (16:45 +0200)]
mx28evk: disable video after DM_VIDEO conversion deadline

The board was not converted to DM_VIDEO before deadline, so disable
video support for now.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
3 years agosiemens: pxm2: disable video after DM_VIDEO conversion deadline
Anatolij Gustschin [Mon, 24 May 2021 14:35:57 +0000 (16:35 +0200)]
siemens: pxm2: disable video after DM_VIDEO conversion deadline

The board was not converted to DM_VIDEO before deadline, so disable
video support for now.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
3 years agosiemens: rut: disable video after DM_VIDEO conversion deadline
Anatolij Gustschin [Mon, 24 May 2021 14:26:51 +0000 (16:26 +0200)]
siemens: rut: disable video after DM_VIDEO conversion deadline

The board was not converted to DM_VIDEO before deadline, so disable
video support for now.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 4 Jun 2021 13:34:21 +0000 (09:34 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: a37xx: PCI related enhancements and fixes (Pali)
- mvebu: turris_omnia: Board specific updates, e.g. rescue
  boot cmd etc (Marek)

3 years agoarm: mvebu: turris_omnia: support invoking rescue boot from console
Marek Behún [Fri, 28 May 2021 08:00:49 +0000 (10:00 +0200)]
arm: mvebu: turris_omnia: support invoking rescue boot from console

Make it possible to invoke rescue boot from U-Boot console, without
having to press the factory reset button. This is needed when accessing
the device remotely, for example.

Achieve this by putting rescue command into `bootcmd_rescue` default
environment variable and setting some distroboot environment variables
to their default values when the factory button is pressed.

Rescue boot from console can be invoked by running
  run bootcmd_rescue

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: mvebu: turris_omnia: update rescue mode boot command
Marek Behún [Fri, 28 May 2021 08:00:48 +0000 (10:00 +0200)]
arm: mvebu: turris_omnia: update rescue mode boot command

Update rescue mode boot command on Turris Omnia. We are compressing the
image with lzma now.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Fix configuring PCIe resources
Pali Rohár [Wed, 26 May 2021 15:59:40 +0000 (17:59 +0200)]
arm: a37xx: pci: Fix configuring PCIe resources

The `ranges` DT property of the PCIe node is currently ignored by
Aardvark driver - all entries are used as transparent PCIe MEM, despite
some of them being defined for IO in DT.

This is because the driver does not setup PCIe outbound windows and thus
a default configuration is used.

This can cause an external abort on CPU when a device driver tries to
access non-MEM space.

Setup the PCIe windows according to the `ranges` property for all
non-MEM resources (currently only IO) and also non-transparent MEM
resources.

Because Linux expects that bootloader does not setup Aardvark PCIe
windows, disable them before booting Linux.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Increase PCIe MEM size from 16 MiB to 127 MiB
Pali Rohár [Wed, 26 May 2021 15:59:39 +0000 (17:59 +0200)]
arm: a37xx: pci: Increase PCIe MEM size from 16 MiB to 127 MiB

For some configurations with more PCIe cards and PCIe bridges, 16 MiB of
PCIe MEM space may not be enough. Since TF-A already allocates a 128 MiB
CPU window for PCIe, and since IO port space is only 64 KiB in total,
use all the remaining space (64 + 32 + 16 + 8 + 4 + 2 + 1 = 127 MiB) for
PCIe MEM.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function
Pali Rohár [Wed, 26 May 2021 15:59:38 +0000 (17:59 +0200)]
arm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function

Current version of this function uses a lot of incorrect assumptions about
the `ranges` DT property:

 * parent(#address-cells) == 2
 * #size-cells == 2
 * number of entries == 2
 * address size of first entry == 0x1000000
 * second child address entry == base + 0x1000000

Trying to increase PCIe MEM space to more than 16 MiB leads to an overlap
with PCIe IO space, and trying to define additional MEM space (as a third
entry in the `ranges` DT property) causes U-Boot to crash when booting the
kernel.

  ## Flattened Device Tree blob at 04f00000
     Booting using the fdt blob at 0x4f00000
     Loading Device Tree to 000000001fb01000, end 000000001fb08f12 ... OK
  ERROR: board-specific fdt fixup failed: <unknown error>
   - must RESET the board to recover.

Fix a3700_fdt_fix_pcie_regions() to properly parse and update all addresses
in the `ranges` property according to
https://elinux.org/Device_Tree_Usage#PCI_Address_Translation

Now it is possible to increase PCIe MEM space from 16 MiB to maximal value
of 127 MiB.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Fixes: cb2ddb291ee6 ("arm64: mvebu: a37xx: add device-tree fixer for PCIe regions")
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Find PCIe controller node by compatible instead of path
Pali Rohár [Wed, 26 May 2021 15:59:37 +0000 (17:59 +0200)]
arm: a37xx: pci: Find PCIe controller node by compatible instead of path

Find PCIe DT node by compatible string instead of retrieving it by using
hardcoded DT path.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Fix DT compatible string to Linux' DT compatible
Pali Rohár [Wed, 26 May 2021 15:59:36 +0000 (17:59 +0200)]
arm: a37xx: pci: Fix DT compatible string to Linux' DT compatible

Change DT compatible string for A3700 PCIe from 'marvell,armada-37xx-pcie'
to 'marvell,armada-3700-pcie' to make U-Boot A3700 PCIe DT node compatible
with Linux' DT node.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Disable bus mastering when unloading driver
Pali Rohár [Wed, 26 May 2021 15:59:35 +0000 (17:59 +0200)]
arm: a37xx: pci: Disable bus mastering when unloading driver

Disable Root Bridge I/O space, memory space and bus mastering in Aardvark's
remove method, which is called before booting Linux kernel.

This ensures that PCIe device which was initialized and used by U-Boot
cannot do new DMA transfers until Linux initializes PCI subsystem and loads
appropriate drivers for the device.

During initialization of PCI subsystem Linux in fact disables this bus
mastering on Root Bridge (and later enables it when driver is loaded and
configured), but there is a possibility of a small window after U-Boot
boots Linux when bus mastering is enabled, which is not correct.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agoarm: a37xx: pci: Don't put link into LTSSM Recovery state during probe
Pali Rohár [Wed, 26 May 2021 15:59:34 +0000 (17:59 +0200)]
arm: a37xx: pci: Don't put link into LTSSM Recovery state during probe

During our debugging of the Aardvark driver in Linux we have discovered
that the PCIE_CORE_LINK_CTRL_STAT_REG register in fact controls standard
PCIe Link Control Register for PCIe Root Bridge. This led us to discover
that the name of the PCIE_CORE_LINK_TRAINING macro and the corresponding
comment by this macro's usage is misleading; this bit in fact controls
Retrain Link, which, according to PCIe base spec is defined as:

  A write of 1b to this bit initiates Link retraining by directing the
  Physical Layer LTSSM to the Recovery state. If the LTSSM is already in
  Recovery or Configuration, re-entering Recovery is permitted but not
  required.

Entering Recovery state is normally done from LTSSM L0, L0s and L1 states.
But since the pci-aardvark.c driver enables Link Training just a few lines
above, the controller is not in L0 ready state yet. So setting aardvark bit
PCIE_CORE_LINK_TRAINING does not actually enter Recovery state at this
place.

Moreover, trying to enter LTSSM Recovery state without other configuration
is causing issues for some cards (e.g. Atheros AR9xxx and QCA9xxx). Since
Recovery state is not entered, these issues are not triggered.

Remove code which tries to enter LTSSM Recovery state completely.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
3 years agofastboot: Fix overflow when calculating chunk size
Sean Anderson [Thu, 27 May 2021 16:02:34 +0000 (12:02 -0400)]
fastboot: Fix overflow when calculating chunk size

If a chunk was larger than 4GiB, then chunk_data_sz would overflow and
blkcnt would not be calculated correctly. Upgrade it to a u64 and cast
its multiplicands as well. Also fix bytes_written while we're at it.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoMAINTAINERS: Update maintainer's mail address
Kever Yang [Tue, 30 Mar 2021 10:02:07 +0000 (18:02 +0800)]
MAINTAINERS: Update maintainer's mail address

Philipp has change the mail and the legacy one is not available, update it
to the new one.

CC: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Mon, 31 May 2021 14:19:14 +0000 (10:19 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- SiFive FU740 and Unmatched support

3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 31 May 2021 14:18:26 +0000 (10:18 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi

This contains the fix to bring back the SD card as MMC0. In the long run
we are looking into a more robust solution, but for now we need to fix
this, as this breaks the user experience left, right, and centre.
Also add the one MAINTAINERS path addition from Samuel.

3 years agodrivers: pci: pcie_dw_common: fix Werror compilation error
Green Wan [Wed, 19 May 2021 11:16:15 +0000 (04:16 -0700)]
drivers: pci: pcie_dw_common: fix Werror compilation error

Fix compilation error when Werror is turned on. The warning could
possible break some CI builds.

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 years agoriscv: cpu: fu740: clear feature disable CSR
Green Wan [Thu, 27 May 2021 13:52:14 +0000 (06:52 -0700)]
riscv: cpu: fu740: clear feature disable CSR

Clear feature disable CSR to turn on all features of hart. The detail
is specified at section, 'SiFive Feature Disable CSR', in user manual

https://sifive.cdn.prismic.io/sifive/aee0dd4c-d156-496e-a6c4-db0cf54bbe68_sifive_U74MC_rtl_full_20G1.03.00_manual.pdf

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoboard: sifive: add HiFive Unmatched board support
Green Wan [Thu, 27 May 2021 13:52:13 +0000 (06:52 -0700)]
board: sifive: add HiFive Unmatched board support

Add defconfig and board support for HiFive Unmatched.

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: dts: add SiFive Unmatched board support
Green Wan [Thu, 27 May 2021 13:52:12 +0000 (06:52 -0700)]
riscv: dts: add SiFive Unmatched board support

Add dts files for SiFive Unmatched board.

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: dts: add fu740 support
Green Wan [Thu, 27 May 2021 13:52:11 +0000 (06:52 -0700)]
riscv: dts: add fu740 support

Add dts support for fu740. The HiFive Unmatched support is based on
fu740 cpu and drivers in following patch set.

Signed-off-by: Green Wan <green.wan@sifive.com>
[greentime.hu: set fu740 speed to 1.2GHz]
Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agodrivers: pci: add pcie support for fu740
Green Wan [Thu, 27 May 2021 13:52:10 +0000 (06:52 -0700)]
drivers: pci: add pcie support for fu740

Add pcie driver for SiFive fu740, the driver depends on
fu740 gpio, clk and reset driver to do init. Force running at Gen1
for better capatible enumeration.

Several devices are tested:
a) M.2 NVMe SSD
b) USB-to-PCI adapter
c) Ethernet adapter (E1000 compatible)

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agodrivers: ram: sifive: rename fu540_ddr and add fu740 support
Green Wan [Thu, 27 May 2021 13:52:09 +0000 (06:52 -0700)]
drivers: ram: sifive: rename fu540_ddr and add fu740 support

Rename fu540_ddr.c to sifive_ddr.c and add fu740 support

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodrivers: clk: add fu740 support
Green Wan [Thu, 27 May 2021 13:52:08 +0000 (06:52 -0700)]
drivers: clk: add fu740 support

Add fu740 support. One abstract layer is added for supporting
multiple chips such as fu540 and fu740.

Signed-off-by: Green Wan <green.wan@sifive.com>
3 years agoriscv: cpu: fu740: Add support for cpu fu740
Green Wan [Thu, 27 May 2021 13:52:07 +0000 (06:52 -0700)]
riscv: cpu: fu740: Add support for cpu fu740

Add SiFive fu740 cpu to support RISC-V arch

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMAINTAINERS: Add allwinner/sunxi driver directories
Samuel Holland [Mon, 19 Apr 2021 03:13:36 +0000 (22:13 -0500)]
MAINTAINERS: Add allwinner/sunxi driver directories

These drivers are sunxi platform-specific, and so are of interest to the
sunxi maintainers.

In fact, as there is no PHY driver maintainer, drivers/phy/allwinner had
no maintainer at all.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: Bring back SD card as MMC device 0
Andre Przywara [Fri, 16 Apr 2021 10:52:27 +0000 (11:52 +0100)]
sunxi: Bring back SD card as MMC device 0

Commit 2243d19e5618 ("mmc: mmc-uclass: Use dev_seq() to read aliases
node's index") now actually enforces U-Boot's device enumeration policy,
where explicitly named devices come first, then any other non-named
devices follow, without filling gaps.

For quite a while we have had an "mmc1 = &mmc2;" alias in our
sunxi-u-boot.dtsi, which now leads to the problem that the SD card
(which was always mmc device 0) now gets to be number 2.
This breaks quite some boot scripts, including our own distro boot
commands, and some other features looking at $mmc_bootdev, also
fastboot.

Just add an explicit mmc0 alias in the very same file to fix this and
restore the old behaviour.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Samuel Holland <samuel@sholland.org>
Tested-by: Simon Baatz <gmbnomis@gmail.com>
3 years agoMerge tag 'u-boot-stm32-20210528' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 28 May 2021 18:11:06 +0000 (14:11 -0400)]
Merge tag 'u-boot-stm32-20210528' of https://source.denx.de/u-boot/custodians/u-boot-stm

- DFU: MTD: fix for lock support
- reset: stm32: fix bank bank and offset computation
- enable UNZIP config in several stm32mp defconfig

3 years agoMerge tag 'efi-2021-07-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 28 May 2021 18:10:51 +0000 (14:10 -0400)]
Merge tag 'efi-2021-07-rc4-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-07-rc4-2

Simplify configuration using HASH functions
Fix Coverity warnings related to EFI TCG2 protocol
Enable PE/COFF image measurement

3 years agoefi_loader: add PE/COFF image measurement
Masahisa Kojima [Wed, 26 May 2021 03:09:58 +0000 (12:09 +0900)]
efi_loader: add PE/COFF image measurement

"TCG PC Client Platform Firmware Profile Specification"
requires to measure every attempt to load and execute
a OS Loader(a UEFI application) into PCR[4].
This commit adds the PE/COFF image measurement, extends PCR,
and appends measurement into Event Log.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Replace CONFIG_HASH_CALCULATE by CONFIG_HASH
Fix conversions between pointers and u64.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: Work-around build issue due to missing hash_calculate()
Alexandru Gagniuc [Mon, 24 May 2021 19:28:57 +0000 (14:28 -0500)]
efi_loader: Work-around build issue due to missing hash_calculate()

The hash_calculate() symbol is provided by hash-checksum.c. It depends
on hash_progressive_lookup_algo(), provided when CONFIG_HASH=y.

The issue is that hash_calculate() is used by the efi_loader,
irregardless of CONFIG_FIT_SIGNATURE. As pointed out in
commit 87316da05f2f ("lib: introduce HASH_CALCULATE option"),
enabling hash_calculate() based on CONFIG_FIT_SIGNATURE is incorrect.

To resolve this, use CONFIG_HASH as the compile switch for
hash-checksum.c. This ensures that all dependencies are compiled, and
is the most natural Kconfig to use.

There is the issue of having to 'select HASH' in a couple of places
that already 'select SHA256'. This is a deeper problem with how hashes
are organized, and fixing it is beyonf the scope of this change.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoRevert "lib: introduce HASH_CALCULATE option"
Alexandru Gagniuc [Mon, 24 May 2021 19:28:56 +0000 (14:28 -0500)]
Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>
3 years agoefi_loader: Fix coverity warnings for efi tcg2 protocol
Ilias Apalodimas [Wed, 26 May 2021 18:01:00 +0000 (21:01 +0300)]
efi_loader: Fix coverity warnings for efi tcg2 protocol

Coverity reported 3 warnings on the current code.
CID 331856, 331855, 331854 on the latest scan.

Fix the rest of the warnings by initializing the variables before
passing them to tpm2_get_pcr_info().
In order to avoid future warnings and errors initialize them to 0 within
the function as well, since the values are always OR'ed after querying the
hardware.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoarm: dts: stm32mp157c-odyssey-som: enable the RNG1
Grzegorz Szymaszek [Mon, 19 Apr 2021 17:55:52 +0000 (19:55 +0200)]
arm: dts: stm32mp157c-odyssey-som: enable the RNG1

Enable the true random number generator. It can be used, for example, to
generate partition UUIDs when partitioning with the gpt command. The
generator is already enabled in the device trees of several other
STM32MP1‐based boards, like DKx or DHCOM.

Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoconfigs: stm32mp: Enable UNZIP on STMicroelectronics stm32mp15 boards
Patrick Delaunay [Thu, 6 May 2021 07:31:00 +0000 (09:31 +0200)]
configs: stm32mp: Enable UNZIP on STMicroelectronics stm32mp15 boards

The CMD_UNZIP provides the 'gzwrite' command, which is convenient
for writing e.g. gz-compressed images to eMMC from U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: stm32: Enable UNZIP on DHSOM by default
Marek Vasut [Mon, 3 May 2021 11:31:48 +0000 (13:31 +0200)]
ARM: stm32: Enable UNZIP on DHSOM by default

The CMD_UNZIP provides the 'gzwrite' command, which is convenient
for writing e.g. gz-compressed images to eMMC from U-Boot.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Add additional ID register check for KSZ8851 presence
Marek Vasut [Mon, 3 May 2021 11:31:39 +0000 (13:31 +0200)]
ARM: stm32: Add additional ID register check for KSZ8851 presence

Currently the code sets eth1addr only if /ethernet1 alias exists in DT,
the node pointed to by the alias has "micrel,ks8851-mll" compatible
string, and the KSZ8851 CCR register read indicates programmed EEPROM
is not connected.

This is not sufficient to detect cases where the DT still contains the
KSZ8851 nodes, but the chip itself is not present. Extend the detection
to handle these cases.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Update dhelectronics/dh_stm32mp1/MAINTAINERS file
Christoph Niedermaier [Wed, 5 May 2021 16:23:51 +0000 (18:23 +0200)]
ARM: stm32: Update dhelectronics/dh_stm32mp1/MAINTAINERS file

Adding new DH electronics mailing list.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoreset: stm32: Fix bank and offset computation
Patrice Chotard [Wed, 28 Apr 2021 11:42:45 +0000 (13:42 +0200)]
reset: stm32: Fix bank and offset computation

BITS_PER_LONG is used to represent register's size which is 32.
But when compiled on arch64, BITS_PER_LONG is then equal to 64.

Fix bank and offset computation to make it work on arch32 and
arch64 and ensure that register's size is always equal to 32.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodfu: dfu_mtd: remove the mtd_block_op error when mtd_lock is not supported
Patrick Delaunay [Wed, 10 Mar 2021 09:27:22 +0000 (10:27 +0100)]
dfu: dfu_mtd: remove the mtd_block_op error when mtd_lock is not supported

Fix the result of DFU_OP_WRITE operation in mtd_block_op function
when mtd_lock is not supported (-EOPNOTSUPP) to avoid DFU stack
error on the DFU manifestation of the MTD device, when
dfu_flush_medium_mtd is called.

Without this patch, dfu-util failed on dfuERROR state at the end
of the write operation on the alternate even if MTD write
opeartion is correctly performed.

$> dfu-util -a 3 -D test.bin
....
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
....
Download [=========================] 100%       225469 bytes
Download done.
state(10) = dfuERROR, status(14) = Something went wrong,
  but the device does not know what it was Done!

Fixes: 65f3fc18fc1e ("dfu_mtd: Add provision to unlock mtd device")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agoMerge tag 'ti-v2021.07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Thu, 27 May 2021 11:42:49 +0000 (07:42 -0400)]
Merge tag 'ti-v2021.07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-ti

- Fix reset for AM64 platforms
- Enable networking PHY driver for AM64
- Fix default R5F cluster setting in J7

3 years agoMerge branch '2021-05-26-assorted-bugfixes'
Tom Rini [Thu, 27 May 2021 11:41:25 +0000 (07:41 -0400)]
Merge branch '2021-05-26-assorted-bugfixes'

3 years agoARM: ti: Increase the allocated size for MLO.raw
Faiz Abbas [Mon, 19 Apr 2021 06:50:27 +0000 (12:20 +0530)]
ARM: ti: Increase the allocated size for MLO.raw

MLO has increased to a size greater than the allocated
128 kB in dfu_alt_info_emmc and _mmc.

Therefore, double the allocated size for MLO.raw in
the default environment.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210419065027.5834-1-a-govindraju@ti.com
3 years agoarm: dts: k3-am642-sk: Add sysreset controller node
Suman Anna [Fri, 14 May 2021 01:10:57 +0000 (20:10 -0500)]
arm: dts: k3-am642-sk: Add sysreset controller node

The AM64x SoC uses a central Device Management and Security Controller
(DMSC) processor that manages all the low-level device controls
including the system-wide SoC reset. The system-wide reset is managed
through the system reset driver.

Add a sysreset controller node as a child of the dmsc node to enable
the "reset" command from U-Boot prompt for the K3 AM642 SK.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-am642-evm: Add sysreset controller node
Suman Anna [Fri, 14 May 2021 01:10:56 +0000 (20:10 -0500)]
arm: dts: k3-am642-evm: Add sysreset controller node

The AM64x SoC uses a central Device Management and Security Controller
(DMSC) processor that manages all the low-level device controls
including the system-wide SoC reset. The system-wide reset is managed
through the system reset driver.

Add a sysreset controller node as a child of the dmsc node to enable
the "reset" command from U-Boot prompt for the K3 AM642 EVM.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agofirmware: ti_sci: Update ti_sci_msg_req_reboot to include domain
Dave Gerlach [Fri, 14 May 2021 01:10:55 +0000 (20:10 -0500)]
firmware: ti_sci: Update ti_sci_msg_req_reboot to include domain

The ti_sci_msg_req_reboot message payload has been extended to include a
domain field, but for the purposes of u-boot this should be zero to
reset the entire SoC as it did before. Include domain for completeness
and set to zero to ensure proper operation.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-j721e: Fix up MAIN R5FSS cluster mode back to Split-mode
Suman Anna [Tue, 18 May 2021 21:38:25 +0000 (16:38 -0500)]
arm: dts: k3-j721e: Fix up MAIN R5FSS cluster mode back to Split-mode

The default U-Boot environment variables and design are all set up for
both the MAIN R5FSS clusters to be in Split-mode. This is the setting
in v2021.01 U-Boot and the dt nodes are synched with the kernel binding
property names in commit 468ec2f3ef8f ("remoteproc: k3_r5: Sync to
upstreamed kernel DT property names") merged in v2021.04-rc2.

The modes for both the clusters got switched back to LockStep mode by
mistake in commit 70e167495ab2 ("arm: dts: k3-j721e: Sync Linux v5.11-rc6
dts into U-Boot") also in v2021.04-rc2. This throws the following warning
messages when early-booting the cores using default env variables,

  k3_r5f_rproc r5f at 5d00000: Invalid op: Trying to start secondary core 7 in lockstep mode
  Load Remote Processor 3 with data at addr=0x82000000 98484 bytes: Failed!
  k3_r5f_rproc r5f at 5f00000: Invalid op: Trying to start secondary core 9 in lockstep mode
  Load Remote Processor 5 with data at addr=0x82000000 98484 bytes: Failed!

Fix this by switching back both the clusters to the expected Split-mode.
Make this mode change in the u-boot specific dtsi file to avoid such
sync overrides in the future until the kernel dts is also switched to
Split-mode by default.

Fixes: 70e167495ab2 ("arm: dts: k3-j721e: Sync Linux v5.11-rc6 dts into U-Boot")
Reported-by: Minas Hambardzumyan <minas@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoconfigs: am64x_evm_a53_defconfig: Enable DP83867 PHY driver
Vignesh Raghavendra [Wed, 12 May 2021 14:38:25 +0000 (20:08 +0530)]
configs: am64x_evm_a53_defconfig: Enable DP83867 PHY driver

AM64x GP and SK EVM have DP83867 PHY connected to CPSW external port0.
Enable the driver in order to use ethernet at U-Boot prompt.
CONFIG_PHY_TI is selected by CONFIG_PHY_TI_DP83867 and thus can be dropped.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agotest: Remove duplicate macro
Sean Anderson [Sun, 23 May 2021 17:00:56 +0000 (13:00 -0400)]
test: Remove duplicate macro

ut_asserteq_strn is defined twice. Remove one definition.

Fixes: 33d7edfd5f ("test: Add a way to check part of a console line or skip it")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoGitLab: Remove tags for sandbox_noinst tests
Harm Berntsen [Fri, 21 May 2021 19:59:45 +0000 (21:59 +0200)]
GitLab: Remove tags for sandbox_noinst tests

Commit 712cc962b70d ("GitLab: Remove "tags" stanzas") removed the 'all'
tag from all the jobs. The sandbox_noinst_test.py test was added in
between the author date and commit date (commit 6c914e4232cd
("azure/gitlab: Add tests for sandbox_noinst")) which is probably why it
still contains the tags. This commit fixes that so all jobs now don't
require tags on the GitLab runners.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
3 years agotest: Fix filesystem tests always being skipped
Alper Nebi Yasak [Thu, 20 May 2021 19:09:46 +0000 (22:09 +0300)]
test: Fix filesystem tests always being skipped

Commit 1ba21bb06b08 ("test: Don't unmount not (yet) mounted system")
fixes an issue in the filesystem tests where the test setup may fail
to mount an image and still attempt to unmount it. However, the commit
unintentionally breaks the test setups in two ways.

The newly created unmounted filesystem images are being immediately
deleted due to some cleanup steps being misplaced into finally blocks,
which makes them always run instead of only on failures. The mount calls
always fail since the images never exist, causing the tests to be always
skipped. This patch moves these cleanup calls into the except blocks to
fix this and makes the tests run again.

There are also unmount calls misplaced into finally blocks, making them
run after the tests instead of before the tests. These unmount calls
make the filesystem image file consistent with the changes made to it as
part of the test setup, and this misplacement is making a number of
tests fail unexpectedly.

The unmount calls must be run before the tests use the image, meaning
before the yield call and not in the finally block. They must also be
run as a cleanup step when the filesystem setup fails, so they can't be
placed as the final call in the try blocks since they would be skipped
on such failures. For these reasons, this patch places the unmount calls
both in the except blocks and the else blocks of the final setup step.
This makes the unexpectedly failing tests to succeed again.

Furthermore, this isolates the mount calls to their own try-except
statement to avoid reintroducing the original issue of unmounting a
not-mounted image while fixing the unmount misplacement.

After these fixes, running "make tests" with guestmount available results
in two test failures not related to the mentioned commit. If the
guestmount executables are unavailable, the mounts fallback to using
sudo and result in no failures.

Fixes: 1ba21bb06b08 ("test: Don't unmount not (yet) mounted system")
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agospl: Kconfig: Use tabs instead of space for alignment
Michal Simek [Thu, 20 May 2021 11:08:44 +0000 (13:08 +0200)]
spl: Kconfig: Use tabs instead of space for alignment

A lot of entries were using spaces instead of tab for alignment that's why
it is good to fix it to use the same style everywhere.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofs: btrfs: Add missing cache aligned allocation
Marek Vasut [Mon, 17 May 2021 22:39:39 +0000 (00:39 +0200)]
fs: btrfs: Add missing cache aligned allocation

The superblock buffer must be cache aligned, since it might be used
in DMA context, allocate it using ALLOC_CACHE_ALIGN_BUFFER() just
like it was done in btrfs_read_superblock() and read_tree_node().

This fixes this output on boot and non-working btrfs on iMX53:
CACHE: Misaligned operation at range [ced299d0ced2a9d0]

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Qu Wenruo <wqu@suse.com>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
3 years agofs/squashfs: zero out unused fields in fs_dirent
Heinrich Schuchardt [Mon, 17 May 2021 06:21:39 +0000 (08:21 +0200)]
fs/squashfs: zero out unused fields in fs_dirent

When reading directories the UEFI sub-system must supply file attributes
and timestamps. These fields will have to be added to struct fs_dirent.
SquashFS should not fill these fields with random data. Ensure that they
are zeroed out.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
3 years agopowerpc: fix regression in arch_initr_trap()
Matt Merhar [Mon, 17 May 2021 17:32:48 +0000 (17:32 +0000)]
powerpc: fix regression in arch_initr_trap()

The assembly output of the arch_initr_trap() function differed by a
single byte after common.h was removed from traps.c:

 fff49a18 <arch_initr_trap>:
 fff49a18:      94 21 ff f0     stwu    r1,-16(r1)
 fff49a1c:      7c 08 02 a6     mflr    r0
 fff49a20:      90 01 00 14     stw     r0,20(r1)
-fff49a24:      80 62 00 44     lwz     r3,68(r2)
+fff49a24:      80 62 00 38     lwz     r3,56(r2)
 fff49a28:      4b ff 76 19     bl      fff41040 <trap_init>
 fff49a2c:      80 01 00 14     lwz     r0,20(r1)
 fff49a30:      38 60 00 00     li      r3,0
 fff49a34:      38 21 00 10     addi    r1,r1,16
 fff49a38:      7c 08 03 a6     mtlr    r0

This was causing a consistent hard lockup during the MMC read / loading
of the QoriQ FMan firmware on a P2041RDB board.

Re-adding the header causes identical assembly to be emitted and allows
the firmware loading and subsequent boot to succeed.

Fixes: 401d1c4f5d ("common: Drop asm/global_data.h from common header")
Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
3 years agopart: Add check for NULL dev_part_str
Sean Anderson [Sat, 15 May 2021 18:13:54 +0000 (14:13 -0400)]
part: Add check for NULL dev_part_str

Some callers (e.g. cmd/fs.c) of fs_set_blk_dev may use a NULL dev_part_str.
While blk_get_device_part_str handles this fine,
part_get_info_by_dev_and_name does not. This fixes commands crashing when
implicitly using bootdevice.

The unit test has also been updated to set bootdevice to a known value and
to restore it after we are done.

Fixes: 7194527b6a ("cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions")
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopinctrl: single: Fix probe failure getting register area size
Vignesh Raghavendra [Fri, 7 May 2021 09:10:34 +0000 (14:40 +0530)]
pinctrl: single: Fix probe failure getting register area size

If reg property of pinctrl-single node requires address translation then
probe fails with following message:

single-pinctrl pinctrl@4301c000: failed to get base register size

This is because driver uses dev_read_addr_size() to get size which also
tries to fetch untranslated addr and fails.
Fix this by using dev_read_addr_size_index() which takes care of address
translation and also makes following dev_read_addr() call redundant.

This fixes Ethernet failures on TI's AM654 based EVMs due to lack of
pinmux configuration.

Fixes: 9fd8a430f3 ("pinctrl: single: get register area size by device API")
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Tue, 25 May 2021 15:58:50 +0000 (11:58 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agonet: Remove ne2000 driver
Tom Rini [Tue, 25 May 2021 15:54:12 +0000 (11:54 -0400)]
net: Remove ne2000 driver

With the last user of this driver removed, remove the driver.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'efi-2021-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 25 May 2021 15:48:55 +0000 (11:48 -0400)]
Merge tag 'efi-2021-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-07-rc4

Documentation:

* correct mmc man-page

Bug fixes:

* reduce code size of efidebug command
* remove 31 character limit for file paths in efidebug command
* fix build warning in the TCG2 protocol implementation

3 years agoMerge tag 'mips-pull-2021-05-25' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 25 May 2021 15:48:37 +0000 (11:48 -0400)]
Merge tag 'mips-pull-2021-05-25' of https://source.denx.de/u-boot/custodians/u-boot-mips

- MIPS: octeon: fix CFI flash setup
- MIPS: remove qemu_mips boards

3 years agodoc: update and fix Qemu MIPS documentation
Daniel Schwierzeck [Wed, 21 Apr 2021 19:13:14 +0000 (21:13 +0200)]
doc: update and fix Qemu MIPS documentation

Update description to use the MIPS Malta board for Qemu.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 years agoMIPS: remove deprecated qemu_mips board
Daniel Schwierzeck [Wed, 21 Apr 2021 19:13:13 +0000 (21:13 +0200)]
MIPS: remove deprecated qemu_mips board

Remove qemu_mips boards because DM migration doesn't make sense.
The board support for qemu_mips is already marked as deprecated
in Qemu in favour of the Malta board. Also qemu_mips support
has been removed from Linux a long time ago.

The official replacement is the Malta board. The same Malta U-Boot
image can be used with Qemu and on physical hardware.
All combinations of Big Endian and Little Endian as well as 32 bit
and 64 bit are supported.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 years agomips: octeon: octeon_ebb7304_defconfig: Fix CFI flash setup
Stefan Roese [Mon, 26 Apr 2021 14:43:18 +0000 (16:43 +0200)]
mips: octeon: octeon_ebb7304_defconfig: Fix CFI flash setup

This patch makes the necessary adjustments in the defconfig to fully
support the CFI flash on the Octeon EBB7304.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 years agoefi_loader: Fix -Wextra warning for EFI TCG2
Ilias Apalodimas [Tue, 25 May 2021 11:35:31 +0000 (14:35 +0300)]
efi_loader: Fix -Wextra warning for EFI TCG2

Compiling with -Wextra produces a number of (harmless) warnings for the EFI
TCG2 protocol.  Let's fix those in case we ever enable the flag on the EFI
subsystem

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: simplify accessing variables
Heinrich Schuchardt [Mon, 24 May 2021 09:10:59 +0000 (11:10 +0200)]
efi_loader: simplify accessing variables

Use efi_get_variable_int() instead of EFI_CALL(RT->get_variable()).
Use efi_set_variable_int() instead of EFI_CALL(efi_set_variable()).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: use efi_create_indexed_name()
Heinrich Schuchardt [Mon, 24 May 2021 08:57:03 +0000 (10:57 +0200)]
efi_loader: use efi_create_indexed_name()

Simplify the creation of indexed variable names like 'Boot0000' by using
function efi_create_indexed_name().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: simplify show_efi_boot_order()
Heinrich Schuchardt [Mon, 24 May 2021 08:48:45 +0000 (10:48 +0200)]
efi_loader: simplify show_efi_boot_order()

To print a UTF-16 string use %ls instead of converting string to UTF-8.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: simplify show_efi_boot_opt_data()
Heinrich Schuchardt [Mon, 24 May 2021 08:35:25 +0000 (10:35 +0200)]
efi_loader: simplify show_efi_boot_opt_data()

To print a UTF-16 string use %ls instead of converting string to UTF-8.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: path length in efi_dp_from_name()
Heinrich Schuchardt [Tue, 25 May 2021 10:07:30 +0000 (12:07 +0200)]
efi_loader: path length in efi_dp_from_name()

Before this patch efi_dp_from_name() only accommodated a maximum file path
length of 31 characters. This leads to boot failures due to file name
truncation.

Allow arbitrary path lengths.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled
Masahisa Kojima [Fri, 14 May 2021 00:53:36 +0000 (09:53 +0900)]
efi_loader: expose efi_image_parse() even if UEFI Secure Boot is disabled

This is preparation for PE/COFF measurement support.
PE/COFF image hash calculation is same in both
UEFI Secure Boot image verification and measurement in
measured boot. PE/COFF image parsing functions are
gathered into efi_image_loader.c, and exposed even if
UEFI Secure Boot is not enabled.

This commit also adds the EFI_SIGNATURE_SUPPORT option
to decide if efi_signature.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: remove weak efi_get_public_key_data()
Heinrich Schuchardt [Thu, 20 May 2021 02:08:11 +0000 (04:08 +0200)]
efi_loader: remove weak efi_get_public_key_data()

Configuring a system with CONFIG_EFI_CAPSULE_AUTHENTICATE=y but without a
method to retrieve the public key data is a misconfiguration. We should get
a build failure for it. Therefore remove the weak efi_get_public_key_data()
implementation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: usage: modify mmc man-page
Jaehoon Chung [Mon, 10 May 2021 07:04:02 +0000 (16:04 +0900)]
doc: usage: modify mmc man-page

Modify mmc man-page.
- Change a description about mmc erase command.
- Add whitespace to distinguish.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoPrepare v2021.07-rc3
Tom Rini [Tue, 25 May 2021 00:53:13 +0000 (20:53 -0400)]
Prepare v2021.07-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>