]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
18 months agoefi_loader: store firmware version into FmpState variable
Masahisa Kojima [Wed, 7 Jun 2023 05:41:52 +0000 (14:41 +0900)]
efi_loader: store firmware version into FmpState variable

Firmware version management is not implemented in the current
FMP protocol.
EDK II reference implementation capsule generation script inserts
the FMP Payload Header right before the payload, FMP Payload Header
contains the firmware version and lowest supported version.

This commit utilizes the FMP Payload Header, reads the header and
stores the firmware version into "FmpStateXXXX" EFI non-volatile variable.
XXXX indicates the image index, since FMP protocol handles multiple
image indexes.
Note that lowest supported version included in the FMP Payload Header
is not used. If the platform uses file-based EFI variable storage,
it can be tampered. The file-based EFI variable storage is not the
right place to store the lowest supported version for anti-rollback
protection.

This change is compatible with the existing FMP implementation.
This change does not mandate the FMP Payload Header.
If no FMP Payload Header is found in the capsule file, fw_version,
lowest supported version, last attempt version and last attempt
status is 0 and this is the same behavior as existing FMP
implementation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
18 months agoefi_loader: add the number of image entries in efi_capsule_update_info
Masahisa Kojima [Wed, 7 Jun 2023 05:41:51 +0000 (14:41 +0900)]
efi_loader: add the number of image entries in efi_capsule_update_info

The number of image array entries global variable is required
to support EFI capsule update. This information is exposed as a
num_image_type_guids variable, but this information
should be included in the efi_capsule_update_info structure.

This commit adds the num_images member in the
efi_capsule_update_info structure. All board files supporting
EFI capsule update are updated.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoMerge branch '2023-06-01-assorted-platform-updates' into next
Tom Rini [Thu, 1 Jun 2023 19:43:38 +0000 (15:43 -0400)]
Merge branch '2023-06-01-assorted-platform-updates' into next

- Assorted updates for TI, nuvoton, sandbox and Xen platforms

18 months agoarm: mach-k3: am625_init: Add Erratum WA for RTC startup
Nishanth Menon [Tue, 16 May 2023 23:06:21 +0000 (18:06 -0500)]
arm: mach-k3: am625_init: Add Erratum WA for RTC startup

In the first silicon revision of the am62x family of SoCs, the hardware
wakeup event cannot be used if software is unable to unlock the RTC
device within one second after boot. To work around this limitation
unlock RTC as soon as possible in the boot flow to maximize our chance
of linux being able to use this device.

Add the erratum i2327 workaround to initialize the RTC.

Signed-off-by: Nishanth Menon <nm@ti.com>
[bb@ti.com: rebased from 2021.01 and expanded commit and code messages]
Signed-off-by: Bryan Brattlof <bb@ti.com>
18 months agoarm: baltos: switch to CONFIG_DM_I2C
Yegor Yefremov [Mon, 15 May 2023 14:26:44 +0000 (16:26 +0200)]
arm: baltos: switch to CONFIG_DM_I2C

Also use the TPS65910 driver directly.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
18 months agophy: ti: phy-j721e-wiz: Add j721s2-wiz-10g module support
Ravi Gunasekaran [Mon, 15 May 2023 10:50:40 +0000 (16:20 +0530)]
phy: ti: phy-j721e-wiz: Add j721s2-wiz-10g module support

Add support for j721s2-wiz-10g device to use clock-names interface
instead of explicitly defining clock nodes within device tree node.

Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
18 months agoarm: mach-k3: arm64-mmu: do not map ATF and OPTEE regions in A53 MMU
Kamlesh Gurudasani [Fri, 12 May 2023 11:58:52 +0000 (17:28 +0530)]
arm: mach-k3: arm64-mmu: do not map ATF and OPTEE regions in A53 MMU

ATF and OPTEE regions may be firewalled from non-secure entities.
If we still map them for non-secure A53, speculative access may happen,
which will not cause any faults and related error response will be ignored,
but it's better to not to map those regions for non-secure A53 as there
will be no actual access at all.

Create separate table as ATF region is at different locations for am64
and am62/am62a.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
18 months agoarm: mach-k3: j7200: clk-data.c: Add main_uart1 clock data
Bhavya Kapoor [Fri, 12 May 2023 10:02:53 +0000 (15:32 +0530)]
arm: mach-k3: j7200: clk-data.c: Add main_uart1 clock data

Add main_uart1 clocks in clk-data.c for J7200. Now,
main_uart1 clocks will be set up while booting the J7200 SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
18 months agoarm: mach-k3: j7200: dev-data.c: Add main_uart1 device data
Bhavya Kapoor [Fri, 12 May 2023 10:02:52 +0000 (15:32 +0530)]
arm: mach-k3: j7200: dev-data.c: Add main_uart1 device data

Add device data for main_uart1 in dev-data.c for J7200. Now,
main_uart1 will be powered on while booting the J7200 SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
18 months agoarch: arm: mach-k3: j721e: add support for UDA FS
Udit Kumar [Thu, 11 May 2023 09:17:50 +0000 (14:47 +0530)]
arch: arm: mach-k3: j721e: add support for UDA FS

When selecting UDA partition for booting. MMC read
mode was selected as RAW.

Due to growing/changing size of u-boot and tispl
images.
It will be better change to FS in case of UDA FS instead of
adjusting offsets with new change.

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
18 months agoconfigs: j7200: correct mmc offset
Udit Kumar [Thu, 11 May 2023 09:17:49 +0000 (14:47 +0530)]
configs: j7200: correct mmc offset

This patch corrects the MMC raw mode sector offset.

Current allocated size for tiboot3 is 1MB and 2MB for tispl.

Without this correct offset eMMC boot will fail.

Fixes: f8c1e893c82 (configs: j7200_evm_a72: Add Initial suppot)
Fixes: 02dff65efe7 (configs: j7200_evm_r5: Add initial support)
Fixes: 360c7f46f39 (configs: Add configs for J7200 High Security EVM)
Way to test with eMMC boot from boot0/1 partition
Boot with SD card, copy images to eMMC boot0 or boot1 partition

=> mmc dev 0 (1 or 2)
=> fatload mmc 1 ${loadaddr} tiboot3.bin
=> mmc write ${loadaddr} 0x0 0x800
=> fatload mmc 1 ${loadaddr} tispl.bin
=> mmc write ${loadaddr} 0x800 0x1000
=> fatload mmc 1 ${loadaddr} u-boot.img
=> mmc write ${loadaddr} 0x1800 0x2000
=> mmc partconf 0 1 (1 or 2) 1
=> mmc bootbus 0 2 0 0

Cc: Bhavya Kapoor <b-kapoor@ti.com>
Cc: Diwakar Dhyani <d-dhyani@ti.com>
Cc: KEERTHY <j-keerthy@ti.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
18 months agodoc: board: ti: add documenation for j7200
Udit Kumar [Thu, 11 May 2023 09:17:48 +0000 (14:47 +0530)]
doc: board: ti: add documenation for j7200

This patch adds documentation for j7200.

TRM link
https://www.ti.com/lit/pdf/spruiu1

Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
18 months agoarm: mach-k3: j721s2: clk-data.c: Add main_uart5 clock data
Bhavya Kapoor [Thu, 11 May 2023 09:12:52 +0000 (14:42 +0530)]
arm: mach-k3: j721s2: clk-data.c: Add main_uart5 clock data

Add main_uart5 clocks in clk-data.c for J721S2. Now,
main_uart5 clocks will be set up while booting the J721S2 SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
18 months agoarm: mach-k3: j721s2: dev-data.c: Add main_uart5 device data
Bhavya Kapoor [Thu, 11 May 2023 09:12:51 +0000 (14:42 +0530)]
arm: mach-k3: j721s2: dev-data.c: Add main_uart5 device data

Add device data for main_uart5 in dev-data.c for J721S2. Now,
main_uart5 will be powered on while booting the J721S2 SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
18 months agoarm: mach-k3: j721e: clk-data.c: Add main_uart2 clock data
Bhavya Kapoor [Thu, 11 May 2023 07:44:15 +0000 (13:14 +0530)]
arm: mach-k3: j721e: clk-data.c: Add main_uart2 clock data

Add main_uart2 clocks in clk-data.c for J721E. Now,
main_uart2 clocks will be set up while booting the J721E SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
18 months agoarm: mach-k3: j721e: dev-data.c: Add main_uart2 device data
Bhavya Kapoor [Thu, 11 May 2023 07:44:14 +0000 (13:14 +0530)]
arm: mach-k3: j721e: dev-data.c: Add main_uart2 device data

Add device data for main_uart2 in dev-data.c for J721E. Now,
main_uart2 will be powered on while booting the J721E SoC.

Signed-off-by: Bhavya Kapoor <b-kapoor@ti.com>
18 months agoaxi: fix definition of axi_sandbox_get_emul()
Heinrich Schuchardt [Wed, 10 May 2023 09:59:20 +0000 (11:59 +0200)]
axi: fix definition of axi_sandbox_get_emul()

Compiling with gcc 13 results in an error:

    drivers/axi/axi-emul-uclass.c:16:5: warning: conflicting types for
    ‘axi_sandbox_get_emul’ due to enum/integer mismatch; have
    ‘int(struct udevice *, ulong,  enum axi_size_t,  struct udevice **)’
    {aka ‘int(struct udevice *, long unsigned int,  enum axi_size_t,
    struct udevice **)’} [-Wenum-int-mismatch]
       16 | int axi_sandbox_get_emul(struct udevice *bus, ulong address,
          |     ^~~~~~~~~~~~~~~~~~~~
    In file included from drivers/axi/axi-emul-uclass.c:14:
    ./arch/sandbox/include/asm/axi.h:48:5: note: previous declaration of
    ‘axi_sandbox_get_emul’ with type ‘int(struct udevice *, ulong,  uint,
    struct udevice **)’ {aka ‘int(struct udevice *, long unsigned int,
    unsigned int,  struct udevice **)’}
       48 | int axi_sandbox_get_emul(struct udevice *bus, ulong address, uint length,
          |     ^~~~~~~~~~~~~~~~~~~~

Adjust the header definition to match the implementation.
Define the size parameter as constant.

Fixes: 9a8bcabd8ada ("axi: Add AXI sandbox driver and simple emulator")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agofirmware: ti_sci: Add missing LF in error message
Andreas Dannenberg [Tue, 9 May 2023 21:38:13 +0000 (16:38 -0500)]
firmware: ti_sci: Add missing LF in error message

The "Message not acknowledged" error message is missing a line feed,
leading to the console log getting garbled and joined together with
whatever the next output is in case this error happens:

"ti_sci system-controller@44043000: Message not acknowledgedAuthentication failed!"

Fix ths by adding the missing linefeed character.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
18 months agopinctrl: nuvoton: set output state before enabling the output
Jim Liu [Tue, 9 May 2023 07:07:34 +0000 (15:07 +0800)]
pinctrl: nuvoton: set output state before enabling the output

The default output state may be different to request,
change the configuration sequence to avoid glitch.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
18 months agoconfigs: am62ax_evm_a53_defconfig: Enable YMODEM support at A53 SPL
Vignesh Raghavendra [Mon, 8 May 2023 04:43:32 +0000 (10:13 +0530)]
configs: am62ax_evm_a53_defconfig: Enable YMODEM support at A53 SPL

This is required for UART boot flow where u-boot.img needs to be
downloaded via YMODEM.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
18 months agoarm: mach-k3: common: reorder removal of firewalls
Manorit Chawdhry [Fri, 5 May 2023 10:24:00 +0000 (15:54 +0530)]
arm: mach-k3: common: reorder removal of firewalls

K3 devices have some firewalls set up by ROM that we usually remove so
that the development is easy in HS devices.

While removing the firewalls disabling a background region before
disabling the foreground regions keeps the firewall in a state where all
the transactions will be blacklisted until all the regions are disabled.
This causes a race for some other entity trying to access that memory
region before all the firewalls are disabled and causes an exception.

Since there is no guarantee on where the background regions lie based on
ROM configurations or no guarantee if the background regions will allow
all transactions across the memory spaces, iterate the loop twice removing
the foregrounds first and then backgrounds.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
18 months agoRevert "arm: mach-k3: common: don't reconfigure background firewalls"
Manorit Chawdhry [Fri, 5 May 2023 10:23:59 +0000 (15:53 +0530)]
Revert "arm: mach-k3: common: don't reconfigure background firewalls"

This reverts commit b8ebf24e7f4afb5093a31bdf122e1ed0781e5c3c.

This patch seems to be fundamentally wrong and requires a different way
on how the background firewalls should be configured so revert the patch

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
18 months agodoc: Add info for building Xen target with Clang
Leo Yan [Thu, 4 May 2023 07:54:59 +0000 (15:54 +0800)]
doc: Add info for building Xen target with Clang

When build Xen target with Clang, the linker reports failure.

This patch adds the related info in the documentation as a known issue
and gives details for how to dismiss the building failure with Clang.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
18 months agoarm64: Remove duplicated symbols
Leo Yan [Thu, 4 May 2023 07:54:58 +0000 (15:54 +0800)]
arm64: Remove duplicated symbols

When build U-boot with clang with using commands:

  $ make HOSTCC=clang xenguest_arm64_defconfig
  $ make HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- \
CC="clang -target aarch64-linux-gnueabi" -j8

The compiler reports error:

  /tmp/start-acdf31.s:330:1: error: symbol '_start' is already defined
  _start:
  ^

Because the symbol '_start' has been defined twice, one is defined in
arch/arm/cpu/armv8/start.S, another is defined in the header
boot0-linux-kernel-header.h.

To fix building failure, this patch removes the symbol '_start' from
boot0-linux-kernel-header.h.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
18 months agoMerge branch '2023-05-31-assorted-fixes-and-improvements' into next
Tom Rini [Thu, 1 Jun 2023 15:23:23 +0000 (11:23 -0400)]
Merge branch '2023-05-31-assorted-fixes-and-improvements' into next

- Makefile logic fixes, address some issues that clang uncovers on ARM,
  assorted code cleanups

18 months agommc: fix improper use of memset
Sam Edwards [Thu, 18 May 2023 19:47:07 +0000 (13:47 -0600)]
mmc: fix improper use of memset

Buffers created through DEFINE_(CACHE_)ALIGN_BUFFER are actually
pointers to the real underlying buffer. Using sizeof(...) is
not appropriate in this case.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
18 months agocommon: dfu: Remove leading space characters
Ravi Gunasekaran [Thu, 18 May 2023 06:36:23 +0000 (12:06 +0530)]
common: dfu: Remove leading space characters

As per [1], dfu_alt_info is mentioned to be as semicolon separated
string of information on each alternate and the parsing logic in
the dfu.c is based on this.

Typically, the dfu_alt_info_* is defined in .h files as preprocessor
macros with 'alt' info separated by semicolon.

But when dfu_alt_info_* is added in the environment files(.env)
the script at "scripts/env2string.awk" converts a newline to space.
Thus adding a space character after semicolon. This results in
incorrect parsing in dfu.c which is based on the information that
'alt' info are only semicolon separated.

One option is to add dfu_alt_info_* variable in .env in single line.
But there is possiblity for it to exceed the line length limit.
So update the parsing logic to remove leading space characters
before adding to the dfu list.

[1]: https://u-boot.readthedocs.io/en/latest/usage/dfu.html

Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
18 months agocmd: sf/nand: Print and return failure when 0 length is passed
Ashok Reddy Soma [Tue, 16 May 2023 11:52:36 +0000 (05:52 -0600)]
cmd: sf/nand: Print and return failure when 0 length is passed

For sf commands, when '0' length is passed for erase, update, write or
read, there might be undesired results. Ideally '0' length means nothing to
do.

So print 'ERROR: Invalid size 0' and return cmd failure when length '0' is
passed to sf commands. Same thing applies for nand commands also.

Example:

ZynqMP> sf erase 0 0
ERROR: Invalid size 0
ZynqMP> sf write 10000 0 0
ERROR: Invalid size 0
ZynqMP> sf read 10000 0 0
ERROR: Invalid size 0
ZynqMP> sf update 1000 10000 0
ERROR: Invalid size 0
ZynqMP>

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
18 months agoscripts/Makefile.lib: change spelling of $(srctree)/arch/$(ARCH)/dts in dtc_cpp_flags
Rasmus Villemoes [Tue, 16 May 2023 09:17:56 +0000 (11:17 +0200)]
scripts/Makefile.lib: change spelling of $(srctree)/arch/$(ARCH)/dts in dtc_cpp_flags

Currently, all in-tree .dts files (apart from some under test/ and
tools/), reside in arch/$ARCH/dts. However, in the linux kernel tree,
dts files for arm64 boards, and probably in the not too distant
future [1], arm boards as well, live in subdirectories of that.

For private forks, using a vendor or project subdirectory is also more
convenient to clearly separate private code from upstream - in the
same way that code under board/ is also split and easy to maintain.

In order to prepare for us to follow suit and do the splitting of the
in-tree .dts files, and to make life a little easier for private forks
that already place dts files not directly in arch/$ARCH/dts, change
the $(srctree)/arch/$(ARCH)/dts path to instead refer to the directory of
the .dts file being compiled. This should be a no-op for all existing
cases.

[1] https://lore.kernel.org/lkml/20220328000915.15041-1-ansuelsmth@gmail.com/

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
18 months agosemihosting: create file in smh_fs_write_at()
Heinrich Schuchardt [Fri, 12 May 2023 22:47:03 +0000 (00:47 +0200)]
semihosting: create file in smh_fs_write_at()

If a file does not exist, it should be created.

Fixes: f676b45151c3 ("fs: Add semihosting filesystem")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
18 months agoarm: set alignment properly for asm funcs
Sam Edwards [Fri, 12 May 2023 22:31:05 +0000 (16:31 -0600)]
arm: set alignment properly for asm funcs

ARM requires a 4-byte alignment on all ARM code (though this
requirement is relaxed to 2-byte for some THUMB code) and we
should be explicit about that here.

GAS has its own fix for this[1] that forces proper alignment
on any section containing assembled instructions, but this is
not universal: Clang's and other gaslike assemblers lack this
implicit alignment. Whether or not this is considered a bug in
those assemblers, it is better to ask directly for what we want.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=12931

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
18 months agocmd: fs: document where 'size' stores its result
Baruch Siach [Sun, 7 May 2023 10:48:06 +0000 (13:48 +0300)]
cmd: fs: document where 'size' stores its result

Make it a little bit easier for the user to utilize the 'size' command.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocli: avoid buffer overrun
Heinrich Schuchardt [Tue, 2 May 2023 02:34:09 +0000 (04:34 +0200)]
cli: avoid buffer overrun

Invoking the sandbox with

    /u-boot -c ⧵0xef⧵0xbf⧵0xbd

results in a segmentation fault.

Function b_getch() retrieves a character from the input stream. This
character may be > 0x7f. If type char is signed, static_get() will
return a negative number and in parse_stream() we will use that
negative number as an index for array map[] resulting in a buffer
overflow.

Reported-by: Harry Lockyer <harry_lockyer@tutanota.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agospl: Correct checking of configuration node
Bin Meng [Mon, 1 May 2023 03:35:26 +0000 (11:35 +0800)]
spl: Correct checking of configuration node

Per the fit_conf_get_node() API doc, it returns configuration node
offset when found (>=0).

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocmd: fdt: Correct checking of configuration node
Bin Meng [Mon, 1 May 2023 03:35:25 +0000 (11:35 +0800)]
cmd: fdt: Correct checking of configuration node

fit_conf_get_node() returns a negative value on error.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoefi: Correct .efi rules
Simon Glass [Sun, 30 Apr 2023 01:21:47 +0000 (19:21 -0600)]
efi: Correct .efi rules

These files should have both 'always' and 'targets' so that dependencies
are detected correctly.

When only 'always' is used, the target is built every time, although I am
not quite sure why.

Make sure each has both 'always' and 'targets' to avoid this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoacpi: Put the version numbers in a central place
Simon Glass [Sun, 30 Apr 2023 01:21:46 +0000 (19:21 -0600)]
acpi: Put the version numbers in a central place

At present two acpi files are built every time since they use a version
number from version.h

This is not necessary. Make use of the same technique as for the version
string, so that they are build only when they change.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agoMakefile: Fix incorrect FORCE deps on env rules
Simon Glass [Sun, 30 Apr 2023 01:21:45 +0000 (19:21 -0600)]
Makefile: Fix incorrect FORCE deps on env rules

These rules run on every build even if nothing has changed. The FORCE
dependency is only needed for if_changed, not for cmd. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
18 months agofastboot: Only call the bootm command if it is enabled
Samuel Holland [Mon, 20 Feb 2023 06:14:58 +0000 (00:14 -0600)]
fastboot: Only call the bootm command if it is enabled

This fixes an error with trying to link against do_bootm() when
CONFIG_CMD_BOOTM is disabled.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
18 months agoMerge branch '2023-05-31-cleanup-unaligned-access-macros' into next
Tom Rini [Wed, 31 May 2023 20:30:16 +0000 (16:30 -0400)]
Merge branch '2023-05-31-cleanup-unaligned-access-macros' into next

To quote the author:

There are two versions of get/set_unaligned, get_unaligned_be64,
put_unaligned_le64 etc in U-Boot causing confusion (and bugs).

In this patch-set, I'm trying to fix that with a single unified version of
the access macros to be used across all archs. This work is inspired by
similar changes in this Linux kernel by Arnd Bergman,
https://lore.kernel.org/lkml/20210514100106.3404011-1-arnd@kernel.org/

18 months agoasm-generic: simplify unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:38 +0000 (14:22 +0200)]
asm-generic: simplify unaligned.h

The get_unaligned()/put_unaligned() implementations are more
complex than necessary.

Move everything into one file and use a more compact implementation based
on packed struct access and byte swapping macros.

This patch is based on the Linux kernel commit 803f4e1eab7a
("asm-generic: simplify asm/unaligned.h") by Arnd Bergmann.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agolinux/unaligned: remove unused access_ok.h
Jens Wiklander [Mon, 22 May 2023 12:22:37 +0000 (14:22 +0200)]
linux/unaligned: remove unused access_ok.h

linux/unaligned/access_ok.h is unused, so remove it.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agofs/btrfs: use asm/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:36 +0000 (14:22 +0200)]
fs/btrfs: use asm/unaligned.h

Use asm/unaligned.h instead of linux/unaligned/access_ok.h for unaligned
access. This is needed on architectures that doesn't handle unaligned
accesses directly.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agopowerpc: use asm-generic/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:35 +0000 (14:22 +0200)]
powerpc: use asm-generic/unaligned.h

Powerpc configurations are apparently able to do unaligned accesses. But
in an attempt to clean up and handle unaligned accesses in the same way
we ignore that and use the common asm-generic/unaligned.h directly
instead.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agom68k: use asm-generic/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:34 +0000 (14:22 +0200)]
m68k: use asm-generic/unaligned.h

M68k essentially duplicates the content of asm-generic/unaligned.h, with
an exception for non-Coldfire configurations. Coldfire configurations
are apparently able to do unaligned accesses. But in an attempt to clean
up and handle unaligned accesses in the same way we ignore that and use
the common asm-generic/unaligned.h directly instead.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Angelo Dureghello <angelo@kernel-space.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agomips: use asm-generic/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:33 +0000 (14:22 +0200)]
mips: use asm-generic/unaligned.h

Mips essentially duplicates the content of asm-generic/unaligned.h, so use
that file directly instead.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agosh: use asm-generic/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:32 +0000 (14:22 +0200)]
sh: use asm-generic/unaligned.h

Sh essentially duplicates the content of asm-generic/unaligned.h, so use
that file directly instead.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoarm: use asm-generic/unaligned.h
Jens Wiklander [Mon, 22 May 2023 12:22:31 +0000 (14:22 +0200)]
arm: use asm-generic/unaligned.h

Arm duplicates the content of asm-generic/unaligned.h, so use that file
directly instead.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
18 months agoMerge branch '2023-05-31-code-cleanups' into next
Tom Rini [Wed, 31 May 2023 16:32:38 +0000 (12:32 -0400)]
Merge branch '2023-05-31-code-cleanups' into next

- Correct some header double-inclusion guards and remove some dead (or
  in the case of ti816x, unmaintained) code.

18 months agoinclude: Remove unused header files
Tom Rini [Tue, 16 May 2023 16:34:47 +0000 (12:34 -0400)]
include: Remove unused header files

As part of various code clean-ups we have on occasion missed removing
unused header files.  None of these files are referenced anywhere else
at this point.

Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agofaraday: remove orphaned header file
Andre Przywara [Mon, 15 May 2023 13:52:14 +0000 (14:52 +0100)]
faraday: remove orphaned header file

Commit 11232139e399 ("nds32: Remove the architecture") removed the nds32
architecture, and with it the last user of the Faraday AHB controller
header file.

Consequently remove that header file as well.

This was found because the inclusion guard was misspelled.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agoexynos: fix header inclusion guard
Andre Przywara [Mon, 15 May 2023 13:52:13 +0000 (14:52 +0100)]
exynos: fix header inclusion guard

It seems like the header inclusion guard for the Exynos pinctrl header
was misspelled.

Make the preprocessor symbol for the #ifndef and #define lines the
same, so that the double inclusion protection works as expected.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agofreescale: vsc3316_3308: fix header inclusion guard
Andre Przywara [Mon, 15 May 2023 13:52:12 +0000 (14:52 +0100)]
freescale: vsc3316_3308: fix header inclusion guard

It seems like the header inclusion guard for some Freescale crosspoint
switch header was misspelled.

Make the preprocessor symbol for the #ifndef and #define lines the
same, so that the double inclusion protection works as expected.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agoarm: uniphier: fix header inclusion guard
Andre Przywara [Mon, 15 May 2023 13:52:11 +0000 (14:52 +0100)]
arm: uniphier: fix header inclusion guard

It seems like the header inclusion guard for some Uniphier DDR PHY
header was misspelled.

Make the preprocessor symbol for the #ifndef and #define lines the
same, so that the double inclusion protection works as expected.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agoimx: fix header inclusion guards
Andre Przywara [Mon, 15 May 2023 13:52:10 +0000 (14:52 +0100)]
imx: fix header inclusion guards

It seems like the header inclusion guards for some IMX related headers
were misspelled or got out of sync.

Make the preprocessor symbols for the #ifndef and #define lines the
same, so that the double inclusion protection works as expected.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
18 months agoarm: Remove ti816x_evm board and ti816x SoC support
Tom Rini [Thu, 11 May 2023 18:07:24 +0000 (14:07 -0400)]
arm: Remove ti816x_evm board and ti816x SoC support

This platform is currently unmaintained and untested, so remove it.
Further, as it is the only TI816X SoC example, remove related files as
well.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: Resync with savedefconfig
Tom Rini [Thu, 18 May 2023 20:05:49 +0000 (16:05 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-usb into next
Tom Rini [Thu, 18 May 2023 18:02:39 +0000 (14:02 -0400)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-usb into next

- USB and SPL related Kconfig clean-up / re-organization

19 months agoMerge branch 'next_gpio' of https://source.denx.de/u-boot/custodians/u-boot-sh into...
Tom Rini [Wed, 17 May 2023 00:24:44 +0000 (20:24 -0400)]
Merge branch 'next_gpio' of https://source.denx.de/u-boot/custodians/u-boot-sh into next

- gpio: renesas: Simplify .request/.rfree callbacks

19 months agoMerge branch '2023-05-16-remove-misuse-of-env-is-nowhere' into next
Tom Rini [Wed, 17 May 2023 00:24:21 +0000 (20:24 -0400)]
Merge branch '2023-05-16-remove-misuse-of-env-is-nowhere' into next

To quote the author:

When using a list of writeable variables, the initial values come from
the built-in default environment since commit 5ab81058364b
("env: Complete generic support for writable list"). Remove unnecessary
misuse of the env is nowhere driver as default environment.

19 months agousb: gadget: Add and use matching SPL USB ethernet gadget Kconfig symbols
Marek Vasut [Sat, 6 May 2023 14:42:40 +0000 (16:42 +0200)]
usb: gadget: Add and use matching SPL USB ethernet gadget Kconfig symbols

Define SPL_USB_ETH_RNDIS symbol to make it possible to select USB
gadget ethernet support in SPL and U-Boot separately in Kconfig .
Make use of the new symbols in gadget Makefile and move the rndis.o
just below the now merged USB_ETHER symbol in Makefile.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agousb: Move SPL_USB_GADGET and related Kconfig symbols to drivers/usb/
Marek Vasut [Sat, 6 May 2023 14:42:39 +0000 (16:42 +0200)]
usb: Move SPL_USB_GADGET and related Kconfig symbols to drivers/usb/

To avoid piling up all the various Kconfig symbols in one place, i.e.
common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ .
This commit moves SPL_USB_GADGET and related symbols. Fix typo and
rename SPL_USB_GADGET to "USB Gadget Support in SPL" .

Update the gadget Makefile to match the symbol changes.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agousb: Move SPL_USB_STORAGE Kconfig symbol to drivers/usb/
Marek Vasut [Sat, 6 May 2023 14:42:38 +0000 (16:42 +0200)]
usb: Move SPL_USB_STORAGE Kconfig symbol to drivers/usb/

To avoid piling up all the various Kconfig symbols in one place, i.e.
common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ .
This commit moves SPL_USB_STORAGE and matching SYS_USB_FAT_BOOT_PARTITION .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agousb: Move SPL_USB_HOST Kconfig symbol to drivers/usb/
Marek Vasut [Sat, 6 May 2023 14:42:37 +0000 (16:42 +0200)]
usb: Move SPL_USB_HOST Kconfig symbol to drivers/usb/

To avoid piling up all the various Kconfig symbols in one place, i.e.
common/spl/Kconfig, move the USB Kconfig symbols into drivers/usb/ .
This commit moves SPL_USB_HOST and updates help text of both USB_HOST
and SPL_USB_HOST .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
19 months agogpio: renesas: Simplify .request/.rfree callbacks
Pali Rohár [Tue, 2 Aug 2022 10:06:55 +0000 (12:06 +0200)]
gpio: renesas: Simplify .request/.rfree callbacks

Remove identify wrapper functions.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
19 months agoenv: Remove misuse of env is nowhere leftover
Stefan Herbrechtsmeier [Tue, 2 May 2023 10:23:05 +0000 (12:23 +0200)]
env: Remove misuse of env is nowhere leftover

When using a list of writeable variables, the initial values come from
the built-in default environment since commit 5ab81058364b
("env: Complete generic support for writable list"). Remove leftover of
misuse of the env is nowhere driver as default environment.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
19 months agopowerpc/mpc85xx: socrates: Remove misuse of env is nowhere driver
Stefan Herbrechtsmeier [Tue, 2 May 2023 10:23:04 +0000 (12:23 +0200)]
powerpc/mpc85xx: socrates: Remove misuse of env is nowhere driver

When using a list of writeable variables, the initial values come from
the built-in default environment since commit 5ab81058364b
("env: Complete generic support for writable list"). Remove unnecessary
misuse of the env is nowhere driver as default environment.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
19 months agoimx6q: acc: Remove misuse of env is nowhere driver
Stefan Herbrechtsmeier [Tue, 2 May 2023 10:23:03 +0000 (12:23 +0200)]
imx6q: acc: Remove misuse of env is nowhere driver

When using a list of writeable variables, the initial values come from
the built-in default environment since commit 5ab81058364b
("env: Complete generic support for writable list"). Remove unnecessary
misuse of the env is nowhere driver as default environment.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
19 months agoimx6: aristainetos: Remove misuse of env is nowhere driver
Stefan Herbrechtsmeier [Tue, 2 May 2023 10:23:02 +0000 (12:23 +0200)]
imx6: aristainetos: Remove misuse of env is nowhere driver

When using a list of writeable variables, the initial values come from
the built-in default environment since commit 5ab81058364b
("env: Complete generic support for writable list"). Remove unnecessary
misuse of the env is nowhere driver as default environment.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
19 months agoMerge branch '2023-05-15-build-system-updates' into next
Tom Rini [Mon, 15 May 2023 19:26:54 +0000 (15:26 -0400)]
Merge branch '2023-05-15-build-system-updates' into next

- Bring in a few kbuild changes from upstream Linux to fix running the
  checker (make C=1/C=2), and clean up some of the logic related to how
  choose what device trees to build.

19 months agoFix sparse checks processing
Christophe Leroy [Fri, 5 May 2023 08:39:39 +0000 (10:39 +0200)]
Fix sparse checks processing

A lot of errors are encountered when building with sparse checking
activated (make C=1 or make C=2).

Many of them are fixed in Linux.

Resynchronise Makefile and include/linux/build_bug.h with Linux
kernel sources by porting the following Linux commits into u-boot:
6c49f359ca14 ("kbuild: disable sparse warnings about unknown attributes")
80591e61a0f7 ("kbuild: tell sparse about the $ARCH")
8788994376d8 ("linux/build_bug.h: change type to int")
527edbc18a70 ("build_bug.h: remove most of dummy BUILD_BUG_ON stubs for Sparse")
c60d3b79423a ("build_bug.h: remove negative-array fallback for BUILD_BUG_ON()")
14e83077d55f ("include: drop pointless __compiler_offsetof indirection")

Also revert commit aa9e891c63 ("include/linux/stddef.h: avoid
'warning: preprocessor token offsetof redefined'") because the
error it creates is worse than the warning it is trying to fix.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
19 months agokbuild: Allow DTB overlays to built from .dtso named source files
Rasmus Villemoes [Thu, 4 May 2023 12:26:44 +0000 (14:26 +0200)]
kbuild: Allow DTB overlays to built from .dtso named source files

[Linux commit 363547d2191c]

Currently DTB Overlays (.dtbo) are build from source files with the same
extension (.dts) as the base DTs (.dtb). This may become confusing and
even lead to wrong results. For example, a composite DTB (created from a
base DTB and a set of overlays) might have the same name as one of the
overlays that create it.

Different files should be generated from differently named sources.
 .dtb  <-> .dts
 .dtbo <-> .dtso

We do not remove the ability to compile DTBO files from .dts files here,
only add a new rule allowing the .dtso file name. The current .dts named
overlays can be renamed with time. After all have been renamed we can
remove the other rule.

[Import notes: Adapt to U-Boot by using the cmd_dtco function instead
of cmd_dtc just like the current .dts -> .dtbo rule.]

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agokbuild: add dtc as dependency on .dtb files
Rasmus Villemoes [Thu, 4 May 2023 12:26:43 +0000 (14:26 +0200)]
kbuild: add dtc as dependency on .dtb files

[Linux commit b8fc5b2157b1]

If dtc is rebuilt, we should rebuild .dtb files with the new dtc.

[Import notes: Back then there was no .dtbo rule in Linux's
Makefile.lib, but the current .dtbo rules in Linux also have the
$(DTC) dependency, so also add it to our .dtbo rule.]

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoscripts/Makefile.dts: tweak logic for deciding which dtbs to build
Rasmus Villemoes [Thu, 4 May 2023 11:33:08 +0000 (13:33 +0200)]
scripts/Makefile.dts: tweak logic for deciding which dtbs to build

The idea in 3609e1dc5f4d (dts: automatically build necessary .dtb
files) was fine, but the implementation was suboptimal due to some
misunderstandings on my part (and possibly defects in some defconfig
files):

- Sometimes DEFAULT_DEVICE_TREE is not included in OF_LIST or
  SPL_OF_LIST

- SPL_OF_LIST is not always a subset of OF_LIST

- While SPL_OF_LIST governs the list of dtbs relevant to SPL (i.e.,
  may be built into an
  SPL-with-bunch-of-dtbs-to-choose-between-at-runtime), those dtbs are
  not actually _built_ during the SPL build phase, i.e. when $(SPL_)
  would expand to SPL_. fdtgrep runs on the artifacts produced during
  the ordinary U-Boot build.

Tweak the logic so that we simply add the union of all dtbs mentioned
in either DEFAULT_DEVICE_TREE, OF_LIST and SPL_OF_LIST to dtb-y. That
should, for real, ensure that we always build all the dtbs that is
relevant to the current board, and should in turn enable us to
massively simplify arch/*/dts/Makefile.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Tested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoscripts: dtc-version: support git version strings too
Martin Hundebøll [Wed, 3 May 2023 10:23:39 +0000 (12:23 +0200)]
scripts: dtc-version: support git version strings too

Building dtc from git causes the version number to start with a 'v'
(e.g. v1.7.0). printf then fails to parse 'v1' as a decimal value, and
prints '000700' instead of '010700'. Subsequently, the build fails,
because '000700' is less than the required '010400' version.

Signed-off-by: Martin Hundebøll <martin@geanix.com>
19 months agoMerge branch '2023-05-11-CONFIG_IS_ENABLED-vs-IS_ENABLED-cleanups' into next
Tom Rini [Thu, 11 May 2023 17:02:03 +0000 (13:02 -0400)]
Merge branch '2023-05-11-CONFIG_IS_ENABLED-vs-IS_ENABLED-cleanups' into next

- Bring in some of the clean-ups to use IS_ENABLED rather than
  CONFIG_IS_ENABLED to make the code less error-prone.

19 months agopower: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)
Troy Kisky [Mon, 13 Mar 2023 21:31:44 +0000 (14:31 -0700)]
power: pmic: add dm style definitions if not CONFIG_IS_ENABLED(POWER_LEGACY)

This avoids an error in converting to CONFIG_IS_ENABLED(DM_PMIC).
Many boards SPL code needs these definitions to compile, even if
the functions are not linked.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoarm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:42 +0000 (14:31 -0700)]
arm: mach-imx: use CONFIG_$(SPL_)SATA instead of CONFIG_SATA

This avoid an error with enable_sata_clock when
defined(CONFIG_SATA) is changed to CONFIG_IS_ENABLED(SATA).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agowandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:41 +0000 (14:31 -0700)]
wandboard: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA
is defined.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
19 months agosolidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA
Troy Kisky [Mon, 13 Mar 2023 21:31:40 +0000 (14:31 -0700)]
solidrun: mx6cuboxi: use CONFIG_IS_ENABLED(SATA) instead of ifdef CONFIG_SATA

Prepare for linking setup_sata only when CONFIG_SATA/CONFIG_SPL_SATA
is defined.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agofreescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)
Troy Kisky [Mon, 13 Mar 2023 21:31:38 +0000 (14:31 -0700)]
freescale: common: pfuze: define pfuze_mode_init only if defined(CONFIG_DM_PMIC)

pfuze_mode_init calls pmic_reg_read which is only available from

obj-$(CONFIG_$(SPL_TPL_)DM_PMIC) += pmic-uclass.o

Prepare for conversion of defined(CONFIG_DM_PMIC) to
CONFIG_IS_ENABLED(DM_PMIC).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agom53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)
Troy Kisky [Mon, 13 Mar 2023 21:31:37 +0000 (14:31 -0700)]
m53menlo: define ft_board_setup only if CONFIG_IS_ENABLED(OF_LIBFDT)

The function ft_board_setup calls do_fixup_by_path_string
which is only available on CONFIG_IS_ENABLED(OF_LIBFDT).
This prepares for the conversion.

ft_board_setup is only called from image-fdt which is linked by
obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoofnode: fdt_support definitions needed if OF_CONTROL is enabled
Troy Kisky [Mon, 13 Mar 2023 21:31:35 +0000 (14:31 -0700)]
ofnode: fdt_support definitions needed if OF_CONTROL is enabled

With the use of CONFIG_IS_ENABLED in code, instead of at the preprocessor
level, these defines are still needed if OF_CONTROL is enabled.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoconfig_distro_bootcmd: remove booting environment variables from SPL environment
Troy Kisky [Mon, 13 Mar 2023 21:31:34 +0000 (14:31 -0700)]
config_distro_bootcmd: remove booting environment variables from SPL environment

SPL environments don't need commands that they can never use.
Avoid errors with CONFIG_IS_ENABLED conversions by skipping them now.

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agox86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED
Troy Kisky [Mon, 13 Mar 2023 21:31:33 +0000 (14:31 -0700)]
x86: cpu: qemu: qemu: remove SPL use with CONFIG_IS_ENABLED

CONFIG_IS_ENABLED(SPL_X86_32BIT_INIT)
would check for CONFIG_SPL_SPL_X86_32BIT_INIT for SPL builds

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agocmd: nvedit: remove error check, handle with Kconfig
Troy Kisky [Mon, 13 Mar 2023 21:31:24 +0000 (14:31 -0700)]
cmd: nvedit: remove error check, handle with Kconfig

Avoid error messages when SPL,TPL,VPL build don't
have the environment options of the main build.
This is needed when defined(CONFIG_ENV_IS_IN_xxx) is changed
to CONFIG_IS_ENABLED(ENV_IS_IN_xxx).

Signed-off-by: Troy Kisky <troykiskyboundary@gmail.com>
19 months agoMerge branch 'master' into next
Tom Rini [Mon, 8 May 2023 18:31:04 +0000 (14:31 -0400)]
Merge branch 'master' into next

19 months agoPrepare v2023.07-rc2
Tom Rini [Mon, 8 May 2023 18:16:32 +0000 (14:16 -0400)]
Prepare v2023.07-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 8 May 2023 17:43:35 +0000 (13:43 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoboard: ti: am64x: Add support for AM64B SK
Judith Mendez [Thu, 6 Apr 2023 06:19:01 +0000 (11:49 +0530)]
board: ti: am64x: Add support for AM64B SK

The AM64x SR2.0 SK board uses "AM64B-SKEVM" as the EEPROM identifier.
This board is similar to the AM64x SKEVM except that it has a new
PMIC that will be enabled in the future and consequently could use a
different device tree file in the future.

For now we treat the board same as an AM64x SK.

Signed-off-by: Judith Mendez <jm@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
19 months agocommon: spl: spl: Remove video driver before u-boot proper
Nikhil M Jain [Mon, 10 Apr 2023 08:49:13 +0000 (14:19 +0530)]
common: spl: spl: Remove video driver before u-boot proper

Add method to remove video driver before loading u-boot proper. When
bootstage changes from SPL to u-boot proper, noo method is called to
remove video driver, and at u-boot proper if video driver is not
enabled, the video driver starts displaying garbage on the screen,
because there is no reserved space for video and the frame buffer gets
u-boot proper data written.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
19 months agoboard: ti: am62x: evm: Add necessary functions to call splash screen
Nikhil M Jain [Mon, 10 Apr 2023 08:49:12 +0000 (14:19 +0530)]
board: ti: am62x: evm: Add necessary functions to call splash screen

To enable splash screen on AM62x at a53 SPL setup DRAM, set page table,
enable cache to allow copying of bmp image to frame buffer and display
it using splash_display.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
19 months agoboard: ti: am62x: am62x: Change splashimage and splashsource
Nikhil M Jain [Mon, 10 Apr 2023 08:49:11 +0000 (14:19 +0530)]
board: ti: am62x: am62x: Change splashimage and splashsource

Change splashimage which is bmp image loadaddr to 0x80200000 since stack
is situated at 0x80477660 as splash framework requires bmp image to be
present above stack.

Change splashsource to sf to support loading bmp image from ospi flash
memory.

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
19 months agoconfigs: am62x_evm_a53_defconfig: Changes in memory to support SPL splash screen
Nikhil M Jain [Mon, 10 Apr 2023 08:49:10 +0000 (14:19 +0530)]
configs: am62x_evm_a53_defconfig: Changes in memory to support SPL splash screen

To enable splash at A53 SPL, need to do memory map changes which
involves locate stack above malloc and have enough space to load bmp
image above stack. To load a 1920X1200 image a minimum of 8.8MB space is
needed, to support it move malloc down to 0x80b80000 from 0x80480000 and
bss to 0x80c80000 to have 1MB buffer between malloc and BSS.

Observed SPL size 195KB, CONFIG_SPL_SIZE_LIMIT set to 256KB.
Observed stack size 1904Bytes, CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK set
to 2KB.
CONFIG_SPL_SYS_REPORT_STACK_F_USAGE config sets stack above the malloc
and reports for stack overflow.

Memory map at A53 SPL before splash screen
0x80000000+---------------------+
          |    Empty 512 KB     |
          |                     |
0x80080000+---------------------+
          |     Text Base       |
          |       352 KB        |
          |                     |
0x800D8000+---------------------+
          |                     |
          |                     |
          |    Empty 3.6MB      |
          |                     |
          |                     |
0x80477660+---------------------+
          |    Stack 2 KB       |
0x80477e60+---------------------+
          |     GD 416 Bytes    |
0x80478000+---------------------+
          |    Malloc 352 KB    |
          |                     |
0x80480000+---------------------+
          |                     |
          |                     |
          |                     |
          |                     |
          |   Empty 5.5 MB      |
          |                     |
          |                     |
          |                     |
          |                     |
0x80a00000+---------------------+
          |                     |
          |      BSS 512 KB     |
          |                     |
0x80a80000+---------------------+
          |                     |
          |                     |
          |                     |
          |                     |
          |   Empty 5.5 MB      |
          |                     |
          |                     |
          |                     |
          |                     |
0x81000000+---------------------+FIT Image load address

New memory map with splash screen at SPL
0x80000000+---------------------+
          |    Empty 512 KB     |
          |                     |
0x80080000+---------------------+
          |     Text Base       |
          |       352 KB        |
          |                     |
0x800D8000+---------------------+
          |    Empty 1.1MB      |
          |                     |
0x80200000+---------------------+
          |                     |
          |                     |
          |                     |
          |   BMP Image Load    |
          |                     |
          |       9.4 MB        |
          |                     |
          |                     |
          |                     |
          |                     |
          |                     |
          |                     |
0x80b77660+---------------------+
          |     Stack 2KB       |
0x80b77e60+---------------------+
          |    GD 416 Bytes     |
0x80b78000+---------------------+
          |                     |
          |    Malloc 352KB     |
0x80b80000+---------------------+
          |                     |
          |     Empty 1 MB      |
          |                     |
0x80c80000+---------------------+
          |     BSS 512 KB      |
          |                     |
0x80d00000+---------------------+
          |                     |
          |                     |
          |    Empty 3.0 MB     |
          |                     |
          |                     |
          |                     |
0x81000000+---------------------+FIT Image load addressi

Signed-off-by: Nikhil M Jain <n-jain1@ti.com>
19 months agobtrfs: fix offset when reading compressed extents
Dominique Martinet [Tue, 18 Apr 2023 06:41:55 +0000 (15:41 +0900)]
btrfs: fix offset when reading compressed extents

btrfs_read_extent_reg correctly computed the extent offset in the
BTRFS_COMPRESS_NONE case, but did not account for the 'offset - key.offset'
part correctly in the compressed case, making the function read
incorrect data.

In the case I examined, the last 4k of a file was corrupted and
contained data from a few blocks prior, e.g. reading a 10k file with a
single extent:
btrfs_file_read()
 -> btrfs_read_extent_reg
    (aligned part loop, until 8k)
 -> read_and_truncate_page
   -> btrfs_read_extent_reg
      (re-reads the last extent from 8k to the end,
      incorrectly reading the first 2k of data)

This can be reproduced as follow:
$ truncate -s 200M btr
$ mount btr -o compress /mnt
$ pat() { dd if=/dev/zero bs=1M count=$1 iflag=count_bytes status=none | tr '\0' "\\$2"; }
$ { pat 4K 1; pat 4K 2; pat 2K 3; }  > /mnt/file
$ sync
$ filefrag -v /mnt/file
File size of /mnt/file is 10240 (3 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       2:       3328..      3330:      3:             last,encoded,eof
$ umount /mnt

Then in u-boot:
=> load scsi 0 2000000 file
10240 bytes read in 3 ms (3.3 MiB/s)
=> md 2001ff0
02001ff002020202 02020202 02020202 02020202  ................
0200200001010101 01010101 01010101 01010101  ................
0200201001010101 01010101 01010101 01010101  ................

(02002000 onwards should contain '03' pattern but went back to 01,
start of the extent)

After patch, data is read properly:
=> md 2001ff0
02001ff002020202 02020202 02020202 02020202  ................
0200200003030303 03030303 03030303 03030303  ................
0200201003030303 03030303 03030303 03030303  ................

Note that the code previously (before commit e3427184f38a ("fs: btrfs:
Implement btrfs_file_read()")) did not split that read in two, so
this is a regression even if the previous code might not have been
handling offsets correctly either (something that booted now fails to
boot)

Fixes: a26a6bedafcf ("fs: btrfs: Introduce btrfs_read_extent_inline() and btrfs_read_extent_reg()")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
19 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 8 May 2023 13:10:39 +0000 (09:10 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- cmd: tlv_eeprom: Misc cleanups & improvements (Josua)

19 months agocmd: tlv_eeprom: enable 'dev' subcommand before 'read'
Josua Mayer [Fri, 5 May 2023 08:20:49 +0000 (11:20 +0300)]
cmd: tlv_eeprom: enable 'dev' subcommand before 'read'

Move the handler for "tlv_eeprom dev X" command to the beginning of
do_tlv_eeprom, to allow using it before issuing a "read" command for
currently selected eeprom.

Also remove the check if eeprom exists, since that can only work after
the first execution of read_eeprom triggered device lookup.
Instead accept values up to the defined array size (MAX_TLV_DEVICES).

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agocmd: tlv_eeprom: handle -ENODEV error from read_eeprom function
Josua Mayer [Fri, 5 May 2023 08:20:48 +0000 (11:20 +0300)]
cmd: tlv_eeprom: handle -ENODEV error from read_eeprom function

When tlv eeprom does not exist, return error code instead of quietly
making up tlv structure in memory.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agocmd: tlv_eeprom: remove use of global variable has_been_read
Josua Mayer [Fri, 5 May 2023 08:20:47 +0000 (11:20 +0300)]
cmd: tlv_eeprom: remove use of global variable has_been_read

has_been_read is only used as an optimization for do_tlv_eeprom.
Explicitly use and set inside this function, thus making read_eeprom
stateless.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agocmd: tlv_eeprom: remove use of global variable current_dev
Josua Mayer [Fri, 5 May 2023 08:20:46 +0000 (11:20 +0300)]
cmd: tlv_eeprom: remove use of global variable current_dev

Make tlv_eeprom command device selection an explicit parameter of all
function calls.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>