Commit graph

83669 commits

Author SHA1 Message Date
Heinrich Schuchardt
89d47b33b5 Kconfig: move NXP specific stuff into a sub-menu
Having NXP specific items in the main menu is confusing. Especially
the comment line

   *** Other functionality shared between NXP SoCs ***

is simply misleading.

Move all NXP stuff into a separate sub-menu.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-01-11 15:02:24 -05:00
Heinrich Schuchardt
c394e8d0ee Kconfig: clean up skipping low-level initialization
Put all entries for skipping low-level initialization into a sub-menu.
Use different titles for main U-Boot, SPL, TPL.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-01-11 15:02:24 -05:00
Heinrich Schuchardt
5f7a507eb3 Dockerfile: add package texinfo
In preparation of adding the infodocs target to our CI install the
prerequisite texinfo software package.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-01-11 15:02:24 -05:00
Qu Wenruo
11d5670125 fs/btrfs: handle data extents, which crosss stripe boundaries, correctly
[BUG]
Since btrfs supports single device RAID0 at mkfs time after btrfs-progs
v5.14, if we create a single device raid0 btrfs, and created a file
crossing stripe boundary:

  # mkfs.btrfs -m dup -d raid0 test.img
  # mount test.img mnt
  # xfs_io -f -c "pwrite 0 128K" mnt/file
  # umount mnt

Since btrfs is using 64K as stripe length, above 128K data write is
definitely going to cross at least one stripe boundary.

Then u-boot would fail to read above 128K file:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 BTRFS: An error occurred while reading file file
 Failed to load 'file'

[CAUSE]
Unlike tree blocks read, data extent reads doesn't consider cases in which
one data extent can cross stripe boundary.

In read_data_extent(), we just call btrfs_map_block() once and read the
first mapped range.

And if the first mapped range is smaller than the desired range, it
would return error.

But since even single device btrfs can utilize RAID0 profiles, the first
mapped range can only be at most 64K for RAID0 profiles, and cause false
error.

[FIX]
Just like read_whole_eb(), we should call btrfs_map_block() in a loop
until we read all data.

Since we're here, also add extra error messages for the following cases:

- btrfs_map_block() failure
  We already have the error message for it.

- Missing device
  This should not happen, as we only support single device for now.

- __btrfs_devread() failure

With this bug fixed, btrfs driver of u-boot can properly read the above
128K file, and have the correct content:

 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >     131072  Fri Dec 30 00:18:25 2022  file
 => load host 0 0 file
 131072 bytes read in 0 ms
 => md5sum 0 0x20000
 md5 for 00000000 ... 0001ffff ==> d48858312a922db7eb86377f638dbc9f
 ^^^ Above md5sum also matches.

Reported-by: Sam Winchenbach <swichenbach@tethers.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
2023-01-11 15:02:24 -05:00
Pali Rohár
3133651aa4 ata: Fix dependency for CONFIG_SATA_SIL
sata_sil.c is PCI driver and without CONFIG_PCI is building of U-Boot failing:

      LD      u-boot
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_exec_cmd':
    drivers/ata/sata_sil.c:148: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_pci_probe':
    drivers/ata/sata_sil.c:687: undefined reference to `dm_pci_get_bdf'
    ld.bfd: drivers/ata/sata_sil.c:691: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.c:701: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:704: undefined reference to `dm_pci_map_bar'
    ld.bfd: drivers/ata/sata_sil.c:713: undefined reference to `dm_pci_write_config16'
    ld.bfd: drivers/ata/sata_sil.c:717: undefined reference to `dm_pci_read_config16'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_cmd_identify_device':
    drivers/ata/sata_sil.c:256: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd':
    drivers/ata/sata_sil.c:330: undefined reference to `dm_pci_phys_to_bus'
    ld.bfd: drivers/ata/sata_sil.o: in function `sil_sata_rw_cmd_ext':
    drivers/ata/sata_sil.c:377: undefined reference to `dm_pci_phys_to_bus'
    make: *** [Makefile:1778: u-boot] Error 1

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2023-01-11 15:02:24 -05:00
Brandon Maier
bde4c49c17 test: compression: use ut_assert for errors
Use the ut_assert macros for more useful error messages.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 15:02:24 -05:00
Brandon Maier
43b059884a test: compression: check with trailing garbage in input
The Linux kernel appends 4 bytes to the end of compressed kernel Images
containing the uncompressed image size. They are used to make
self-decompressing Images easier. However for archs that don't support
self-decompression, like ARM64, U-Boot must be able to decompress the
image with the garbage data.

The existing decompressors already support this. This unit test was
added while working on zstd support as upstream zstd will error if there
is garbage data in the input buffer, and special care was needed to
support this.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 15:02:24 -05:00
David Oberhollenzer
bf48dde80a fs/squashfs: Only use export table if available
For a squashfs filesystem, the fragment table is followed by
the following tables: NFS export table, ID table, xattr table.

The export and xattr tables are both completely optional, but
the ID table is mandatory. The Linux implementation refuses to
mount the image if the ID table is missing. Tables that are no
present have their location in the super block set
to 0xFFFFFFFFFFFFFFFF.

The u-boot implementation previously assumed that it can always
rely on the export table location as an upper bound for the fragment
table, trying (and failing) to read past filesystem bounds if it
is not present.

This patch changes the driver to use the ID table instead and only
use the export table location if it lies between the two.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2023-01-11 15:02:24 -05:00
Marek Vasut
f08dcd9fd0 test: cmd: exit: Add unit test for exit and partly run commands
Add a test which validates that exit from environment script works as
expected, including return value propagation and clipping to positive
integers.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11 15:02:24 -05:00
Marek Vasut
721307eba0 cmd: exit: Fix return value propagation out of environment scripts
Make sure the 'exit' command as well as 'exit $val' command exits
from environment scripts immediately and propagates return value
out of those scripts fully. That means the following behavior is
expected:

"
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0
"

As well as the followin behavior:

"
=> setenv foo 'echo bar ; exit 3 ; echo fail'; run foo; echo $?
bar
3
=> setenv foo 'echo bar ; exit 1 ; echo fail'; run foo; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -1 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2 ; echo fail'; run foo; echo $?
bar
0
=> setenv foo 'echo bar ; exit ; echo fail'; run foo; echo $?
bar
0
"

Fixes: 8c4e3b79bd ("cmd: exit: Fix return value")
Reviewed-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Marek Vasut <marex@denx.de>
2023-01-11 15:02:24 -05:00
Sean Anderson
f3d914cfdd fastboot: Add OEM run command
This adds the UUU UCmd functionality as an OEM command. While the
fastboot tool allows sending arbitrary commands as long as they are
prefixed with "oem". This allows running generic U-Boot commands over
fastboot without UUU, which is especially useful when not using USB.
This is really the route we should have gone in the first place when
adding these commands.

While we're here, clean up the UUU Kconfig a bit.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2023-01-11 15:02:24 -05:00
Patrick Delaunay
d037990046 fastboot: remove #ifdef CONFIG when it is possible
Much of the fastboot code predates the introduction of Kconfig and
has quite a few #ifdefs in it which is unnecessary now that we can use
IS_ENABLED() et al.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3l
2023-01-11 15:02:24 -05:00
Patrick Delaunay
59dacc3190 optee: bind the TA drivers on OP-TEE node
In U-Boot driver model the devices can be referenced by
phandle in the U-Boot configuration nodes.

Without a valid node provided during the bind, the driver
associated to OP-TEE TA can't be referenced.

For example to force the sequence number with alias
(.flags = DM_UC_FLAG_SEQ_ALIAS)

 	aliases {
		rng0 = &optee;
 	};

or other configuration:

board-sysinfo {
   compatible = "vendor,sysinfo-board";
   ramdom = <&optee>;
}

With this patch all drivers bound from OP-TEE service
discovery are now associated are associated to OP-TEE
node, allowing to identify by phandle the driver
provided by the TA for one UCLASS without modifying
device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-11 15:02:24 -05:00
Patrick Delaunay
1c44d10879 env: add failing trace in env_erase
Add trace in env save to indicate any errors to end user and avoid
silent output when the command 'env erase' is not executed as it is
done in env_save with commit 8968288cb4 ("env: add failing trace in
env_save")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2023-01-11 15:02:24 -05:00
Patrick Delaunay
91fc785834 env: ubi: add support of command env erase
Add support of opts erase for ubi env backend, this opts is used by
command 'env erase'.

This command only zero-fill the env UBI volume CONFIG_ENV_UBI_VOLUME
and CONFIG_ENV_UBI_VOLUME_REDUND, so the saved environment becomes
invalid.

This patch introduces a local define ENV_UBI_VOLUME_REDUND
only to avoid #if in the code, as CONFIG_ENV_UBI_VOLUME_REDUND
is only defined when CONFIG_SYS_REDUNDAND_ENVIRONMENT is defined.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2023-01-11 15:02:24 -05:00
Max Krummenacher
e64289e1ec test: env: add test for u-boot-initial-env creation
Checks that `make u-boot-initial-env` creates the text file
u-boot-initial-env and checks that it at least contains
`board=<something>`.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 15:02:23 -05:00
Shenlin Liang
5b333b9324 cmd: change the return value when argc error
When the number of parameters is wrong, the return value should be processed in
the same way as other cmds, return CMD_RET_USAGE so that it can print the information.

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 11:54:50 -05:00
Patrick Delaunay
6762c8dd89 cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT
The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
allows the MTDIDS and MTDPARTS to be configured at runtime.

This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
is only used by two platforms (stm32mp and igep00x0) which don't define
CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.

This patch solves an UBI environment load issue for NAND boot for
stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
env_get_f() return a EMPTY string, define in default_environment[]
because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
but a NULL pointer is expected to allow call of board_mtdparts_default.
Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].

It is not a problem when env becomes ready, as these empty variables are
removed form U-Boot environment in env_import() / himport_r().

Fixes: a331017c23 ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-11 11:54:50 -05:00
Haijun Qin
dd02c66790 lib: rsa: cosmetic: fix building warning
add initialization of variable 'node',this can aviod the building
warning:

    'node' may be used uninitialized [-Wmaybe-uninitialized]

Signed-off-by: Haijun Qin <qinhaijun@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 11:54:50 -05:00
Sean Anderson
46b2e5e92c reboot-mode: Add NVMEM reboot mode
This adds an NVMEM reboot mode driver, similar to Linux's
implementation. This allows using the same device tree binding for Linux
and U-Boot in most cases.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 11:54:50 -05:00
Sean Anderson
546795b579 rtc: abx8xx: Add support for reading RAM
This adds support for reading the battery-backed memory present on these
RTCs. This modifies the read/write methods to access the RAM instead of
raw register offsets. No one was using these in-tree, so we should be
fine changing them.

We use the "standard" address space window to access the RAM. The
extension RAM address register has some reserved bits, but we write the
whole thing for simplicity (as these bits default to 0).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2023-01-11 11:54:50 -05:00
Shenlin Liang
c9c42ad21f common:autoboot:modify function parameters
the blob parameter of the function process_fdt_options has not been
invoked in the function body and should be changed to void type

Signed-off-by: Shenlin Liang <liangshenlin@eswincomputing.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-11 11:54:49 -05:00
Tom Rini
ee4f86cc04 Merge branch '2023-01-10-platform-updates'
- Platform updates for TI, nuvoton pinctrl, starqltechn/sdm845 fixes,
  and assorted platform CONFIG_BUILD_TARGET corrections
2023-01-10 21:13:57 -05:00
Andrew Davis
367c9e0614 ARM: omap3: evm: Name this directory omap3evm
Before this was named just evm, which doesn't match the naming
of the other TI board file directory and makes it look like a
common directory for evms. Name this omap3evm.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Derald Woods <woods.technical@gmail.com>
2023-01-10 15:39:08 -05:00
Pali Rohár
f7f14cf027 powerpc/mpc85xx: Unset CONFIG_SPL_TARGET="u-boot-with-spl.bin"
CONFIG_SPL_TARGET should specify additional SPL make target. But
u-boot-with-spl.bin is final U-Boot binary, not SPL binary in some custom
format. Moreover u-boot-with-spl.bin is already set in CONFIG_BUILD_TARGET,
so make will build it by default.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-01-10 15:39:07 -05:00
Pali Rohár
e0025d9957 powerpc/mpc85xx: Set default CONFIG_BUILD_TARGET
Final U-Boot binary for mpc85xx boards which use SPL and are not PBL-based
based is u-boot-with-spl.bin. PBL is not used only on boards with e500v1
and e500v2 cores. Apparently CONFIG_E500 is set not only for e500 cores,
but also for all other mpc85xx cores e500mc, e5500 and e5600. So do not use
CONFIG_E500 and instead filter new cores with PBL based bootrom.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-01-10 15:39:07 -05:00
Pali Rohár
f0b1a1e13e arm: mvebu: Fix default CONFIG_BUILD_TARGET
u-boot-with-spl.kwb is built only for SPL enabled 32-bit armada boards.
u-boot.kwb is built for 32-bit armada and kirkwood boards but only for
non-SPL targets.

So replace CONFIG_ARCH_MVEBU by CONFIG_ARMADA_32BIT (it implies
CONFIG_ARCH_MVEBU) for u-boot-with-spl.kwb.

And add additional CONFIG_ARMADA_32BIT && !CONFIG_SPL for u-boot.kwb.

Signed-off-by: Pali Rohár <pali@kernel.org>
2023-01-10 15:39:07 -05:00
Dzmitry Sankouski
971ccee2fb SoC: sdm845: find and save KASLR to env variables
KASLR address is needed to boot fully functional Android.
KASLR is set by primary bootloader, and since u-boot is used
as a secondary bootloader(replacing kernel) on sdm845 platform,
KASLR may be found by comparing memory chunks at relocaddr over
supposed KASLR range.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-01-10 15:39:07 -05:00
Dzmitry Sankouski
40c69cc922 board: starqltechn: enable serial console
It was temporary disabled due to problem with boot.
Issue was fixed in
commit f5ed6c9ccf ("uart: sdm845: Fix debug UART pinmux")

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
2023-01-10 15:39:07 -05:00
Bryan Brattlof
221ae89bc8 configs: am62a: use kernel fitImage when using secure bootflow
In order to maintain the chain of trust, each stage of the boot process
will first authenticate each binary it loads before continuing. To
extend this to the kernal and its dtbs we can package the kernal and
its dtbs into another fitImage for Uboot to authenticate and extend the
chain of trust all the way to the kernel.

When 'boot_fit' is set, indicating we're using the secure bootflow, look
for and authenticate the kernel's fitImage.

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
2023-01-10 15:39:07 -05:00
Bryan Brattlof
e625bfe5ad configs: am62a: convert bootcmd to distro_bootcmd
We're currently using CONFIG_BOOTCOMMAND to run custom boot scripts to
jump into linux. While this works, let's begin the transition to more
distribution friendly jumps to linux by enabling distro_bootcmd.

Convert the custom bootcmd to a distro_bootcmd

Signed-off-by: Judith Mendez <jm@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
2023-01-10 15:39:07 -05:00
Bryan Brattlof
b672e85810 arm: mach-k3: copy bootindex to OCRAM for main domain SPL
Texas Instruments has begun enabling security settings on the SoCs it
produces to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM and TIFS do this is by enabling firewalls to protect the
OCSRAM and HSM RAM regions they're using during bootup.

The HSM RAM the wakeup SPL is in is firewalled by TIFS to protect
itself from the main domain applications. This means the 'bootindex'
value in HSM RAM, left by ROM to indicate if we're using the primary
or secondary boot-method, must be moved to OCSRAM (that TIFS has open
for us) before we make the jump to the main domain so the main domain's
bootloaders can keep access to this information.

Signed-off-by: Bryan Brattlof <bb@ti.com>
2023-01-10 15:39:07 -05:00
Bryan Brattlof
940b7128c9 configs: am62a: move stack and heap to HSM RAM
Texas Instruments has begun enabling security setting on the SoCs they
produce to instruct ROM and TIFS to begin protecting the Security
Management Subsystem (SMS) from other binaries we load into the chip by
default.

One way ROM does this is by enabling firewalls to protect the OCSRAM
region it's using during bootup. Only after TIFS has started (and had
time to disable the OCSRAM firewall region) will we have write access to
the region.

This means we will need to move the stack & heap from OCSRAM to HSM RAM
and reduce the size of BSS and the SPL to allow it to fit properly.

Signed-off-by: Bryan Brattlof <bb@ti.com>
2023-01-10 15:39:07 -05:00
Bryan Brattlof
d12561211d configs: restrict am62ax wakup SPL size
In its current form, the am62a's wakeup SPL is fairly small, however
this will not remain as more boot modes are eventually added. To protect
us from overflowing our ~256k of HSM SRAM, add limits and check during
the wakeup SPL build.

Signed-off-by: Bryan Brattlof <bb@ti.com>
2023-01-10 15:39:07 -05:00
Martyn Welch
83f5195e32 configs: Enable distroboot on am625
TI boards use a custom (though faily common to TI boards) mechanism for
booting Linux. We would like to use the "distroboot" approach.

Enable distroboot as a further option to use for booting on am625 should
the existing options fail.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
2023-01-10 15:39:07 -05:00
Martyn Welch
7c34b71a42 arm64:mach-k3 am625_init: Correct boot mode detection
The boot mode detection assumes that BOOT_DEVICE_MMC2 should always
result in MMCSD_MODE_FS, but MMCSD_MODE_RAW is also a valid option for
this port.

The current logic also avoids looking at the bootmode pin strapping,
which should be the primary means of determining whether a device is
being booted in MMCSD_MODE_EMMCBOOT mode.

Switch around the logic to check the boot mode to determine whether the
eMMC boot mode is expected or MMC/SD boot mode. From there we can look
at the boot mode config if in MMC/SD boot mode to determine whether to
attempt RAW or FS based booting.

This change allows U-Boot to also be successfully booted from RAW
offsets in addition to from a filesystem.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
2023-01-10 15:39:06 -05:00
Sjoerd Simons
92a15f69d5 configs: am62x_evm_a53: Enable ethernet
Enable ethernet support for u-boot on am62x evm

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2023-01-10 15:39:06 -05:00
Sjoerd Simons
39248d3260 arm: dts: k3-am625-sk: Enable first ethernet port
The K3 am625 sk EVM has two ethernet ports; Enable the first one for
usage in u-boot.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2023-01-10 15:39:06 -05:00
Sjoerd Simons
21d39eb5a5 configs: am62x_evm_*: Run savedefconfig
Clean configuration for am62x_evm using savedefconfig

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Tested-by: Dhruva Gole <d-gole@ti.com>
2023-01-10 15:39:06 -05:00
Sjoerd Simons
a8ddc37ec3 configs: am62x_evm_*: Correct SPI configuration option
In f422c4bec the configuration option to support s28hs512t SPI flashes
was changed from CONFIG_SPI_FLASH_S28HS512T to CONFIG_SPI_FLASH_S28HX_T
to support the wider family. Follow this change in the AM62x EVM
configurations.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
2023-01-10 15:39:06 -05:00
Jim Liu
7ee1c4d1d1 pinctrl: nuvoton: add NPCM7xx/NPCM8xx reset type detect
add reset type detect and persist setting.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2023-01-10 15:39:06 -05:00
Tom Rini
92bdaecf39 Merge branch '2023-01-10-env-mmc-improvements-and-corrections'
To quote the author:

Update in U-Boot env mmc backend with several cosmetic changes or
corrections and 2 new features:

1/ CONFIG_ENV_MMC_USE_DT = no more use CONFIG_ENV_OFFSET
   in the mmc ENV backend when this config is activated.

   Requested by the STM32MP STMicroelectronics boards which activate
   several ENV_IS_IN_XXX; the value of CONFIG_ENV_OFFSET is invalid for
   SD-Card / eMMC boot; this offset should only used in SPIFlash backend
   (sf.c) for SPI-NOR boot.

   If this offset is used on mmc backend, when partition name in GPT is
   not aligned with  U-Boot DT: "u-boot,mmc-env-partition", the behavior
   is difficult to debug: a partition is corrupted on 'env save' command.

2/ selects the GPT env partition by the "u-boot-env" type GUID introduced
   by the commit c0364ce1c6 ("doc/README.gpt: define partition
   type GUID for U-Boot environment")

   This feature can also avoid issue when 'u-boot-env' partition name
   change in GPT partitioning but not in the U-Boot DT with
   "u-boot,mmc-env-partition"
2023-01-10 14:49:32 -05:00
Patrick Delaunay
6a90e92564 env: mmc: cosmetic: remove unused macro STR(X)
Remove the unused macro STR(X) since the commit 2b2f727500 ("env: mmc:
allow support of mmc_get_env_dev with OF_CONTROL")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
52e9aa3cd2 env: mmc: add debug message when mmc-env-partition is not found
Add a debug message to indicate a potential issue when
"u-boot,mmc-env-partition" is present in config node of device tree
but this partition name is not found in the mmc device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
80105d8fd5 env: mmc: select GPT env partition by type guid
Since commit c0364ce1c6 ("doc/README.gpt: define partition type GUID for
U-Boot environment"), a specific type GUID can be used to indicate
the U-Boot environment partition on the device with GPT partition table.

This patch uses this type GUID to found the env partition as fallback
when the partition name property "u-boot,mmc-env-partition" is not present
in config node or if the indicated partition name is not found.

The mmc_offset_try_partition() function is reused, it selects the first
partition with the correct type GUID when the parameter 'str' is NULL.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
0902bcdbb3 configs: stm32mp: activate CONFIG_ENV_MMC_USE_DT
Activate by default CONFIG_ENV_MMC_USE_DT as "u-boot,mmc-env-partition"
should be always use in STMicroelectronics boards device tree to locate
the environment for mmc backend. The 2 defines:
  CONFIG_ENV_OFFSET=0x280000
  CONFIG_ENV_OFFSET_REDUND=0x2C0000
are only valid for spi-nor and not for SD-Card or eMMC.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
d2103e20a9 env: mmc: add CONFIG_ENV_MMC_USE_DT
Add a new config CONFIG_ENV_MMC_USE_DT to force configuration of the
U-Boot environment offset with device tree config node.

This patch avoids issues when several CONFIG_ENV_IS_IN_XXX are activated,
the defconfig file uses the same value for CONFIG_ENV_OFFSET or
CONFIG_ENV_OFFSET_REDUND for the several ENV backends (SPI_FLASH, EEPROM
NAND, SATA, MMC).

After this patch a bad offset value is not possible when the selected
partition in device tree is not found.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
8566050e24 env: mcc: fix compilation error with ENV_IS_EMBEDDED
When ENV_IS_EMBEDDED is enabled, ret is not defined but is used as a
return value in env_mmc_load().
This patch correct this issue and simplify the existing code, test only
one time #if defined(ENV_IS_EMBEDDED) and not in the function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
46c9016b7f env: mcc: Drop unnecessary #ifdefs
This file has a lot of conditional code and much of it is unnecessary.
Clean this up to reduce the number of build combinations.

This patch replaces the test on CONFIG_ENV_OFFSET_REDUND for the
more coherent CONFIG_SYS_REDUNDAND_ENVIRONMENT.

This patch also corrects a compilation issue in init_mmc_for_env()
when CONFIG_SYS_MMC_ENV_PART is not activated, env_mmc_orig_hwpart is
not defined.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00
Patrick Delaunay
f7e07a7ef4 env: mmc: introduced ENV_MMC_OFFSET
Introduce ENV_MMC_OFFSET defines.
It is a preliminary step to the next patches to simplify the code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-01-10 12:37:09 -05:00