]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
8 months agofs: ext4: make "File System is consistent\n" a debug message
Heinrich Schuchardt [Wed, 20 Mar 2024 13:23:52 +0000 (14:23 +0100)]
fs: ext4: make "File System is consistent\n" a debug message

When accessing an ext2 system the message "File System is consistent\n" is
shown after each write. This is superfluous noise. Only write a debug
message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agobuild: Revive and update LDR format support
Greg Malysa [Wed, 20 Mar 2024 02:16:07 +0000 (22:16 -0400)]
build: Revive and update LDR format support

LDR format files are used primarily by Analog Devices processors but may
be of interest to other vendors. Previously support existed for this
format as part of the U-Boot build, but it has been unmaintained and
unused for a long time. In preparation for adding support for modern ADI
processors that use LDR, modernize the LDR support:

- Introduce CONFIG_LDR_CPU as the CPU string recognized by the LDR tool
  may not be the same as CONFIG_CPU
- Add an SPL target that repackages u-boot-spl inside an LDR file

An almost identical target for packaging u-boot into an LDR file already
exists and did not need to be created.

Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
8 months agoscripts/Makefile.spl: Use 'sort' in SHRUNK_ARCH_DTB rule
Tom Rini [Tue, 19 Mar 2024 16:51:31 +0000 (12:51 -0400)]
scripts/Makefile.spl: Use 'sort' in SHRUNK_ARCH_DTB rule

With configs such as "am64x_evm_a53" or "imx8mp_venice" which list
multiple device trees to build we get a warning such as:
scripts/Makefile.spl:578: target 'spl/dts/freescale/' given more than once in the same rule

If we sort this list first the warning goes away.

Tested-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agofs: ext4: Change the Settings of file permissions
Jixiong Hu [Tue, 19 Mar 2024 09:20:40 +0000 (17:20 +0800)]
fs: ext4: Change the Settings of file permissions

When a file is created in the linux and corresponding file permission
is set, if the file needs to be modified in uboot during the startup
process, the modified file permission will be reset to 755. Therefore,
when the ext4fs_write() function is called, if the file already exists,
the file permission of the new file is equal to the file permission of
the existing file.

8 months agocmd: sysboot: null check filename
Caleb Connolly [Mon, 18 Mar 2024 23:16:36 +0000 (23:16 +0000)]
cmd: sysboot: null check filename

Currently if ${bootfile} is unset and sysboot is invoked with no
filename specified then U-Boot will crash will a null-pointer
dereference. Add the missing check and a matching error print.

Fixes: 993c912d304d ("cmd: sysboot: Create a sysboot command dedicated file")
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoarm64: Fix map_range() not splitting mapped blocks
Pierre-Clément Tosi [Mon, 18 Mar 2024 19:35:49 +0000 (19:35 +0000)]
arm64: Fix map_range() not splitting mapped blocks

The implementation of map_range() creates the requested mapping by
walking the page tables, iterating over multiple PTEs and/or descending
into existing table mappings as needed. When doing so, it assumes any
pre-existing valid PTE to be a table mapping. This assumption is wrong
if the platform code attempts to successively map two overlapping ranges
where the latter intersects a block mapping created for the former.

As a result, map_range() treats the existing block mapping as a table
mapping and descends into it i.e. starts interpreting the
previously-mapped range as an array of PTEs, writing to them and
potentially even descending further (extra fun with MMIO ranges!).

Instead, pass any valid non-table mapping to split_block(), which
ensures that it actually was a block mapping (calls panic() otherwise)
before splitting it.

Fixes: 41e2787f5ec4 ("arm64: Reduce add_map() complexity")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Toradex Verdin AM62
Reviewed-by: Marc Zyngier <maz@kernel.org>
8 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 9 Apr 2024 20:18:55 +0000 (14:18 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv

CI: https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/20256

- RISC-V: Support backtrace and improve isa extension parsing
- cpu: Add cv1800b SoC support
- board: Add Milk-V Mars board support
- board: Add Milk-V Duo SD card support

8 months agodoc: describe Milk-V Mars board
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:12 +0000 (10:49 +0200)]
doc: describe Milk-V Mars board

Add instructions to build U-Boot for the Milk-V Mars board

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: starfive: avoid including common.h
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:11 +0000 (10:49 +0200)]
riscv: starfive: avoid including common.h

The usage of common.h is deprecated. Remove it from board files.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoboard: starfive: support Milk-V Mars board
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:10 +0000 (10:49 +0200)]
board: starfive: support Milk-V Mars board

The differences between the Milk-V Mars board and the VisionFive 2 board
are small enough that we can support both using the same U-Boot build.

* The model and compatible property are taken from proposed Linux patches.
* The EEPROM is atmel,24c02 according to the vendor U-Boot.
* The second Ethernet port is not available.

usb@10100000 does not exist in U-Boot yet. So we don't have to reflect
differences in usage here.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: set fdtfile on Milk-V Mars
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:09 +0000 (10:49 +0200)]
riscv: set fdtfile on Milk-V Mars

Set environment variable fdtfile to the correct value for the Milk-V Mars
board.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoeeprom: starfive: function get_product_id_from_eeprom()
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:08 +0000 (10:49 +0200)]
eeprom: starfive: function get_product_id_from_eeprom()

Export a function get_product_id_from_eeprom() to read the product ID.
This value can be used for fixing up the device-tree on JH7110 based
products.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: do not set default fdt for VisionFive 2
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:07 +0000 (10:49 +0200)]
riscv: do not set default fdt for VisionFive 2

Currently in set_fdtfile() we set the value of environment variable fdtfile
unconditionally. The implies that a value in the environment will be
ignored.

With the patch environment variable fdtfile will only be set if it does not
yet exist. This requires that CONFIG_DEFAULT_FDT_FILE is not set.

Now the user can either set and save fdtfile interactively or in the U-Boot
configuration to overrule the device-tree name chosen based on the
hardware in set_fdtfile().

Reported-by: E Shattow <lucent@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: starfive: MMC card detect
Heinrich Schuchardt [Thu, 28 Mar 2024 21:46:15 +0000 (22:46 +0100)]
riscv: starfive: MMC card detect

The VisionFive 2 board uses GPIO 41 as card detect as documented in
https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Minda Chen <minda.chen@starfivetech.com>
8 months agoriscv: Move virtio scan to board_late_init()
Łukasz Stelmach [Thu, 28 Mar 2024 09:58:24 +0000 (10:58 +0100)]
riscv: Move virtio scan to board_late_init()

When virtio_init() gets called from board_init() PCI isn't ready. Thus,
virtio-over-PCI (e.g. network interfaces) devices can't be detected and
used without additional `virtio scan` scan in the shell or a script.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: support extension probing using riscv, isa-extensions
Conor Dooley [Mon, 18 Mar 2024 15:16:03 +0000 (15:16 +0000)]
riscv: support extension probing using riscv, isa-extensions

A new property has been added, with an extensive rationale at [1], that
can be used in place of "riscv,isa" to indicate what extensions are
supported by a given platform that is a list of strings rather than a
single string. There are some differences between the new property,
"riscv,isa-extensions" and the incumbent "riscv,isa" - chief among them
for the sake of parsing being the list of strings, as opposed to a
string. Another advantage is strictly defined meanings for each string
in a dt-binding, rather than deriving meaning from RVI standards. This
will likely to some divergence over time, but U-Boot's current use of
extension detection is very limited - there are just four callsites of
supports_extension() in mainline U-Boot.

These checks are limited to two checks for FPU support and two checks
for "s" and "u". "s" and "u" are not supported by the new property, but
they were also not permitted in "riscv,isa". These checks are only
meaningful (or run) in M-Mode, in which case supports_extension() does
not parse the devicetree anyway.

Add support for the new property in U-Boot, prioritising it, before
falling back to the, now deprecated, "riscv,isa" property if it is not
present.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: don't read riscv, isa in the riscv cpu's get_desc()
Conor Dooley [Mon, 18 Mar 2024 15:16:02 +0000 (15:16 +0000)]
riscv: don't read riscv, isa in the riscv cpu's get_desc()

cpu_get_desc() for the RISC-V CPU currently reads "riscv,isa" to get
the description, but it is no longer a required property and cannot be
assummed to always be present, as the new "riscv,isa-extensions" and
"riscv,isa-base" properties may be present instead.

On RISC-V, cpu_get_desc() has two main uses - firstly providing an
informational name for the CPU for smbios or at boot with
DISPLAY_CPUINFO etc and secondly it forms the basis of ISA extension
detection in supports_extension() as it returns (a portion of) an ISA
string.

cpu_get_desc() returns a string, which aligned with "riscv,isa" but
the new property is a list of strings. Rather than add support for
the list of strings property, which would require creating an isa
string from "riscv,isa-extensions", modify the RISC-V CPU's
implementaion of cpu_get_desc() return the first compatible as the
cpu description instead. This may be fine for the informational cases,
but it would break extension dtection, given supports_extension()
expects cpu_get_desc() to return an ISA string.

Call dev_read_string() directly in supports_extension() to get the
contents of "riscv,isa" so that extension detection remains functional.
As a knock-on affect of this change, extension detection is no longer
broken for long ISA strings. Previously if the ISA string exceeded the
32 element array that supports_extension() passed to cpu_get_desc(),
it would return ENOSPC and no extensions would be detected.
This bug probably had no impact as U-Boot does not currently do anything
meaningful with the results of supports_extension() and most SoCs
supported by U-Boot don't have anywhere near that complex of an ISA
string. The QEMU virt machine's CPUs do however, so extension detection
doesn't work there.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

8 months agoconfigs: milkv_duo: Add SD card configs
Kongyang Liu [Sat, 9 Mar 2024 17:51:57 +0000 (01:51 +0800)]
configs: milkv_duo: Add SD card configs

Add configs related to sdhci and mmc for Sophgo Milk-V Duo board

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: dts: sophgo: Add clk node and sdhci node
Kongyang Liu [Sat, 9 Mar 2024 17:51:56 +0000 (01:51 +0800)]
riscv: dts: sophgo: Add clk node and sdhci node

Add clk node and sdhci node for cv18xx SoCs according to patches from Linux
kernel.

clk: https://lore.kernel.org/all/IA1PR20MB4953F9AD6792013B54636F05BB4F2@IA1PR20MB4953.namprd20.prod.outlook.com/
sdhci: https://lore.kernel.org/all/20240217144826.3944-1-jszhang@kernel.org/

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agommc: cv1800b: Add sdhci driver support for cv1800b SoC
Kongyang Liu [Sat, 9 Mar 2024 17:51:55 +0000 (01:51 +0800)]
mmc: cv1800b: Add sdhci driver support for cv1800b SoC

Add sdhci driver for cv1800b SoC.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: cache: Implement dcache for cv1800b
Kongyang Liu [Sat, 9 Mar 2024 16:54:57 +0000 (00:54 +0800)]
riscv: cache: Implement dcache for cv1800b

Add dcache operations invalidate_dcache_range and flush_dcache_range for
cv1800b.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: cpu: cv1800b: Add support for cv1800b SoC
Kongyang Liu [Sat, 9 Mar 2024 16:54:56 +0000 (00:54 +0800)]
riscv: cpu: cv1800b: Add support for cv1800b SoC

Add Sophgo cv1800b SoC to support RISC-V arch.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoriscv: add backtrace support
Ben Dooks [Tue, 5 Sep 2023 12:12:53 +0000 (13:12 +0100)]
riscv: add backtrace support

When debugging, it is useful to have a backtrace to find
out what is in the call stack as the previous function (RA)
may not have been the culprit.

Since this adds size to the build, do not add it by default
and avoid putting it in the SPL build if not needed.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>
8 months agoMerge tag 'efi-2024-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 8 Apr 2024 20:33:59 +0000 (14:33 -0600)]
Merge tag 'efi-2024-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-07-rc1

Documentation:

* improve description of FAT partition name generation
* add missing :: in doc/usage/cmd/itest.rst

UEFI:

* fix address mode for __efi_runtime_start/stop,
  __efi_runtime_rel_start/stop
* fix size of variable attribute constants
* enable booting via EFI boot manager by default
* correct the sequence of the EFI boot methods
* correct finding the default EFI binary
* don't delete variable from memory if update failed
* fix append write behavior to non-existent variable
* Use binman for testing capsule updates on the sandbox
* Consider capsule test files in .gitignore and make clean

8 months agoefi_loader: access __efi_runtime_rel_start/stop without &
Ilias Apalodimas [Thu, 4 Apr 2024 06:37:37 +0000 (09:37 +0300)]
efi_loader: access __efi_runtime_rel_start/stop without &

A symbol defined in a linker script (e.g. __efi_runtime_rel_start = .;)
is only a symbol, not a variable and should not be dereferenced.
The common practice is either define it as
extern uint32_t __efi_runtime_rel_start or
extern char __efi_runtime_rel_start[] and access it as
&__efi_runtime_rel_start or __efi_runtime_rel_start respectively.

So let's access it properly since we define it as an array

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoefi_loader: access __efi_runtime_start/stop without &
Ilias Apalodimas [Thu, 4 Apr 2024 06:35:35 +0000 (09:35 +0300)]
efi_loader: access __efi_runtime_start/stop without &

A symbol defined in a linker script (e.g. __efi_runtime_start = .;) is
only a symbol, not a variable and should not be dereferenced.
The common practice is either define it as
extern uint32_t __efi_runtime_start or
extern char __efi_runtime_start[] and access it as
&__efi_runtime_start or __efi_runtime_start respectively.

So let's access it properly since we define it as an array

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoboot: correct finding the default EFI binary
Heinrich Schuchardt [Wed, 3 Apr 2024 21:39:48 +0000 (23:39 +0200)]
boot: correct finding the default EFI binary

* The sandbox must not use an arbitrary file name bootsbox.efi but the
  file name matching the host architecture to properly boot the respective
  file. We already have an include which provides a macro with the name of
  the EFI binary. Use it.

* The path to the EFI binary should be absolute.

* The path and the file name must be capitalized to conform to the UEFI
  specification. This is important when reading from case sensitive
  file systems.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: move HOST_ARCH to version_autogenerated.h
Heinrich Schuchardt [Wed, 3 Apr 2024 23:00:41 +0000 (01:00 +0200)]
efi_loader: move HOST_ARCH to version_autogenerated.h

efi_default_filename.h requires HOST_ARCH to be defined. Up to now we
defined it via a CFLAGS. This does not scale. Add the symbol to
version_autogenerated.h instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoboot: enable booting via EFI boot manager by default
Heinrich Schuchardt [Wed, 3 Apr 2024 18:05:17 +0000 (20:05 +0200)]
boot: enable booting via EFI boot manager by default

If UEFI is enabled in U-Boot, we want it to conform to the UEFI
specification. This requires enabling the boot manager boot method.

Reported-by: E Shattow <lucent@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoboot: correct the default sequence of boot methods
Heinrich Schuchardt [Wed, 3 Apr 2024 18:34:15 +0000 (20:34 +0200)]
boot: correct the default sequence of boot methods

The default sequence of boot methods is determined by alphabetical sorting
during linkage.

* efi_mgr must run before efi to be UEFI compliant
* pxe should run as last resort

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: Don't delete variable from memory if adding a new one failed
Ilias Apalodimas [Wed, 3 Apr 2024 15:43:53 +0000 (18:43 +0300)]
efi_loader: Don't delete variable from memory if adding a new one failed

Our efi_var_mem_xxx() functions don't have a replace variant. Instead we
add a new variable and delete the old instance when trying to replace a
variable. Currently we delete the old version without checking the new
one got added

Signed-off-by: Ilias Apalodimas <apalos@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoefi_loader: handle EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS
Heinrich Schuchardt [Wed, 3 Apr 2024 15:33:35 +0000 (17:33 +0200)]
efi_loader: handle EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS

We don't yet support EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS for file
based variables, but we should pass it to TEE based variable stores.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: EFI_VARIABLE_READ_ONLY should be 32bit
Heinrich Schuchardt [Wed, 3 Apr 2024 15:33:34 +0000 (17:33 +0200)]
efi_loader: EFI_VARIABLE_READ_ONLY should be 32bit

GetVariable() and SetVariable() only accept a 32bit value for attributes.
It makes not sense to define EFI_VARIABLE_READ_ONLY as unsigned long.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: all variable attributes are 32bit
Heinrich Schuchardt [Wed, 3 Apr 2024 15:33:33 +0000 (17:33 +0200)]
efi_loader: all variable attributes are 32bit

GetVariable() and SetVariable() use an uint32_t value for attributes.
The UEFI specification defines the related constants as 32bit.

Add the missing EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS constant.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: fix append write behavior to non-existent variable
Masahisa Kojima [Tue, 2 Apr 2024 09:09:50 +0000 (18:09 +0900)]
efi_loader: fix append write behavior to non-existent variable

Current "variables" efi_selftest result is inconsistent
between the U-Boot file storage and the tee-based StandaloneMM
RPMB secure storage.

U-Boot file storage implementation does not accept SetVariale
call to non-existent variable with EFI_VARIABLE_APPEND_WRITE,
it return EFI_NOT_FOUND.
However it is accepted and new variable is created in EDK II
StandaloneMM implementation if valid data and size are specified.
If data size is 0, EFI_SUCCESS is returned.

Since UEFI specification does not clearly describe the behavior
of the append write to non-existent variable, let's update
the U-Boot file storage implementation to get aligned with
the EDK II reference implementation.

Signed-off-by: Masahisa Kojima <kojima.masahisa@socionext.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agodoc: improve description of FAT partition name generation
Heinrich Schuchardt [Fri, 29 Mar 2024 12:01:00 +0000 (13:01 +0100)]
doc: improve description of FAT partition name generation

List all prefix currently used for generating FAT partition names.
Describe which device class uses which prefix.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agodoc: missing :: in doc/usage/cmd/itest.rst
Heinrich Schuchardt [Thu, 28 Mar 2024 20:16:54 +0000 (21:16 +0100)]
doc: missing :: in doc/usage/cmd/itest.rst

Add :: for correct formatting of example.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agocapsule: Makefile: add the generated files to CLEAN_FILES list
Sughosh Ganu [Wed, 27 Mar 2024 10:49:02 +0000 (16:19 +0530)]
capsule: Makefile: add the generated files to CLEAN_FILES list

A certain set of capsule files are now generated as part of the
sandbox build. Add these files to the CLEAN_FILES list for deletion on
invoking any of the cleanup targets.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canoncal.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
8 months agocapsule: add the generated capsules to gitignore
Sughosh Ganu [Wed, 27 Mar 2024 10:49:01 +0000 (16:19 +0530)]
capsule: add the generated capsules to gitignore

The sandbox platform build now generates a set of capsules. Put the
related files generated into gitignore.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
8 months agosandbox: capsule: binman: generate some capsules as part of build
Sughosh Ganu [Wed, 27 Mar 2024 10:49:00 +0000 (16:19 +0530)]
sandbox: capsule: binman: generate some capsules as part of build

Currently, all the capsules for the sandbox platform are generated at
the time of running the capsule tests. To showcase generation of
capsules through binman, generate all raw(non FIT payload) capsules
needed for the sandbox platform as part of the build. This acts as an
illustrative example for generating capsules as part of a platform's
build.

Make corresponding change in the capsule test's configuration to get
these capsules from the build directory.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
8 months agosandbox: capsule: remove capsule related configs
Sughosh Ganu [Wed, 27 Mar 2024 10:48:59 +0000 (16:18 +0530)]
sandbox: capsule: remove capsule related configs

The capsule update testing is carried out only on the sandbox and
sandbox_flattree variants. Remove the capsule update related configs
from the other sandbox variants. This ensures that the capsule files
are generated only on variants which are used for the feature's
testing.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
8 months agoMerge tag 'u-boot-imx-master-20240405' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 5 Apr 2024 21:23:58 +0000 (17:23 -0400)]
Merge tag 'u-boot-imx-master-20240405' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/20228

- Convert imx8mp-beacon and verdin-imx8mm/verdin-imx8mp to OF_UPSTREAM.
- Enable PCIe NVMe support on imx8mp_beacon.
- Fix Ethernet and board detection on mx6cuboxi.
- Fix signature_block_hdr struct fields.
- Fix imx9_probe_mu prototype and make it to get called in
  EVT_DM_POST_INIT_R.
- Test whether ethernet node is enabled before reading MAC EEPROM on
  DHSOM SoMs.

8 months agoMerge tag 'qcom-next-2024Apr04' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 5 Apr 2024 21:23:13 +0000 (17:23 -0400)]
Merge tag 'qcom-next-2024Apr04' of https://source.denx.de/u-boot/custodians/u-boot-snapdragon

- Ethernet, i2c, and USB support are now enabled by default
- The clock driver gets some bug fixes and cleanup
- Invalid FDTs are now properly detected in board_fdt_blob_setup().
- The pinctrl driver gains preparatory support for per-pin function
  muxes.
- Support is added for two generations of Qualcomm HighSpeed USB PHY
- A power domain driver is added for the Globall Distributed Switch
  Controllers on the GCC hardware block.
- SDM845 gains USB host mode support.
- OF_LIVE is enabled by default for Qualcomm platforms
- Some U-Boot devicetree compatibility fixups are added during init to
  improve compatbility with upstream DT.

8 months agoMerge tag 'u-boot-amlogic-20240404' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 5 Apr 2024 21:22:28 +0000 (17:22 -0400)]
Merge tag 'u-boot-amlogic-20240404' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- jethubj100: fix config, MAINTAINERS & update docs
- Switch GXL, GXM, AXG, G12A, G12B & SM1 to using upstream DT

8 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 5 Apr 2024 21:21:58 +0000 (17:21 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell

- kirkwood: Switch to using upstream dts/dtsi files (Tony)
- mvebu: Turris Omnia - New board revision support (Marek)

8 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung
Tom Rini [Fri, 5 Apr 2024 21:21:37 +0000 (17:21 -0400)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-samsung

8 months agoarm: imx: fix signature_block_hdr struct fields order
Javier Viguera [Thu, 4 Apr 2024 15:11:09 +0000 (17:11 +0200)]
arm: imx: fix signature_block_hdr struct fields order

According to the documentation (for example NXP's AN13994 on encrypted
boot on AHAB-enabled devices), the format of the signature block is:

  +--------------+--------------+--------------+-------------+
  | Tag          | Length - msb | Length - lsb | Version     |
  +--------------+--------------+--------------+-------------+
  | SRK Table offset            | Certificate offset         |
  +-----------------------------+----------------------------+
  | Blob offset                 | Signature offset           |
  +-----------------------------+----------------------------+

There is no runtime error in the current u-boot code. The only user of
struct signature_block_hdr is the "get_container_size" function in the
"arch/arm/mach-imx/image-container.c" file, and it's only using the very
first fields of the struct (which are in the correct position) and thus
there is no runtime failure.

On the other hand, extending the code to get the data encryption key
blob offset on the signature header gives a wrong value as the field is
in the wrong order.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
8 months agoverdin-imx8mm/verdin-imx8mp: move imx verdins to OF_UPSTREAM
Marcel Ziswiler [Wed, 3 Apr 2024 07:15:45 +0000 (09:15 +0200)]
verdin-imx8mm/verdin-imx8mp: move imx verdins to OF_UPSTREAM

Move verdin-imx8mm and verdin-imx8mp to OF_UPSTREAM:
- handle the fact that dtbs now have a 'freescale/' prefix
- imply OF_UPSTREAM
- remove redundant files from arch/arm/dts leaving only the
  *-u-boot.dtsi files
- update MAINTAINERS files

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
8 months agoarm: imx9: Call imx9_probe_mu for DM post in board_r
Ye Li [Mon, 1 Apr 2024 01:41:09 +0000 (09:41 +0800)]
arm: imx9: Call imx9_probe_mu for DM post in board_r

This event callback imx9_probe_mu needs to be called in board_r
as well, because many ELE APIs depending on this MU probed

Signed-off-by: Ye Li <ye.li@nxp.com>
8 months agoarm: imx9: Correct imx9_probe_mu prototype
Ye Li [Mon, 1 Apr 2024 01:41:08 +0000 (09:41 +0800)]
arm: imx9: Correct imx9_probe_mu prototype

Since the event callback imx9_probe_mu is re-defined, update
its prototype.

Signed-off-by: Ye Li <ye.li@nxp.com>
8 months agomx6cuboxi: Fix Ethernet after DT sync with Linux
Josua Mayer [Sat, 30 Mar 2024 21:35:55 +0000 (18:35 -0300)]
mx6cuboxi: Fix Ethernet after DT sync with Linux

The i.MX6 Cubox-i and HummingBoards can have different PHYs at varying
addresses. U-Boot needs to auto-detect which phy is actually present,
and at which address it is responding.

Auto-detection from multiple phy nodes specified in device-tree does not
currently work correct. As a work-around merge all three possible phys
into one node with the special address 0xffffffff which indicates to the
generic phy driver to probe all addresses.

Signed-off-by: Josua Mayer <josua@solid-run.com>
[fabio: Added the changes to imx6qdl-sr-som-u-boot.dtsi.]
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Christian Gmeiner <cgmeiner@igalia.com>
Tested-by: Christian Gmeiner <cgmeiner@igalia.com>
8 months agomx6cuboxi: Do not print devicetree model
Fabio Estevam [Sat, 30 Mar 2024 21:03:31 +0000 (18:03 -0300)]
mx6cuboxi: Do not print devicetree model

The mx6cuboxi_defconfig target supports several board
variants. All of these variants use the hummingboard devicetree in U-Boot.

Currently, the devicetree model as well as the board variant name
are shown:

...
Model: SolidRun HummingBoard2 Dual/Quad (1.5som+emmc)
Board: MX6 Cubox-i
...

Printing the devicetree model that is used internally by U-Boot
may confuse users.

Unselect the CONFIG_DISPLAY_BOARDINFO option so that only the
board name is printed in board_late_init() instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Christian Gmeiner <cgmeiner@igalia.com>
8 months agoARM: imx: stm32: Test whether ethernet node is enabled before reading MAC EEPROM...
Marek Vasut [Tue, 12 Mar 2024 21:15:58 +0000 (22:15 +0100)]
ARM: imx: stm32: Test whether ethernet node is enabled before reading MAC EEPROM on DHSOM

Check whether the ethernet interface is enabled at all before reading
MAC EEPROM. As a cost saving measure, it can happen that the MAC EEPROM
is not populated on SoMs which do not use ethernet.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
8 months agoconfigs: imx8mp_beacon: Enable PCIe NVMe drives
Adam Ford [Tue, 26 Mar 2024 21:24:54 +0000 (16:24 -0500)]
configs: imx8mp_beacon: Enable PCIe NVMe drives

The baseboard supports and NVMe drives via the PCIe slot. This
requires a few extra config options to be enabled.

The NVMe can be enumerated with the following commands:

u-boot=> pci enum
PCIE-0: Link up (Gen1-x1, Bus0)
u-boot=> nvme scan
u-boot=> nvme info
Device 0: Vendor: 0x15b7 Rev: 20120022 Prod: 184960441105
            Type: Hard Disk
            Capacity: 122104.3 MB = 119.2 GB (250069680 x 512)
u-boot=>

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
8 months agoarm64: imx: imx8mn-beacon: Migrate to OF_UPSTREAM
Adam Ford [Fri, 5 Apr 2024 12:32:27 +0000 (09:32 -0300)]
arm64: imx: imx8mn-beacon: Migrate to OF_UPSTREAM

The imx8mn-beacon boards can migrate to OF_UPSTREAM which also
allows for the removal the device tree files.

Signed-off-by: Adam Ford <aford173@gmail.com>
8 months agoarm64: imx: imx8mm-beacon: Migrate to OF_UPSTREAM
Adam Ford [Fri, 5 Apr 2024 12:30:43 +0000 (09:30 -0300)]
arm64: imx: imx8mm-beacon: Migrate to OF_UPSTREAM

The imx8mm-beacon boards can migrate to OF_UPSTREAM which also
allows for the removal the device tree files.

Signed-off-by: Adam Ford <aford173@gmail.com>
8 months agoarm64: imx: imx8mp-beacon: Migrate to OF_UPSTREAM
Adam Ford [Thu, 4 Apr 2024 02:59:06 +0000 (21:59 -0500)]
arm64: imx: imx8mp-beacon: Migrate to OF_UPSTREAM

The imx8mp-beacon boards can migrate to OF_UPSTREAM which also
allows for the removal the device tree files.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
8 months agodts: meson: Drop redundant G12A, G12B & SM1 devicetree files
Neil Armstrong [Fri, 29 Mar 2024 17:51:52 +0000 (18:51 +0100)]
dts: meson: Drop redundant G12A, G12B & SM1 devicetree files

Since meson G12A, G12B & SM1 based boards switched to using upstream DT,
so drop redundant files from arch/arm/dts directory. Only *-u-boot.dtsi files
kept in arch/arm/dts directory for these boards.

Cc: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Viacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # khadas-vim3_android
Link: https://lore.kernel.org/r/20240329-u-boot-of-upstream-v2-5-2512ad3eb63d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agodts: meson-g12a: Switch to using upstream DT
Neil Armstrong [Fri, 29 Mar 2024 17:51:51 +0000 (18:51 +0100)]
dts: meson-g12a: Switch to using upstream DT

Enable OF_UPSTREAM to use upstream DT and add amlogic/ prefix to the
DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/
including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

Cc: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Viacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # khadas-vim3_android
Link: https://lore.kernel.org/r/20240329-u-boot-of-upstream-v2-4-2512ad3eb63d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agodts: meson: Drop redundant GXL, GXM & AXG devicetree files
Neil Armstrong [Fri, 29 Mar 2024 17:51:50 +0000 (18:51 +0100)]
dts: meson: Drop redundant GXL, GXM & AXG devicetree files

Since meson GXL, GXM & AXG based boards switched to using upstream DT,
so drop redundant files from arch/arm/dts directory. Only *-u-boot.dtsi files
kept in arch/arm/dts directory for these boards.

Cc: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Viacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # khadas-vim3_android
Link: https://lore.kernel.org/r/20240329-u-boot-of-upstream-v2-3-2512ad3eb63d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agodts: meson: Switch GXL, GXM & AXG to using upstream DT
Neil Armstrong [Fri, 29 Mar 2024 17:51:49 +0000 (18:51 +0100)]
dts: meson: Switch GXL, GXM & AXG to using upstream DT

Enable OF_UPSTREAM to use upstream DT and add amlogic/ prefix to the
DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/
including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory.

Cc: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Viacheslav Bocharov <adeep@lexina.in>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # khadas-vim3_android
Link: https://lore.kernel.org/r/20240329-u-boot-of-upstream-v2-2-2512ad3eb63d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoconfigs: meson64: remove amlogic prefix in fdtfile when CONFIG_OF_UPSTREAM is selected
Neil Armstrong [Fri, 29 Mar 2024 17:51:48 +0000 (18:51 +0100)]
configs: meson64: remove amlogic prefix in fdtfile when CONFIG_OF_UPSTREAM is selected

Remove amlogic/ path prefix in CFG_EXTRA_ENV_SETTINGS fdtfile when
using CONFIG_OF_UPSTREAM, otherwise amlogic/ is added twice.

Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # khadas-vim3_android
Link: https://lore.kernel.org/r/20240329-u-boot-of-upstream-v2-1-2512ad3eb63d@linaro.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoboard: amlogic: jethubj100: update docs
Viacheslav Bocharov [Tue, 27 Feb 2024 06:54:06 +0000 (09:54 +0300)]
board: amlogic: jethubj100: update docs

Improove documentation, add new revision.

Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Link: https://lore.kernel.org/r/20240227065551.580199-4-adeep@lexina.in
[narmstrong: squashed https://lore.kernel.org/all/20240326082004.1651782-1-adeep@lexina.in/]
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoboard: amlogic: jethubj100: update MAINTAINERS
Viacheslav Bocharov [Tue, 27 Feb 2024 06:54:05 +0000 (09:54 +0300)]
board: amlogic: jethubj100: update MAINTAINERS

Fix mispell in maintainer name for jethub j100 board files

Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Link: https://lore.kernel.org/r/20240227065551.580199-3-adeep@lexina.in
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoboard: amlogic: jethubj100: fix common config header
Viacheslav Bocharov [Tue, 27 Feb 2024 06:54:04 +0000 (09:54 +0300)]
board: amlogic: jethubj100: fix common config header

Fix JetHub board sequence to read correct gpio for rescue button

Signed-off-by: Viacheslav Bocharov <adeep@lexina.in>
Link: https://lore.kernel.org/r/20240227065551.580199-2-adeep@lexina.in
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
8 months agoqcom_defconfig: enable USB
Caleb Connolly [Wed, 3 Apr 2024 12:07:50 +0000 (14:07 +0200)]
qcom_defconfig: enable USB

Enable support for the DWC3 USB controller and required dependencies for
Qualcomm boards, specifically the DB845c:
* IOMMU / SMMU
* USB high-speed PHYs
* Mass storage and ACM gadgets

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoqcom_defconfig: enable livetree
Caleb Connolly [Wed, 3 Apr 2024 12:07:49 +0000 (14:07 +0200)]
qcom_defconfig: enable livetree

Qualcomm FDTs are on the larger size, and with the addition of DT
modifications during board_init() it makes sense to enable OF_LIVE
globally. The cost of building the tree should be offset by the
increased efficiency at which we can walk it.

Some rough measurements with CONFIG_BOOTSTAGE suggests that this might
add 0.1-0.2ms to the boot-to-console time. However the reset-to-reset
timer difference is in the range of 0.5ms so this could just be noise.

Suffice to say, no significant slow down.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agodts: sdm845-db845c: add u-boot fixups
Caleb Connolly [Wed, 3 Apr 2024 12:07:48 +0000 (14:07 +0200)]
dts: sdm845-db845c: add u-boot fixups

The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
This is incorrectly modelled in Linux where only the PCIe dependency is
expressed. The correct way to handle this will be through a
usb-connector node, but for now we'll just mark the regulator as
always-on so that it will be enabled automatically during boot.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agomach-snapdragon: call regulators_enable_boot_on()
Caleb Connolly [Wed, 3 Apr 2024 12:07:47 +0000 (14:07 +0200)]
mach-snapdragon: call regulators_enable_boot_on()

Make sure we power on any boot-on or always-on regulators. These are
used for peripherals like USB on some platforms.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agomach-snapdragon: fixup power-domains
Caleb Connolly [Wed, 3 Apr 2024 12:07:46 +0000 (14:07 +0200)]
mach-snapdragon: fixup power-domains

We don't support the RPM(h)PD power domains in U-Boot, and we don't need
to - the necessary resources are on, and we aren't going to enter any
low power modes.

We could try using a no-op device, but this requires adding a compatible
for every platform, and just pollutes the driver model. So instead let's
just remove every "power-domains" property that references the RPM(h)pd
power controller. This takes <1ms as we're using OF_LIVE.

Of note, this only applies to drivers which are loading post-relocation.
Drivers loaded pre-reloc that reference the rpm(h)pd still need
DM_FLAG_DEFAULT_PD_CTRL_OFF in their flags.

Acked-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agomach-snapdragon: fixup USB nodes
Caleb Connolly [Wed, 3 Apr 2024 12:07:45 +0000 (14:07 +0200)]
mach-snapdragon: fixup USB nodes

We don't support USB super-speed in U-Boot yet, we lack the SS PHY
drivers, however from my testing even with a PHY driver there seem to be
other issues when talking to super-speed peripherals.

In pursuit of maintaining upstream DT compatibility, and simplifying
porting for new devices, let's implement the DT fixups necessary to
configure USB in high-speed only mode at runtime. The pattern is
identical for all Qualcomm boards that use the Synaptics DWC3
controller:

* Add an additional property on the Qualcomm wrapper node
* Remove the super-speed phy phandle and phy-name entries.

Acked-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoserial: msm-geni: support livetree
Caleb Connolly [Wed, 3 Apr 2024 12:07:44 +0000 (14:07 +0200)]
serial: msm-geni: support livetree

When using OF_LIVE, the debug UART driver won't be probed if it's a
subnode of the geni-se-qup controller. Add a NOP driver for the
controller to correctly discover its child nodes.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agogpio: msm_gpio: add .set_flags op
Caleb Connolly [Wed, 3 Apr 2024 12:07:43 +0000 (14:07 +0200)]
gpio: msm_gpio: add .set_flags op

The .direction_input and .direction_output ops are deprecated, and don't
seem to behave properly for us. Implement our own .set_flags op to
handle this correctly.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoclk/qcom: sdm845: add USB clocks
Caleb Connolly [Wed, 3 Apr 2024 12:07:42 +0000 (14:07 +0200)]
clk/qcom: sdm845: add USB clocks

Most devices only initialise the USB clocks for us if we boot via
"fastboot boot", add the missing clock configuration to get both USB
ports working regardless of the bootloader state.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoclk/qcom: sdm845: add gdscs
Caleb Connolly [Wed, 3 Apr 2024 12:07:41 +0000 (14:07 +0200)]
clk/qcom: sdm845: add gdscs

Define the GDSC power domains for SDM845.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoclk/qcom: use offsets for RCG registers
Caleb Connolly [Wed, 3 Apr 2024 12:07:40 +0000 (14:07 +0200)]
clk/qcom: use offsets for RCG registers

The RCG registers always have the same offsets, so only store the base
CMD register address and calculate the others relative to that.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agomach-snapdragon: disable power-domains for pre-reloc drivers
Caleb Connolly [Wed, 3 Apr 2024 12:07:39 +0000 (14:07 +0200)]
mach-snapdragon: disable power-domains for pre-reloc drivers

Some devices like the UART and clock controller reference an RPM(h)
power domain. We don't support this device in U-Boot, so add
DM_FLAG_DEFAULT_PD_CTRL_OFF to tell DM core not to try and enable the
power domain.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agophy: qcom: Add SNPS femto v2 USB HS phy
Bhupesh Sharma [Wed, 3 Apr 2024 12:07:38 +0000 (14:07 +0200)]
phy: qcom: Add SNPS femto v2 USB HS phy

Some Qualcomm SoCs newer than SDM845 feature a so-called "7nm phy"
driver, notable the SM8250 SoC which will gain U-Boot support in
upcoming patches.

Introduce a driver based on the Linux driver.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
[code cleanup, align symbol names with Linux, switch to clk/reset_bulk APIs]
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agophy: qcom: add Qualcomm QUSB2 USB PHY driver
Bhupesh Sharma [Wed, 3 Apr 2024 12:07:37 +0000 (14:07 +0200)]
phy: qcom: add Qualcomm QUSB2 USB PHY driver

The Snapdragon 845 and several other Qualcomm SoCs feature this
USB high-speed phy. Add a driver for it based on the Linux driver, with
support for the SDM845, and the QCM2290 and SM6115 SoCs which will gain
support in U-Boot in future patches.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
[code cleanup, switch to clk_bulk]
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agomailmap: update Bhupesh's email address
Caleb Connolly [Wed, 3 Apr 2024 12:07:36 +0000 (14:07 +0200)]
mailmap: update Bhupesh's email address

Update Bhupesh's email to his new one.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agopinctrl: qcom: pass pin number to get_function_mux callback
Volodymyr Babchuk [Mon, 11 Mar 2024 21:33:46 +0000 (21:33 +0000)]
pinctrl: qcom: pass pin number to get_function_mux callback

This patch is the preparation for SM8150 support. This new SoC
depending on the particular pin can have different numbers for the
same function. For example "rgmii" function for GPIO4 has id=2 while
for GPIO59 it has id=1. So, to support this type of SoCs,
get_function_mux() callback needs to know for which pin the function
is requested.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoclk: qcom: add support for power domains uclass
Volodymyr Babchuk [Mon, 11 Mar 2024 21:33:45 +0000 (21:33 +0000)]
clk: qcom: add support for power domains uclass

Now sub-drivers for particular SoCs can register them as power domain
drivers. This is needed for upcoming SM8150 support, because it needs
to power up the Ethernet module.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
[caleb: make ARCH_SNAPDRAGON select POWER_DOMAIN]
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoclk: qcom: clear div mask before assigning a new divider
Volodymyr Babchuk [Mon, 11 Mar 2024 21:33:45 +0000 (21:33 +0000)]
clk: qcom: clear div mask before assigning a new divider

The current behaviour does a bitwise OR of the previous and new
divider values, this is wrong as some bits may be set already. We
need to clear all the divider bits before applying new ones.

This fixes potential issue with 1Gbit ethernet on SA8155P-ADP boards.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
[caleb: minor wording fix]
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoqcom: board: validate fdt before trying to use it
Volodymyr Babchuk [Mon, 11 Mar 2024 21:33:45 +0000 (21:33 +0000)]
qcom: board: validate fdt before trying to use it

There are cases when previous bootloader stage leaves some seemingly
valid value in r0, which in fact does not point to valid FDT
blob. This behavior was encountered when trying to boot U-Boot as
"hyp" loader on SA8155P-ADP.

To be sure that we really got the pointer to a device tree we need to
validate it with fdt_check_header() function.

Note: This approach is not 100% fool-proof, as get_prev_bl_fdt_addr()
theoretically can return a pointer to a region that is not physically
mapped and we will get data abort exception when fdt_check_header()
will try to access it. But at this early boot stage we don't know
where RAM is anyways so there is little we can do.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoqcom_defconfig: Enable ethernet and I2C support
Sumit Garg [Mon, 19 Feb 2024 08:41:44 +0000 (14:11 +0530)]
qcom_defconfig: Enable ethernet and I2C support

QCS404 supports Synopsys Designware Ethernet QOS IP and we already have
the corresponding glue layer present upstream as:
drivers/net/dwc_eth_qos_qcom.c. So enable corresponding support.

Along with that it is possible for Qualcomm platforms to retrieve MAC
address from I2C eeprom present on board. So enable corresponding
support as well.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoarm: mvebu: turris_omnia: Enable rng command in defconfig
Marek Behún [Thu, 4 Apr 2024 07:51:07 +0000 (09:51 +0200)]
arm: mvebu: turris_omnia: Enable rng command in defconfig

Now that Turris Omnia has a rng driver provided in the MCU driver,
enable the rng command in defconfig.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agomisc: turris_omnia_mcu: Add support for rng provided by MCU
Marek Behún [Thu, 4 Apr 2024 07:51:06 +0000 (09:51 +0200)]
misc: turris_omnia_mcu: Add support for rng provided by MCU

Add support for true random number generator provided by the MCU on
Turris Omnia. The MCU firmware supports TRNG if the FEAT_TRNG bit is set
in features. In that case we bind the rng driver.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agocmd: rng: Print "Abort" on -EINTR
Marek Behún [Thu, 4 Apr 2024 07:51:05 +0000 (09:51 +0200)]
cmd: rng: Print "Abort" on -EINTR

In the rng command, print
  Abort
instead of
  Reading RNG failed
if the error number is -EINTR, which can happen if the user pressed
CTRL-C.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig
Marek Behún [Thu, 4 Apr 2024 07:51:04 +0000 (09:51 +0200)]
arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig

Enable support for the poweroff command via sysreset for Turris Omnia.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agogpio: turris_omnia_mcu: Add support for system power off via sysreset
Marek Behún [Thu, 4 Apr 2024 07:51:03 +0000 (09:51 +0200)]
gpio: turris_omnia_mcu: Add support for system power off via sysreset

Add support for system power off via UCLASS_SYSRESET. Newer versions of
Turris Omnia MCU firmware can power off the board (MCU will disable
almost all voltage regulators and go into low power mode).

Move the MCU driver into drivers/misc and register it under UCLASS_MISC.
The sysreset and gpio device are bound as child devices of the MCU device.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agogpio: turris_omnia_mcu: Update firmware features reading
Marek Behún [Thu, 4 Apr 2024 07:51:02 +0000 (09:51 +0200)]
gpio: turris_omnia_mcu: Update firmware features reading

Update firmware features reading to try reading 32 bits of features and
fallback to reading 16 bits.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agogpio: turris_omnia_mcu: Use byteorder conversion functions
Marek Behún [Thu, 4 Apr 2024 07:51:01 +0000 (09:51 +0200)]
gpio: turris_omnia_mcu: Use byteorder conversion functions

Use byteorder conversion function instead of manually assembling data
from/to MCU.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: system-controller: Add support for SYSRESET
Marek Behún [Thu, 4 Apr 2024 07:51:00 +0000 (09:51 +0200)]
arm: mvebu: system-controller: Add support for SYSRESET

Add driver model support for sysreset via mvebu system controller. This is
currently only available for U-Boot proper.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU
Marek Behún [Thu, 4 Apr 2024 07:50:59 +0000 (09:50 +0200)]
arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU

The mvebu-reset driver is only needed by the mvebu PCIe driver, but
currently it is automatically selected if DM_RESET is enabled. Add the
condition of PCI_MVEBU also being enabled for mvebu-reset to be
selected.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: system-controller: Rework to use UCLASS_SYSCON
Marek Behún [Thu, 4 Apr 2024 07:50:58 +0000 (09:50 +0200)]
arm: mvebu: system-controller: Rework to use UCLASS_SYSCON

The system-controller driver for 32-bit Armada is currently registered
as UCLASS_RESET, since it only provides enabling/disabling PCIe ports.

Rework it as UCLASS_SYSCON and bind mvebu-reset as a child device.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: spl: Do not build mvebu-reset in SPL
Marek Behún [Thu, 4 Apr 2024 07:50:57 +0000 (09:50 +0200)]
arm: mvebu: spl: Do not build mvebu-reset in SPL

Commit 35e29e89a386 ("arm: mvebu: Implement simple mvebu-reset driver
for enabling/disabling PCIe ports") made it so that the mvebu reset
driver for enabling/disabling PCIe ports is build if CONFIG_DM_RESET is
enabled. This is because PCI_MVEBU depends on DM_RESET.

But the driver should not be built for SPL. Indeed the PCI_MVEBU driver
is not supported in SPL now, and so the mvebu-reset driver is not needed.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: turris_omnia: Disable Atmel SHA node if not present
Marek Behún [Thu, 4 Apr 2024 07:50:56 +0000 (09:50 +0200)]
arm: mvebu: turris_omnia: Disable Atmel SHA node if not present

If the FEAT_CRYPTO feature bit is present in MCU features, the board
crypto is implemented by MCU and the Atmel SHA chip is not present.
Disable Atmel SHA device-tree node in that case.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: turris_omnia: Print board ECDSA public key if available
Marek Behún [Thu, 4 Apr 2024 07:50:55 +0000 (09:50 +0200)]
arm: mvebu: turris_omnia: Print board ECDSA public key if available

If MCU supports the FEAT_CRYPTO feature, read board ECDSA public key
from MCU and print it.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: turris_omnia: Implement getting board information from MCU
Marek Behún [Thu, 4 Apr 2024 07:50:54 +0000 (09:50 +0200)]
arm: mvebu: turris_omnia: Implement getting board information from MCU

Implement reading board serial number, first MAC address and board
version from MCU. MCU supports board information if the FEAT_BOARD_INFO
feature bit is set in MCU features.

Prefer getting board information from MCU if supported, fallback to
Atmel SHA chip.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
8 months agoarm: mvebu: turris_omnia: Update MCU status and features reading
Marek Behún [Thu, 4 Apr 2024 07:50:53 +0000 (09:50 +0200)]
arm: mvebu: turris_omnia: Update MCU status and features reading

Refactor MCU status word and MCU firmware features reading to make it
simpler to use.

Try reading 32 bits of features, if that fails, read 16 bits. Older MCU
firmware supports only 16-bit wide features, and if more bytes are read,
either 0xff is sent or I2C transaction fails. Handle both cases.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>