platform/kernel/u-boot.git
16 months agotrace: Relax test requirements
Simon Glass [Fri, 17 Feb 2023 22:45:16 +0000 (15:45 -0700)]
trace: Relax test requirements

We expect the profile and bootstage to agree on timing, but when
running on slow machines there can be a larger descrepency. Increase the
tolerance to fix this.

Fixes: 9cea4797aeb ("trace: Add a test")
Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agox86: Pass -z execstack for EFI payload flags
Tom Rini [Tue, 14 Feb 2023 20:09:32 +0000 (15:09 -0500)]
x86: Pass -z execstack for EFI payload flags

To match how we link EFI executables elsewhere, and to silence a linker
warning, pass -z execstack here as well.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoMakefile: Link with -z noexectack
Tom Rini [Tue, 14 Feb 2023 20:09:31 +0000 (15:09 -0500)]
Makefile: Link with -z noexectack

When moving to gcc-12.2 we started trying to quiet some of the new
linker warnings, that are not relevant to us. However, a
misunderstanding of the mechanics at play meant that I intentionally
omitted passing -z noexecstack to the linker, when we do need to. Add
this flag and in turn remove warnings from the linker.

Fixes: 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agofs: btrfs: limit the mapped length to the original length
Qu Wenruo [Mon, 13 Feb 2023 00:37:59 +0000 (08:37 +0800)]
fs: btrfs: limit the mapped length to the original length

[BUG]
There is a bug report that btrfs driver caused hang during file read:

  This breaks btrfs on the HiFive Unmatched.

  => pci enum
  PCIE-0: Link up (Gen1-x8, Bus0)
  => nvme scan
  => load nvme 0:2 0x8c000000 /boot/dtb/sifive/hifive-unmatched-a00.dtb
  [hangs]

[CAUSE]
The reporter provided some debug output:

  read_extent_data: cur=615817216, orig_len=16384, cur_len=16384
  read_extent_data: btrfs_map_block: cur_len=479944704; ret=0
  read_extent_data: ret=0
  read_extent_data: cur=615833600, orig_len=4096, cur_len=4096
  read_extent_data: btrfs_map_block: cur_len=479928320; ret=0

Note the second and the last line, the @cur_len is 450+MiB, which is
almost a chunk size.

And inside __btrfs_map_block(), we limits the returned value to stripe
length, but that's depending on the chunk type:

if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
 BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 |
 BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 |
 BTRFS_BLOCK_GROUP_RAID10 |
 BTRFS_BLOCK_GROUP_DUP)) {
/* we limit the length of each bio to what fits in a stripe */
*length = min_t(u64, ce->size - offset,
      map->stripe_len - stripe_offset);
} else {
*length = ce->size - offset;
}

This means, if the chunk is SINGLE profile, then we don't limit the
returned length at all, and even for other profiles, we can still return
a length much larger than the requested one.

[FIX]
Properly clamp the returned length, preventing it from returning a much
larger range than expected.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Qu Wenruo <wqu@suse.com>
16 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 22 Feb 2023 18:36:29 +0000 (13:36 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb

- DWC3 bugfix

16 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-socfpga
Tom Rini [Wed, 22 Feb 2023 14:28:03 +0000 (09:28 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-socfpga

- chameleonv3 updates

16 months agochameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig
Paweł Anikiel [Tue, 21 Feb 2023 15:17:06 +0000 (16:17 +0100)]
chameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig

This file was missed during the conversion process. Add the symbol to
defconfig.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoarm: dts: chameleonv3: Add 270-2 variant
Paweł Anikiel [Tue, 21 Feb 2023 15:17:05 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Add 270-2 variant

Add devicetree for chameleonv3 with the 270-2I2-D11E variant of the
Mercury+ AA1 module

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoarm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi
Paweł Anikiel [Tue, 21 Feb 2023 15:17:04 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi

This file is included by the different chameleonv3 variants. Change the
name to .dtsi.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoarm: dts: chameleonv3: Override chameleonv3 bitstream names
Paweł Anikiel [Tue, 21 Feb 2023 15:17:03 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Override chameleonv3 bitstream names

Set the bitstream name per Chameleon variant. This allows the same
boot filesystem with all bitstream variants to be used on different
boards.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agosocfpga: chameleonv3: Move environment to a text file
Paweł Anikiel [Tue, 21 Feb 2023 15:17:02 +0000 (16:17 +0100)]
socfpga: chameleonv3: Move environment to a text file

Move the environment to an easily editable text file in the boot
partition

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agosocfpga: chameleonv3: Enable ext4 in SPL
Paweł Anikiel [Tue, 21 Feb 2023 15:17:01 +0000 (16:17 +0100)]
socfpga: chameleonv3: Enable ext4 in SPL

Allow SPL to boot from an ext4 filesystem.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agousb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio
Venkatesh Yadav Abbarapu [Fri, 13 Jan 2023 05:12:02 +0000 (10:42 +0530)]
usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio

As the "reset-gpios" property is optional, don't return the
error and just skip the gpio reset sequence.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
16 months agoMerge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 19 Feb 2023 22:03:30 +0000 (17:03 -0500)]
Merge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc3

Documentation

* Add a document for the RISC-V architecture
* Move gateworks and bcm7xxx documentation to HTML

UEFI

* measure the loaded device-tree
* make CapsuleMax configurable and provide sensible default

16 months agodoc: remove superfluous warning
Heinrich Schuchardt [Sun, 19 Feb 2023 20:26:24 +0000 (21:26 +0100)]
doc: remove superfluous warning

We have been using Sphinx >=3 since 2020. We don't expect issues.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX
Etienne Carriere [Thu, 16 Feb 2023 17:21:41 +0000 (18:21 +0100)]
efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX

Adds CONFIG_EFI_CAPSULE_MAX to configure the max index value used in
EFI capsule reports. Prior to this change is the hard coded value was
65535 which would exceed available storage for variables. Now the
default value is 15 which should work fine with most systems.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
16 months agoefi_loader: Measure the loaded DTB
Etienne Carriere [Thu, 16 Feb 2023 16:29:48 +0000 (17:29 +0100)]
efi_loader: Measure the loaded DTB

Measures the DTB passed to the EFI application upon new boolean config
switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
content of the DTB passed to the OS can change across reboots, there is
not point measuring it hence the config switch to allow platform to not
embed this feature.

Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
16 months agoefi_loader: fix wrong attribute check for QueryVariableInfo
Masahisa Kojima [Wed, 15 Feb 2023 02:32:17 +0000 (11:32 +0900)]
efi_loader: fix wrong attribute check for QueryVariableInfo

QueryVariableInfo with EFI_VARIABLE_HARDWARE_ERROR_RECORD is
accepted, remove wrong attribute check.

Fixes: 454a9442fbce ("efi_loader: update attribute check for QueryVariableInfo()")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoefi_loader: avoid buffer overrun in efi_var_mem_compare
Heinrich Schuchardt [Mon, 13 Feb 2023 18:22:33 +0000 (19:22 +0100)]
efi_loader: avoid buffer overrun in efi_var_mem_compare

We should not scan beyond the end of string name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: arch: Add document for RISC-V architecture
Yu Chien Peter Lin [Tue, 14 Feb 2023 10:18:51 +0000 (18:18 +0800)]
doc: arch: Add document for RISC-V architecture

This patch adds a brief introduction to the RISC-V architecture and
the typical boot process used on a variety of RISC-V platforms.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agoboard: gateworks: venice: move README to RST
Tim Harvey [Mon, 13 Feb 2023 17:44:27 +0000 (09:44 -0800)]
board: gateworks: venice: move README to RST

Move board/gateworks/venice/README to RST documentation.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
16 months agodoc: board: bcm7xxx: Convert to reStructuredText format
Thomas Fitzsimmons [Mon, 13 Feb 2023 16:21:27 +0000 (11:21 -0500)]
doc: board: bcm7xxx: Convert to reStructuredText format

Convert the documentation for the Broadcom BCM7445 and BCM7260 boards
to reStructuredText format and add the new filename to
doc/board/broadcom/index.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
16 months agodoc: devicetree: dt_qemu.rst: Fix the typo and space
Yu Chien Peter Lin [Sun, 12 Feb 2023 07:09:51 +0000 (15:09 +0800)]
doc: devicetree: dt_qemu.rst: Fix the typo and space

Fix typo and whitespace in the document.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
16 months agoMerge branch '2023-02-17-assorted-fixes'
Tom Rini [Fri, 17 Feb 2023 19:18:46 +0000 (14:18 -0500)]
Merge branch '2023-02-17-assorted-fixes'

- avb_verify bugfix, and cpsw_mdio bugfix

16 months agocommon: avb_verify: prevent opening incorrect session
Ivan Khoronzhuk [Fri, 27 Jan 2023 20:02:14 +0000 (22:02 +0200)]
common: avb_verify: prevent opening incorrect session

The arg->session is not valid if arg->ret != NULL, so can't be
assigned, correct this.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
16 months agocpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive
Ulf Samuelsson [Tue, 7 Feb 2023 08:25:27 +0000 (09:25 +0100)]
cpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive

cpsw_mdio_get_alive reads the wrong register.
See page 2316 in SPRUH73Q AM335x TRM

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
16 months agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 17 Feb 2023 14:58:06 +0000 (09:58 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 17 Feb 2023 14:03:35 +0000 (09:03 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- binman: Add help message if opensbi is absent when building u-boot SPL
- AndesTech: rename cpu and board name to 'andesv5' and 'ae350'
- Clean up cache operation for Andes ae350 platform

16 months agoriscv: binman: Add help message for missing blobs
Rick Chen [Fri, 17 Feb 2023 08:57:01 +0000 (16:57 +0800)]
riscv: binman: Add help message for missing blobs

Add the 'missing-msg' for more detailed output
on missing system firmware.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
16 months agoriscv: ae350: Adjust the memory layout of ae350
Leo Yu-Chi Liang [Tue, 14 Feb 2023 12:42:50 +0000 (20:42 +0800)]
riscv: ae350: Adjust the memory layout of ae350

Adjust the initial stack pointer address to 0x10000000(256M)

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: Rename Andes cpu and board names
Leo Yu-Chi Liang [Tue, 14 Feb 2023 12:42:49 +0000 (20:42 +0800)]
riscv: Rename Andes cpu and board names

The current ae350-related defconfigs could also
support newer Andes CPU IP, so modify the names of CPU
from ax25 to andesv5, and board name from ax25-ae350 to ae350.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agodriver: cache-v5l2: Fix type casting warning on RV32
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:53 +0000 (16:10 +0800)]
driver: cache-v5l2: Fix type casting warning on RV32

This patch fixes following warning for the riscv32 toolchain.

drivers/cache/cache-v5l2.c:122:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  122 |         regs = (struct l2cache *)dev_read_addr(dev);
      |                ^

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
16 months agoconfigs: ae350: Display CPU and board info for AE350 platforms
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:52 +0000 (16:10 +0800)]
configs: ae350: Display CPU and board info for AE350 platforms

Display information about CPU and board during start up.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoconfigs: ae350: Increase maximum retry count for AE350 platforms
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:51 +0000 (16:10 +0800)]
configs: ae350: Increase maximum retry count for AE350 platforms

Loading an image via TFTP is often interrupted when retrying more than
10 times, increase the number of retries so that it does not simply stop
the transfer.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
16 months agoconfigs: ae350: Enable v5l2 cache for AE350 platforms in SPL
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:50 +0000 (16:10 +0800)]
configs: ae350: Enable v5l2 cache for AE350 platforms in SPL

To reduce the code size, CONFIG_V5L2_CACHE was disabled since commit:
ca06444aac2c643db3a3f2eb37afc60fae15177e

Turing on does not significantly increase the size of u-boot-spl.bin,
so we enable it by default to improve performance.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: ax25: cache.c: Cleanups to L1/L2 cache function used in SPL
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:49 +0000 (16:10 +0800)]
riscv: ax25: cache.c: Cleanups to L1/L2 cache function used in SPL

This patch refines L1 cache enable/disable and v5l2-cache enable
functions.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: ae350: dts: Update L2 cache compatible string
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:48 +0000 (16:10 +0800)]
riscv: ae350: dts: Update L2 cache compatible string

Update the compatible string of L2 cache.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: cpu: ax25: Simplify cache enabling logic in harts_early_init()
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:47 +0000 (16:10 +0800)]
riscv: cpu: ax25: Simplify cache enabling logic in harts_early_init()

As the OpenSBI v1.2 does not enable the cache [0], we enable
the i/d-cache in harts_early_init() and do not disable in
cleanup_before_linux(). This patch also simplifies the logic
and moves the CSR encoding to include/asm/arch-andes/csr.h.

[0] https://github.com/riscv-software-src/opensbi/commit/bd7ef4139829da5c30fa980f7498d385124408fa

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agodriver: cache: cache-v5l2: Update memory-mapped scheme to support Gen2 platform
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:46 +0000 (16:10 +0800)]
driver: cache: cache-v5l2: Update memory-mapped scheme to support Gen2 platform

The L2C configuration register has MAP field to indicate its version
is v0 (Gen1) or v1 (Gen2) L2-cache. This patch makes the driver
compatible with both memory-mapped scheme.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoboard: AndesTech: ax25-ae350.c: Enable v5l2-cache in spl_board_init()
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:45 +0000 (16:10 +0800)]
board: AndesTech: ax25-ae350.c: Enable v5l2-cache in spl_board_init()

The L2-cache is not enabled currently, the enbale_caches() will call
the v5l2_enable() callback to enable it in SPL.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: Remove redundant Kconfig "RISCV_NDS_CACHE"
Leo Yu-Chi Liang [Mon, 6 Feb 2023 08:10:44 +0000 (16:10 +0800)]
riscv: Remove redundant Kconfig "RISCV_NDS_CACHE"

There is no need for RISCV_NDS_CACHE config to control cache switches.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoriscv: global_data.h: Correct the comment for PLICSW
Yu Chien Peter Lin [Mon, 6 Feb 2023 02:06:29 +0000 (10:06 +0800)]
riscv: global_data.h: Correct the comment for PLICSW

PLIC is used for external interrupt, while PLICSW is an Andes-specific
design for software interrupt.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
16 months agoPrepare v2023.04-rc2
Tom Rini [Mon, 13 Feb 2023 23:39:15 +0000 (18:39 -0500)]
Prepare v2023.04-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agoclocks: qcs404: Add support for I2C clocks
Sumit Garg [Mon, 13 Feb 2023 04:49:09 +0000 (10:19 +0530)]
clocks: qcs404: Add support for I2C clocks

Co-developed-by: Mike Worsfold <mworsfold@impinj.com>
Signed-off-by: Mike Worsfold <mworsfold@impinj.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
16 months agoMerge tag 'i2c-updates-for-v2023.04' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 13 Feb 2023 14:57:35 +0000 (09:57 -0500)]
Merge tag 'i2c-updates-for-v2023.04' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c updates for v2023.04

- add new i2c driver ast2600 from Ryan Chen

- i2c-cdns: make read fifo-depth configurable through device tree
  from Pei Yue Ho

- mxc i2c driver: print base address in hex, not in decimal
  from Fabio

16 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 13 Feb 2023 14:39:15 +0000 (09:39 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Support for 2 new Armada 385 boards (Tony)
- mvebu: Minor misc board enhancements (Tony)
- kirkwood: Serial driver fixes (Kconfig & dtsi) (Tony)
- cmd: return code when tlv_eeprom incorrectly called (Heinrich)

16 months agoarm: kirkwood: Enable uart0 dm-pre-reloc for Pogoplug V4 board
Tony Dinh [Fri, 10 Feb 2023 21:08:17 +0000 (13:08 -0800)]
arm: kirkwood: Enable uart0 dm-pre-reloc for Pogoplug V4 board

When DM_SERIAL is enabled, the device-tree tag u-boot,dm-pre-reloc is
required for this board to boot over UART with kwboot. Enable this in
kirkwood-pogoplug-series-4-u-boot.dtsi.

Added by Stefan while applying:
Please note that it's not fully understood, why this property really
is needed. Here a link to the discussion about this:

https://lore.kernel.org/r/20230201080210.ypz4nrj4y2igwxz3@pali/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoarm: mvebu: Add support for Synology DS116 (Armada 385)
Tony Dinh [Thu, 9 Feb 2023 22:00:03 +0000 (14:00 -0800)]
arm: mvebu: Add support for Synology DS116 (Armada 385)

Synology DS116 is a NAS based on Marvell Armada 385 SoC.

Board Specification:

- Marvel MV88F6820 Dual Core at 1.8GHz
- 1 GiB DDR3 RAM
- 8MB Macronix mx25l6405d SPI flash
- I2C
- 2x USB 3.0
- 1x GBE LAN port (PHY: Marvell 88E1510)
- 1x SATA (6 Gbps)
- 3x LED
- PIC16F1829 (connected to uart1)
- GPIO fan
- serial console

Note that this patch depends on the add-support for Thecus N2350 patch:
https://patchwork.ozlabs.org/project/uboot/patch/20230201231306.7010-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
16 months agoarm: mvebu: Power up 2nd SATA port for Thecus N2350
Tony Dinh [Tue, 7 Feb 2023 01:00:11 +0000 (17:00 -0800)]
arm: mvebu: Power up 2nd SATA port for Thecus N2350

Currently, only the 1st SATA port is powered up (by GPIO1 12).
Add GPIO1 13 in board initialization to power up the 2nd SATA port.

Note that this patch depends on the initial add-support patch:
https://patchwork.ozlabs.org/project/uboot/patch/20230201231306.7010-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoarm: kirkwood: sheevaplug: reduce u-boot image size
Tony Dinh [Thu, 2 Feb 2023 22:16:53 +0000 (14:16 -0800)]
arm: kirkwood: sheevaplug: reduce u-boot image size

Sheevaplug board has 512K CONFIG_BOARD_SIZE_LIMIT. Recently, DM_SERIAL has
pushed the image size a few hundred bytes over that limit. So explicitly
deselect some configs that are unrelated to this board
(and gain back a bit over 2K).

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
16 months agoarm: mvebu: Add support for Thecus N2350 (Armada 385) board
Tony Dinh [Wed, 1 Feb 2023 23:13:05 +0000 (15:13 -0800)]
arm: mvebu: Add support for Thecus N2350 (Armada 385) board

Thecus N2350 is a NAS based on Marvell Armada 385 SoC.

Specification:

- Processor: Marvel MV88F6820 Dual Core at 1GHz
- 1 GiB DDR4 RAM
- 4MB Macronix mx25l3205d SPI flash
- 512MB Hynix H27U4G8F2DTR-BC NAND flash
- I2C
- 2x USB 3.0
- 1x GBE LAN port (PHY: Marvell 88E1510)
- 2x SATA (hot swap slots)
- 3x buttons
- 10x LEDS
- serial console

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoarm: kirkwood: Use CONFIG_SYS_NS16550 with DM_SERIAL for Kirkwood boards
Tony Dinh [Tue, 31 Jan 2023 22:06:54 +0000 (14:06 -0800)]
arm: kirkwood: Use CONFIG_SYS_NS16550 with DM_SERIAL for Kirkwood boards

CONFIG_SYS_NS16550 is required when DM_SERIAL is enabled for
Kirkwood boards.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agocmd: return code when tlv_eeprom incorrectly called
Heinrich Schuchardt [Fri, 27 Jan 2023 21:49:10 +0000 (22:49 +0100)]
cmd: return code when tlv_eeprom incorrectly called

A command called with incorrect parameters should set $? to 1 (false).
Instead of calling cmd_usage(cmdtp) and then returning 0 just return
CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
16 months agoi2c: i2c-cdns.c: Update driver to read fifo-depth from device tree
Pei Yue Ho [Mon, 13 Feb 2023 08:02:41 +0000 (00:02 -0800)]
i2c: i2c-cdns.c: Update driver to read fifo-depth from device tree

Enable driver to fetch the optional parameter (fifo-depth) from device
tree. If the parameter is not found in the device tree, it will use
the default value declared in the driver.

Signed-off-by: Pei Yue Ho <peiyue.ho@starfivetech.com>
Reviewed-by: Wei Liang Lim <weiliang.lim@starfivetech.com>
Reviewed-by: Eng Lee Teh <englee.teh@starfivetech.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agodt-bindings: i2c: i2c-cdns.txt: Add description for an optional parameter, fifo-depth
Pei Yue Ho [Mon, 13 Feb 2023 08:02:40 +0000 (00:02 -0800)]
dt-bindings: i2c: i2c-cdns.txt: Add description for an optional parameter, fifo-depth

Add description for fifo-depth parameter that can be used
in the device tree.

Signed-off-by: Pei Yue Ho <peiyue.ho@starfivetech.com>
Reviewed-by: Wei Liang Lim <weiliang.lim@starfivetech.com>
Reviewed-by: Eng Lee Teh <englee.teh@starfivetech.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoarm: aspeed: dtsi: add reg for i2c
Ryan Chen [Mon, 30 Jan 2023 06:19:25 +0000 (14:19 +0800)]
arm: aspeed: dtsi: add reg for i2c

The i2c driver have global register that i2c bus use
ofnode_get_parent to get parent register address.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoi2c:aspeed:support ast2600 i2c new register mode driver
Ryan Chen [Mon, 30 Jan 2023 06:19:24 +0000 (14:19 +0800)]
i2c:aspeed:support ast2600 i2c new register mode driver

Add i2c new register mode driver to support AST2600 i2c
new register mode. AST2600 i2c controller have legacy and
new register mode. The new register mode have global register
support 4 base clock for scl clock selection, and new clock
divider mode.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoi2c: mxc_i2c: Use hex notation for the base address
Fabio Estevam [Tue, 3 Jan 2023 19:03:44 +0000 (16:03 -0300)]
i2c: mxc_i2c: Use hex notation for the base address

Printing the I2C controller base address in decimal notation
is not helpful.

Change it to hex notation, which is the standard format found
in the Reference Manual and devicetree.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
16 months agoMerge tag 'dm-pull-12feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Mon, 13 Feb 2023 01:11:22 +0000 (20:11 -0500)]
Merge tag 'dm-pull-12feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm

minor changes to fdt command and binman

16 months agocmd: fdt: allow standalone "fdt move"
Andre Przywara [Fri, 10 Feb 2023 11:02:12 +0000 (11:02 +0000)]
cmd: fdt: allow standalone "fdt move"

At the moment every subcommand of "fdt", except "addr" itself, requires
the DT address to be set first. We explicitly check for that before even
comparing against the subcommands' string.
This early bailout also affects the "move" subcommand, even though that
does not require or rely on a previous call to "fdt addr". In fact it
even sets the FDT address to the target of the move command, so is a
perfect beginning for a sequence of fdt commands.

Move the check for a previously set FDT address to after we handle the
"move" command also, so we don't need a dummy call to "fdt addr" first,
before being able to move the devicetree.

This skips one pointless "fdt addr" call in scripts which aim to alter
the control DT, but need to copy it to a safe location first (for
instance to $fdt_addr_r).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: move: Use map_sysmem to convert pointers
Andre Przywara [Fri, 10 Feb 2023 11:02:11 +0000 (11:02 +0000)]
cmd: fdt: move: Use map_sysmem to convert pointers

The "fdt move" subcommand was using the provided DTB addresses directly,
without trying to "map" them into U-Boot's address space. This happened
to work since on the vast majority of "real" platforms there is a simple
1:1 mapping of VA to PAs, so either value works fine.

However this is not true on the sandbox, so the "fdt move" command fails
there miserably:
=> fdt addr $fdtcontroladdr
=> cp.l $fdtcontroladdr $fdt_addr_r 40  # simple memcpy works
=> fdt move $fdtcontroladdr $fdt_addr_r
Segmentation fault

Use the proper "map_sysmem" call to convert PAs to VAs, to make this
more robust in general and to enable operation in the sandbox.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Show the image name for the top-level section
Simon Glass [Tue, 7 Feb 2023 21:34:18 +0000 (14:34 -0700)]
binman: Show the image name for the top-level section

At present we show 'main section' as the top-level section name. It may
be more helpful to show the actual image name. This is tricky because
Image is a parent class of Entry_section, so there is no distinction
between an image and a section.

Update it to show the image name.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agosocfpga: fix the serial console on DE1-SoC
Jade Lovelace [Sat, 11 Feb 2023 01:15:26 +0000 (17:15 -0800)]
socfpga: fix the serial console on DE1-SoC

Previously, the TX LED would flash but nothing would appear on the
serial port, and the board would appear dead with a build of the
socfpga_cyclone5_defconfig. I have verified that adding the frequency to
the uart will fix the serial console on my board.

Thanks to @ehoffman on the Rocketboards forum:
https://forum.rocketboards.org/t/cyclonev-programming-fpga-from-u-boot/2230/30

Signed-off-by: Jade Lovelace <lists@jade.fyi>
Reviewed-by: Marek Vasut <marex@denx.de>
16 months agoMerge tag 'clk-2023.04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-clk
Tom Rini [Sun, 12 Feb 2023 20:25:32 +0000 (15:25 -0500)]
Merge tag 'clk-2023.04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-clk

Clock changes for 2023.04-rc1

This contains various fixes and small features. I've included a reset patch as
well since it was in the same series as a clock patch.

16 months agoMerge branch 'for-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx
Tom Rini [Sun, 12 Feb 2023 20:25:09 +0000 (15:25 -0500)]
Merge branch 'for-2023.04' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx

- A fix for a long standing bug that has been exposed by commit
  50128aeb0f8 ("cyclic: get rid of cyclic_init()") preventing 8xx boards
  from booting since u-boot 2023.01
- A GPIO driver for powerpc 8xx chip
- Fixup for powerpc 8xx SPI driver
- A new powerpc 8xx board
- The two devices having that board.

16 months agoreset: Allow reset_get_by_name() with NULL name
Samuel Holland [Sun, 22 Jan 2023 00:02:52 +0000 (18:02 -0600)]
reset: Allow reset_get_by_name() with NULL name

This allows devm_reset_control_get(dev, NULL) to work and get the first
reset control, which is common in code ported from Linux.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230122000252.53642-2-samuel@sholland.org
16 months agoclk: Allow clk_get_by_name() with NULL name
Samuel Holland [Sun, 22 Jan 2023 00:02:51 +0000 (18:02 -0600)]
clk: Allow clk_get_by_name() with NULL name

This allows devm_clock_get(dev, NULL) to work and get the first clock,
which is common in code ported from Linux.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Link: https://lore.kernel.org/r/20230122000252.53642-1-samuel@sholland.org
16 months agocmd: clk: probe the clock before dump them
Patrick Delaunay [Tue, 13 Dec 2022 13:57:10 +0000 (14:57 +0100)]
cmd: clk: probe the clock before dump them

The clock UCLASS need to be probed to allow availability of the
private data (struct clk *), get in show_clks() with dev_get_clk_ptr()
before use them.

Without this patch the clock dump can cause crash because all the
private data are not available before calling the API clk_get_rate().

It is the case for the SCMI clocks, priv->channel is needed for
scmi_clk_get_rate() and it is initialized only in scmi_clk_probe().
This issue causes a crash for "clk dump" command on STM32MP135F-DK board
for SCMI clock not yet probed.

Fixes: 1a725e229096 ("clk: fix clock tree dump to properly dump out every registered clock")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221213145708.v2.1.Ia0bc6b272f1e2e3f37873c61d79138c2663c4055@changeid
16 months agoclk: imx8mn: fix imx8mn_enet_phy_sels clocks list
Dario Binacchi [Mon, 19 Dec 2022 11:31:26 +0000 (12:31 +0100)]
clk: imx8mn: fix imx8mn_enet_phy_sels clocks list

[backport from linux commit 2626cf67f20b28446dfc3a5b9493dd535cdb747b]

According to the "Clock Root" table of the reference manual (document
IMX8MNRM Rev 2, 07/2022):

     Clock Root         offset     Source Select (CCM_TARGET_ROOTn[MUX])
        ...              ...                    ...
 ENET_PHY_REF_CLK_ROOT  0xAA80            000 - 24M_REF_CLK
                                          001 - SYSTEM_PLL2_DIV20
                                          010 - SYSTEM_PLL2_DIV8
                                          011 - SYSTEM_PLL2_DIV5
                                          100 - SYSTEM_PLL2_DIV2
                                          101 - AUDIO_PLL1_CLK
                                          110 - VIDEO_PLL_CLK
                                          111 - AUDIO_PLL2_CLK
        ...              ...                    ...

while the imx8mn_enet_phy_sels list didn't contained audio_pll1_out for
source select bits 101b.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221219113127.528282-4-dario.binacchi@amarulasolutions.com
16 months agoclk: imx: rename video_pll1 to video_pll
Dario Binacchi [Mon, 19 Dec 2022 11:31:25 +0000 (12:31 +0100)]
clk: imx: rename video_pll1 to video_pll

[backport from linux commit bedcf9d1dcf88ed38731f0ac9620e5a421e1e9d6]

Unlike audio_pll1 and audio_pll2, there is no video_pll2. Further, the
name used in the RM is video_pll. So, let's rename "video_pll1" to
"video_pll" to be consistent with the RM and avoid misunderstandings.

No functional changes intended.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221219113127.528282-3-dario.binacchi@amarulasolutions.com
16 months agoclk: imx8mn: rename vpu_pll to m7_alt_pll
Dario Binacchi [Mon, 19 Dec 2022 11:31:24 +0000 (12:31 +0100)]
clk: imx8mn: rename vpu_pll to m7_alt_pll

[backport from linux commit a429c60baefd95ab43a2ce7f25d5b2d7a2e431df]

The IMX8MN platform does not have any video processing unit (VPU), and
indeed in the reference manual (document IMX8MNRM Rev 2, 07/2022) there
is no occurrence of its pll. From an analysis of the code and the RM
itself, I think vpu pll is used instead of m7 alternate pll, probably
for copy and paste of code taken from modules of similar architectures.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221219113127.528282-2-dario.binacchi@amarulasolutions.com
16 months agoclk: nuvoton: fix bug for calculate pll clock
Jim Liu [Mon, 21 Nov 2022 09:15:28 +0000 (17:15 +0800)]
clk: nuvoton: fix bug for calculate pll clock

Fix bug for npcm7xx bmc calculate pll clock.
PLLCON1 need to divide by 2.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Acked-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20221121091528.1351-1-JJLIU0@nuvoton.com
16 months agolmb: Treat a region which is a subset as equal
Sjoerd Simons [Sun, 12 Feb 2023 15:07:05 +0000 (16:07 +0100)]
lmb: Treat a region which is a subset as equal

In various cases logical memory blocks are coalesced; As a result doing
a strict check whether memory blocks are the same doesn't necessarily
work as a previous addition of a given block might have been merged into
a bigger block.

Fix this by considering a block is already registered if it's a pure
subset of one of the existing blocks.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
16 months agoMerge branch '2023-02-10-update-trace-feature-to-work-with-trace-cmd'
Tom Rini [Sun, 12 Feb 2023 15:56:54 +0000 (10:56 -0500)]
Merge branch '2023-02-10-update-trace-feature-to-work-with-trace-cmd'

To quote the author:
Since U-Boot's tracing feature was originally written, quite a few changes
have taken place in this domain. The original text format used by tracing
is still emitted by Linux, but a new trace-cmd tool has invented a binary
format which is now used by new tools, such as kernelshark.

With recent distributions and the move to Python 3, the old pybootchart
tool does not build or run. Unfortunately there is no 1:1 replacement for
the features that were provided by pybootchart, or at least it is not
obvious. Still, it makes sense to keep with the times.

This series updates proftool to use the new binary format, adding support
for function and funcgraph tracing, so that U-Boot's trace records can be
examined by trace-cmd and kernelshark.

This series also adds support for a flamegraph, which provides a visual
way to see which functions are called a lot, as well as which ones consume
the most time.

Some minor updates to the trace implementation within U-Boot are included,
to provide a little more information and to fix a few problems.

No unit tests are provided by proftool, but a functional test ensures that
sandbox can emit traces which can be processed by proftool, then parsed by
trace-cmd and that the timing of the various formats looks consistent.

16 months agoCI, Docker: Update to Jammy 2023016 tag
Tom Rini [Tue, 7 Feb 2023 17:32:19 +0000 (12:32 -0500)]
CI, Docker: Update to Jammy 2023016 tag

Move to the latest tag for "Jammy" and rebuild the containers.

Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agotrace: Update documentation
Simon Glass [Sun, 15 Jan 2023 21:16:01 +0000 (14:16 -0700)]
trace: Update documentation

Revamp the documentation for the new features, including a description of
the new features and documentation for the trace command.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Add a test
Simon Glass [Sun, 15 Jan 2023 21:16:00 +0000 (14:16 -0700)]
trace: Add a test

Add a test which runs sandbox, collects a trace and makes sure it can
be processed by trace-cmd. This should ensure that this feature continues
to work as U-Boot and trace-cmd evolve.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoDocker: Support trace-cmd
Simon Glass [Sun, 15 Jan 2023 21:15:59 +0000 (14:15 -0700)]
Docker: Support trace-cmd

Build trace-cmd as part of the docker image, so that trace tests can be
used. Unfortunately the version provided by distributions is a little old
and has bugs. It also does not support specifying the time base for the
trace, which is required to convert microseconds to nanaseconds.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Provide a flamegraph that uses timing
Simon Glass [Sun, 15 Jan 2023 21:15:58 +0000 (14:15 -0700)]
trace: Provide a flamegraph that uses timing

Add a second variant of the flame graph that shows records in terms of the
number of microseconds used by each call stack. This is a useful way of
seeing where time is going within the execution of U-Boot.

This requires a call stack that records the start time of each function,
as well as a way of subtracting all time consumed by child functions, so
that this time is not counted twice by the flamegraph. The time values in
the output are just for the function itself, not for its children.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Support output of a flamegraph
Simon Glass [Sun, 15 Jan 2023 21:15:57 +0000 (14:15 -0700)]
trace: Support output of a flamegraph

It is useful to see how many times each function is called, particularly
in the context of its callers. A flamegraph is a way of showing this.

Support output in this format which can be used by the flamegraph.pl
script, to generate an SVG image for browsing.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Support output of funcgraph records
Simon Glass [Sun, 15 Jan 2023 21:15:56 +0000 (14:15 -0700)]
trace: Support output of funcgraph records

Add support for writing ftrace records in the 'funcgraph' format, which
shows function entry and exit points as well as the time taken by each
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Use text_base from the trace header
Simon Glass [Sun, 15 Jan 2023 21:15:55 +0000 (14:15 -0700)]
trace: Use text_base from the trace header

Use the information in the trace header instead of reading it from the
trace records. Add debugging to check that System.map and the trace header
agree on this value.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Drop use of objsection
Simon Glass [Sun, 15 Jan 2023 21:15:54 +0000 (14:15 -0700)]
trace: Drop use of objsection

This feature was only partly implemented and serves no current purpose.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Update proftool to use new binary format
Simon Glass [Sun, 15 Jan 2023 21:15:53 +0000 (14:15 -0700)]
trace: Update proftool to use new binary format

The old text format is not much used anymore. Instead a new trace-cmd tool
has introduced a binary format for trace records.

Add support for generating this format. This involves removing the old
text format, adding various helpers for the new format and adjusting the
code to use an output file instead of stdout.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Rename prof to trace and improve comments
Simon Glass [Sun, 15 Jan 2023 21:15:52 +0000 (14:15 -0700)]
trace: Rename prof to trace and improve comments

The current use of 'profile' in some places is confusing. Update the code
to use the word 'trace' consistently. Change the flags to better match
their meaning and add some more comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Detect an infinite loop
Simon Glass [Sun, 15 Jan 2023 21:15:51 +0000 (14:15 -0700)]
trace: Detect an infinite loop

If something is wrong with a board's timer function such that it calls
functions not marked with notrace, U-Boot will hang.

Detect this, print a message and disable the trace.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Correct the relocation handover with buffer overflow
Simon Glass [Sun, 15 Jan 2023 21:15:50 +0000 (14:15 -0700)]
trace: Correct the relocation handover with buffer overflow

When the early trace buffer overflows it leaves a gap in the trace buffer
between where the actual data finished and where it would have finished if
there were enough buffer space. This results in corrupted output.

Adjust the logic to resolve this and add a message when the buffer
overflows.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Show a few more stats about tracing
Simon Glass [Sun, 15 Jan 2023 21:15:49 +0000 (14:15 -0700)]
trace: Show a few more stats about tracing

Add a few more useful items into the output. Update the buffers to use hex
consistently.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Track the minimum stack depth
Simon Glass [Sun, 15 Jan 2023 21:15:48 +0000 (14:15 -0700)]
trace: Track the minimum stack depth

The trace does not necessarily start at the top level, so we can see it
go negative. Track this so that we can show an accurate value for the
stack depth.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Reduce the number of function sites
Simon Glass [Sun, 15 Jan 2023 21:15:47 +0000 (14:15 -0700)]
trace: Reduce the number of function sites

Given that the compiler adds two function calls into each function, the
current spacing is overkill. Drop it down to 16 bytes per function, which
is still plenty. This saves some space in the trace buffer.

Also move the calculation into a function, so it is common code. Add a
check for gd->mon_len being unset, which breaks tracing.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Update the file header
Simon Glass [Sun, 15 Jan 2023 21:15:46 +0000 (14:15 -0700)]
trace: Update the file header

It seems better to put the TEXT_BASE value in the file header rather than
in an entry record. While it is true that there is a separate base for
pre-relocation, this can be handled by using offsets in the file.

It is useful to have a version number in case we need to change the trace
format again.

Update the header to make these changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoabuf: Support use from tools
Simon Glass [Sun, 15 Jan 2023 21:15:45 +0000 (14:15 -0700)]
abuf: Support use from tools

Update the code slightly so that abuf can be used in U-Boot tools. It will
soon be needed for proftool.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotrace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT
Simon Glass [Sun, 15 Jan 2023 21:15:44 +0000 (14:15 -0700)]
trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotime: Tidy up some unnecessary #ifdefs
Simon Glass [Sun, 15 Jan 2023 21:15:43 +0000 (14:15 -0700)]
time: Tidy up some unnecessary #ifdefs

Avoid using the preprocessor with TIMER_EARLY.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotimer: Tidy up use of notrace
Simon Glass [Sun, 15 Jan 2023 21:15:42 +0000 (14:15 -0700)]
timer: Tidy up use of notrace

Tracing is typically enabled by the time driver model starts up, so there
is no point in adding a 'notrace' to the timer-init function. However,
once the driver model timer is enabled, we do need to be able to access
the timer's private data when reading the timer, so add it to the core
function needed for that.

Update the function's documentation while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodm: Allow serial output during the relocation process
Simon Glass [Sun, 15 Jan 2023 21:15:41 +0000 (14:15 -0700)]
dm: Allow serial output during the relocation process

Reset the serial flags so that the debug UART can be used (if enabled)
in the small window where there is no serial device. This can avoid a hang
in some cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agosandbox: Bring back setting mon_len in global_data
Simon Glass [Sun, 15 Jan 2023 21:15:40 +0000 (14:15 -0700)]
sandbox: Bring back setting mon_len in global_data

This change was made for the benefit of RISC-V but broke other
architectures also. In particular, tracing cannot work without this value.
Add it back for architectures which support it.

Fixes: 3c9fc23c443 ("sandbox: don't refer to symbol _init")
Signed-off-by: Simon Glass <sjg@chromium.org>
16 months ago.gitignore: Ignore the moveconfig database
Simon Glass [Sun, 15 Jan 2023 21:15:38 +0000 (14:15 -0700)]
.gitignore: Ignore the moveconfig database

This file is produced by the moveconfig.py tool. It should never be added
to the repo, so add it to the .gitignore file.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoDockerfile: Update QEMU git location
Tom Rini [Tue, 7 Feb 2023 17:50:13 +0000 (12:50 -0500)]
Dockerfile: Update QEMU git location

Per https://www.qemu.org/contribute/ the official location of the QEMU
sources are https://gitlab.com/qemu-project/qemu.git

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
16 months agousb: gadget: Fix typo in obj line
Tom Rini [Sat, 11 Feb 2023 14:25:44 +0000 (09:25 -0500)]
usb: gadget: Fix typo in obj line

When dropping the unused fotg210 gadget driver a leading 0 was
introduced to the next line, drop it.

Fixes: e9b4678bc78e ("usb: Drop unused fotg210 gadget")
Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Tom Rini <trini@konsulko.com>