]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
7 months agoboard: phytec: Add SOM detection for AM6x
Daniel Schultz [Fri, 19 Apr 2024 15:55:40 +0000 (08:55 -0700)]
board: phytec: Add SOM detection for AM6x

Add all functions to read each SOM option from the EEPROM
image and detect whether it's the correct product for this
image.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
7 months agoboard: phytec: common: Fix eepom is empty check
Daniel Schultz [Fri, 19 Apr 2024 15:55:39 +0000 (08:55 -0700)]
board: phytec: common: Fix eepom is empty check

The ptr variable is currently defined as int and sizeof
returns the size of the eeprom data struct as Byte (32 in total).

In case the eeprom is empty, the check, if the eeprom is empty,
will most likely stop after 8 iterations because it will continue
with the stack which should contain some data. Therefore, the
init function will detect an empty EEPROM as API0 and return with
the valid flag set to True.

Fixes: dc22188cdc8 ("board: phytec: Add common PHYTEC SoM detection")
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
7 months agoboard: phytec: check eeprom_data validity
Yannic Moog [Fri, 19 Apr 2024 15:55:38 +0000 (08:55 -0700)]
board: phytec: check eeprom_data validity

For all of the functions that access the eeprom_data, make sure these
data are valid. Use the valid member of the phytec_eeprom_data struct.
This fixes a bug where only the API revision check guarded against
accessing rubbish. But if API revision was e.g. 6, eeprom setup failed
before, but phytec_get_imx8m_eth would still happily access the data.

Fixes: dc22188cdc8 ("board: phytec: Add common PHYTEC SoM detection")
Signed-off-by: Yannic Moog <y.moog@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
7 months agoboard: phytec: introduce eeprom struct member 'valid'
Yannic Moog [Fri, 19 Apr 2024 15:55:37 +0000 (08:55 -0700)]
board: phytec: introduce eeprom struct member 'valid'

Add a new nember to the eeprom_data that indicates whether the
associated data is valid or not. Make use of this new member in the
phytec_eeprom_data_init function by setting the valid value
appropriately.
Move the eeprom data to a new struct payload that holds
the payload of the eeprom.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
7 months agoboard: phytec: common: Generic "add extension" function
Daniel Schultz [Fri, 19 Apr 2024 15:55:36 +0000 (08:55 -0700)]
board: phytec: common: Generic "add extension" function

Add a generic function to apply overlays in our board code to not
implement the same logic in different PHYTEC products.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Teresa Remmet <t.remmet@phytec.de>
8 months agoMerge tag 'u-boot-dfu-20240419' of https://source.denx.de/u-boot/custodians/u-boot-dfu
Tom Rini [Fri, 19 Apr 2024 13:28:24 +0000 (07:28 -0600)]
Merge tag 'u-boot-dfu-20240419' of https://source.denx.de/u-boot/custodians/u-boot-dfu

u-boot-dfu-20240419

- new "fastboot oem board" command

8 months agoenv: mmc: print MMC device being read
Quentin Schulz [Mon, 15 Apr 2024 12:43:57 +0000 (14:43 +0200)]
env: mmc: print MMC device being read

This prints the MMC device being read similar to how we print the MMC
device we write to when e.g. calling saveenv.

One of the side effects is that the boot log now shows from which MMC
device the env was loaded:

Loading Environment from MMC... Reading from MMC(1)... OK

This is useful to identify which MMC device the environment was loaded
from for boards where there are more than one (e.g. eMMC and SD card)
without adding some debug messages manually.

Sadly, there's no way to know which of the default or redundant
environment is being read from env_mmc_load before env_import_redund is
called so it is printing a bit later (and possibly after error/warning
messages).

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
8 months agoKconfig: Remove all default n options
Michal Simek [Mon, 15 Apr 2024 08:20:05 +0000 (10:20 +0200)]
Kconfig: Remove all default n options

default n doesn't need to be specified. It is default option anyway.
Similar changes have been done by commit 18370f14975c ("Kconfig: Remove all
default n/no options").

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoboot: fdt: Turn all addresses and sizes into u64
Marek Vasut [Sun, 14 Apr 2024 18:37:20 +0000 (20:37 +0200)]
boot: fdt: Turn all addresses and sizes into u64

In case of systems where DRAM bank ends at the edge of 32bit boundary,
start + size calculations would overflow. This happens on STM32MP15xx
with 1 DRAM bank starting at 0xc0000000 and 1 GiB of DRAM. This is a
usual 32bit system DRAM size overflow, fix it by doing all DRAM size
and offset calculations using u64 types. This also covers a case where
a 32bit PAE system might be able to address up to 36bits of DRAM.

Fixes: a4df06e41fa2 ("boot: fdt: Change type of env_get_bootm_low() to phys_addr_t")
Signed-off-by: Marek Vasut <marex@denx.de>
8 months agofs/erofs: add DEFLATE algorithm support
Jianan Huang [Sun, 14 Apr 2024 15:04:14 +0000 (23:04 +0800)]
fs/erofs: add DEFLATE algorithm support

This patch adds DEFLATE compression algorithm support. It's a good choice
to trade off between compression ratios and performance compared to LZ4.
Alternatively, DEFLATE could be used for some specific files since EROFS
supports multiple compression algorithms in one image.

Signed-off-by: Jianan Huang <jnhuang95@gmail.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
8 months agonet: add support to parse the NIS domain for the dhcp options
Charles Hardin [Fri, 12 Apr 2024 20:45:33 +0000 (13:45 -0700)]
net: add support to parse the NIS domain for the dhcp options

There is code in the bootp parsing for NIS domain and add the
same support for the dhcp options as well. This allows the same
usage of the data when the dhcp command is used in the boot
command.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
8 months agoinput: button_kbd: gracefully handle buttons that fail probe
Caleb Connolly [Thu, 11 Apr 2024 17:52:37 +0000 (19:52 +0200)]
input: button_kbd: gracefully handle buttons that fail probe

If a button device fails to probe, it will still be added to the uclass
device list, and therefore will still be iterated over in
button_read_keys() resulting in a UAF on the buttons private data.

Resolve this by unbinding button devices that aren't active after
probing, and print a warning so it's clear that the button is broken.

Fixes: e8779962898e ("dm: input: add button_kbd driver")
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
8 months agoreboot-mode: must depend on CONFIG_DM_RTC
Heinrich Schuchardt [Tue, 9 Apr 2024 18:44:22 +0000 (20:44 +0200)]
reboot-mode: must depend on CONFIG_DM_RTC

Reading the boot mode from RTC memory requires a real time clock.
Add the missing Kconfig dependency.

Fixes: c74675bd904b ("reboot-mode: read the boot mode from RTC memory")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoconfigs: am335x_guardian: store boot count in AM3352 RTC block
Gireesh Hiremath [Mon, 8 Apr 2024 06:01:19 +0000 (11:31 +0530)]
configs: am335x_guardian: store boot count in AM3352 RTC block

store bootcount in RTC block scratch register

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
8 months agoMerge tag 'tpm-master-18042024' of https://source.denx.de/u-boot/custodians/u-boot-tpm
Tom Rini [Thu, 18 Apr 2024 18:13:40 +0000 (12:13 -0600)]
Merge tag 'tpm-master-18042024' of https://source.denx.de/u-boot/custodians/u-boot-tpm

Igor says:
"The problem initially was in the TEE sandbox driver implementation
 (drivers/tee/sandbox.c) and it's limitations, which doesn't
 permit to have multiple simultaneous sessions with different TAs.
 This is what actually happened in this CI run [1], firstly "optee_rpmb"
 cmd was executed (and after execution we had one session open), and
 then "scp03", which also makes calls to OP-TEE, however it fails
 in sandbox_tee_open_session() because of this check:

 if (state->ta) {
     printf("A session is already open\n");
     return -EBUSY;
 }

 I had two ways in mind to address that:
 1. Close a session on each optee_rpmb cmd invocation.
 I don't see any reason to keep this session open, as obviously
 there is no other mechanism (tbh, I don't know if DM calls ".remove" for active
 devices) to close it automatically before handing over control to
 Linux kernel. As a result we might end up with some orphaned sessions
 registered in OP-TEE OS core (obvious resource leak).
 2. Extend TEE sandbox driver, add support for multiple
 simultaneous sessions just to handle the case.

 I've chosen the first approach, as IMO it was "kill two birds with one stone",
 I could address resource leak in OP-TEE and bypass limitations of
 TEE sandbox driver."

Link: https://lore.kernel.org/u-boot/CAByghJZVRbnFUwJdgU534tvGA+DX2pArf0i7ySik=BrXgADe3Q@mail.gmail.com/
The CI https://source.denx.de/u-boot/custodians/u-boot-tpm/-/pipelines/20414
showed no problems

8 months agoMerge branch 'for-2024.07' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx
Tom Rini [Thu, 18 Apr 2024 16:08:57 +0000 (10:08 -0600)]
Merge branch 'for-2024.07' of https://source.denx.de/u-boot/custodians/u-boot-mpc8xx

This pull request adds support for temperature sensors et FPGA loading
on boards from CS GROUP France.

CI: https://source.denx.de/u-boot/custodians/u-boot-mpc8xx/-/pipelines/20416

8 months agoRevert "Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled""
Tom Rini [Thu, 18 Apr 2024 14:29:35 +0000 (08:29 -0600)]
Revert "Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled""

As reported by Jonas Karlman this series breaks booting on some AArch64
platforms with common use cases. For now the best path forward is to
revert the series.

This reverts commit 777c28460947371ada40868dc994dfe8537d7115, reversing
changes made to ab3453e7b12daef47b9e91da2a2a3d48615dc6fc.

Link: https://lore.kernel.org/u-boot/50dfa3d6-a1ca-4492-a3fc-8d8c56b40b43@kwiboo.se/
Signed-off-by: Tom Rini <trini@konsulko.com>
8 months agoMerge branch 'master-fdt' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Thu, 18 Apr 2024 13:55:38 +0000 (07:55 -0600)]
Merge branch 'master-fdt' of https://source.denx.de/u-boot/custodians/u-boot-sh

8 months agoboard: cssi: Read and display MCR board address
Christophe Leroy [Sun, 14 Apr 2024 14:47:06 +0000 (16:47 +0200)]
board: cssi: Read and display MCR board address

MCR boards are plugged in racks. The position in the rack can be read
in a register.

For MCR3000, that's provided by the FPGA so check it is loaded before
reading the address.

For the other boards, the FPGA is loaded by hardware so it can be
read inconditionnaly.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Load FPGA on MCR3000 board
Christophe Leroy [Sun, 14 Apr 2024 09:17:13 +0000 (11:17 +0200)]
board: cssi: Load FPGA on MCR3000 board

Unlike CMPC885 and CMPCPRO boards, the FPGA of MCR3000 board doesn't
load code automatically but needs to be loaded by software through SPI.

Until now it was loaded later by Linux, but we'd like U-boot to have
access to some information that require the FPGA, like board address
in racks.

So, implemented the load of FPGA in U-boot.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
To avoid spamming your email boxes, the code isn't included in
the emailed patch but will be present in the PULL request

8 months agoboard: cssi: Use HAVE_VENDOR_COMMON_LIB logic
Christophe Leroy [Sat, 13 Apr 2024 06:41:14 +0000 (08:41 +0200)]
board: cssi: Use HAVE_VENDOR_COMMON_LIB logic

Instead of cross using cross-directory makefile directives,
add a Makefile in board/cssi/common/ directory in order to
benefit from HAVE_VENDOR_COMMON_LIB logic.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agospi: mpc8xx: Set up speed as requested
Christophe Leroy [Fri, 12 Apr 2024 17:36:19 +0000 (19:36 +0200)]
spi: mpc8xx: Set up speed as requested

Set the speed requested through mpc8xx_spi_set_speed() instead
of hardcoding a fixed speed.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agospi: mpc8xx: Use 16 bit mode for large transfers with even size
Christophe Leroy [Fri, 12 Apr 2024 16:16:59 +0000 (18:16 +0200)]
spi: mpc8xx: Use 16 bit mode for large transfers with even size

On CPM, the RISC core is a lot more efficiant when doing transfers
in 16-bits chunks than in 8-bits chunks, but unfortunately the
words need to be byte swapped.

So, for large tranfers with an even size, allocate a temporary
buffer and byte-swap data before and after transfer.

This change allows setting higher speed for transfer. For instance
on an MPC 8xx (CPM1 comms RISC processor), the documentation tells
that transfer in byte mode at 1 kbit/s uses 0.200% of CPM load
at 25 MHz while a word transfer at the same speed uses 0.032%
of CPM load. This means the speed can be 6 times higher in
word mode for the same CPM load.

For small transfers, the load reduction is not worth the CPU load
required to allocate the temporary buffer, so do it only when data
size is over 64 bytes.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agospi: mpc8xx: Allow transfer of more than MAX_BUFFER len
Christophe Leroy [Fri, 12 Apr 2024 11:53:57 +0000 (13:53 +0200)]
spi: mpc8xx: Allow transfer of more than MAX_BUFFER len

Perform multiple transfer of size MAX_BUFFER when the data to be
transferred is longer than MAX_BUFFER.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agopowerpc: 8xx: Set SDMA configuration register correcly
Christophe Leroy [Fri, 12 Apr 2024 11:19:47 +0000 (13:19 +0200)]
powerpc: 8xx: Set SDMA configuration register correcly

SDMA configuration register needs to be set up only once and doesn't
belong to drivers. Also, the value to be used is different on mpc885.

So do the init in cpu_init_f() with 0x40 for mpc885 and 0x1 for others.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: add support for reading temperature
Christophe Leroy [Tue, 2 Apr 2024 17:22:24 +0000 (19:22 +0200)]
board: cssi: add support for reading temperature

All CSSI boards have an LM74 chip as temperature sensor.

Enable it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Add support for SPI bus on MCR3000 board
Christophe Leroy [Fri, 12 Apr 2024 10:01:25 +0000 (12:01 +0200)]
board: cssi: Add support for SPI bus on MCR3000 board

MCR3000 board has some components tied to the SPI bus, like the Texas
Instruments LM74 temperature sensor.

Add support for SPI bus. The SPI chipselects are a bit special in the
way that they are driven by 3 bits in a register of the board's CPLD
where the value writen in those bits exclusively activates one of the
7 possible chipselects and value 0 sets all chipselets to inactive.

So add a special GPIO driver that simulates GPIOs for those chipselect.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agothermal: Add support for TI LM74
Christophe Leroy [Tue, 2 Apr 2024 16:55:31 +0000 (18:55 +0200)]
thermal: Add support for TI LM74

LM74 is a SPI temperature sensor.

Implement a driver to read temperature from it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agospi: mpc8xx: Fix transfert when input or output buffer is NULL
Christophe Leroy [Tue, 9 Apr 2024 06:38:08 +0000 (08:38 +0200)]
spi: mpc8xx: Fix transfert when input or output buffer is NULL

xfer ops can be passed a NULL input or output buffer. At the
time being the driver ignores it and overwrites memory at 0.

Define a dummy buffer and use it when either input or output
buffer is NULL. Bail out when both are NULL as it shouldn't.

Also increase MAX_BUFFER len to 32k as the current is pretty
low.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agospi: mpc8xx: Add GPIO dependency
Christophe Leroy [Tue, 2 Apr 2024 17:20:07 +0000 (19:20 +0200)]
spi: mpc8xx: Add GPIO dependency

Since commit 773ad4ebb1d6 ("spi, mpc8xx: Add support for chipselect via
GPIO and fixups"), DM_GPIO is required for 8xx SPI.

Add the missing dependency to avoid build failures.

Fixes: 773ad4ebb1d6 ("spi, mpc8xx: Add support for chipselect via GPIO and fixups")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Properly initialise MAC address for fibre on CMPC885 board
Hugo Dubois [Tue, 5 Dec 2023 16:10:44 +0000 (17:10 +0100)]
board: cssi: Properly initialise MAC address for fibre on CMPC885 board

CMPC885 board can be pluged on a mother board with fibre interface, so
fibre interface MAC address must be initialised for that case.

Signed-off-by: Hugo Dubois <hugo.dubois.ext@csgroup.eu>
Reviewed-by: CASAUBON Jean Michel <jean-michel.casaubon@csgroup.eu>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Initialise port F on MIAE
Hugo Dubois [Fri, 1 Dec 2023 14:56:12 +0000 (15:56 +0100)]
board: cssi: Initialise port F on MIAE

When equipped with the SRSA audio board, MIAE equipment
has an additional port called port F.

Initialise that port just like other ports of the board, so
that it is already configured when starting Linux kernel.

Signed-off-by: Hugo Dubois <hugo.dubois.ext@csgroup.eu>
Reviewed-by: CASAUBON Jean Michel <jean-michel.casaubon@csgroup.eu>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Allow use without HUSH shell
Jean-Michel CASAUBON [Tue, 31 Oct 2023 11:27:22 +0000 (11:27 +0000)]
board: cssi: Allow use without HUSH shell

HUSH shell is not always wanted/desirable.

Add missing braces in environment in order to allow use without
HUSH shell.

Signed-off-by: Jean-Michel CASAUBON <jean-michel.casaubon@csgroup.eu>
Cc: DUBOIS Hugo <hugo.dubois.ext@csgroup.eu>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Fix SPI nodes in DTS
Christophe Leroy [Fri, 12 Apr 2024 10:10:14 +0000 (12:10 +0200)]
board: cssi: Fix SPI nodes in DTS

When adding additional SPI peripherals, the reg property needs to
be added, and this leads to the following error:

  arch/powerpc/dts/cmpc885.dtb: Warning (reg_format): /immr@ff000000/spi@aa0/temp@1:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
  arch/powerpc/dts/cmpc885.dtb: Warning (reg_format): /immr@ff000000/spi@aa0/temp@2:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)

Fix it by removing cell-index and cell-size which is unused and add
reg property. Also fix node name to be in line with reg value.
Also add missing compatible for eeprom node.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agoboard: cssi: Fix MCR3000 board environment
Jean-Michel CASAUBON [Thu, 9 Nov 2023 11:58:33 +0000 (11:58 +0000)]
board: cssi: Fix MCR3000 board environment

Remove a stray semicolon in MCR3000 board environment.

Signed-off-by: Jean-Michel CASAUBON <jean-michel.casaubon@csgroup.eu>
Reviewed-by: DUBOIS Hugo <hugo.dubois.ext@csgroup.eu>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
8 months agotee: remove common.h inclusion
Igor Opaniuk [Thu, 4 Apr 2024 13:19:51 +0000 (15:19 +0200)]
tee: remove common.h inclusion

The usage of the common.h include file is deprecated [1], and has already
been removed from several files.
Get rid of all inclusions in the "drivers/tee" directory, and replace it
with required include files directly where needed.

[1] doc/develop/codingstyle.rst

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agotest: py: add optee_rpmb tests
Igor Opaniuk [Thu, 4 Apr 2024 13:19:50 +0000 (15:19 +0200)]
test: py: add optee_rpmb tests

Add read/write tests for optee_rpmb cmd.

Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agocmd: optee_rpmb: build cmd for sandbox
Igor Opaniuk [Thu, 4 Apr 2024 13:19:49 +0000 (15:19 +0200)]
cmd: optee_rpmb: build cmd for sandbox

Support CMD_OPTEE_RPMB for SANDBOX configurations.
Test:

$ ./u-boot -d arch/sandbox/dts/test.dtb
...
=> optee_rpmb write_pvalue test_variable test_value
Wrote 11 bytes
=> optee_rpmb read_pvalue test_variable 11
Read 11 bytes, value = test_value

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agocmd: optee_rpmb: close tee session
Igor Opaniuk [Thu, 4 Apr 2024 13:19:48 +0000 (15:19 +0200)]
cmd: optee_rpmb: close tee session

Close tee session after each optee_rpmb invocation, as there is no
reason to keep it open, considering the absence of any available mechanism
to clean up all open sessions automatically before handing over control
to the Linux kernel. Without proper clean-up we might end up with orphaned
sessions registered in OP-TEE OS core (obvious resource leak).

Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agotee: optee: fix description in Kconfig
Igor Opaniuk [Thu, 4 Apr 2024 13:19:47 +0000 (15:19 +0200)]
tee: optee: fix description in Kconfig

Fix OPTEE_TA_AVB symbol description in Kconfig:
s/"write"rb"/"write_rb"/g

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agofastboot: introduce 'oem board' subcommand
Alexey Romanov [Thu, 18 Apr 2024 10:01:29 +0000 (13:01 +0300)]
fastboot: introduce 'oem board' subcommand

Currently, fastboot protocol in U-Boot has no opportunity
to execute vendor custom code with verifed boot. This patch
introduce new fastboot subcommand fastboot oem board:<cmd>,
which allow to run custom oem_board function.

Default implementation is __weak. Vendor must redefine it in
board/ folder with his own logic.

For example, some vendors have their custom nand/emmc partition
flashing or erasing. Here some typical command for such use cases:

- flashing:

  $ fastboot stage bootloader.img
  $ fastboot oem board:write_bootloader

- erasing:

  $ fastboot oem board:erase_env

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Link: https://lore.kernel.org/r/20240418100129.1691822-2-avromanov@salutedevices.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
8 months agoARM: dts: renesas: Switch to using upstream DT
Marek Vasut [Mon, 25 Mar 2024 08:17:54 +0000 (09:17 +0100)]
ARM: dts: renesas: Switch to using upstream DT

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

The configuration update has been done using the following script:
```
sed -i '/^CONFIG_DEFAULT_DEVICE_TREE/ s@="@&renesas/@' `git grep -li renesas configs`
sed -i '/^CONFIG_OF_LIST/ s@r8a@renesas/&@g' `git grep -li renesas configs`
```

The RZN1 Snarc board does not seem to have a matching Linux kernel
DT counterpart, this is currently not switched to OF upstream.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
8 months agoARM: dts: renesas: Switch to using upstream DT on 64bit Renesas SoCs
Marek Vasut [Mon, 18 Mar 2024 14:59:38 +0000 (15:59 +0100)]
ARM: dts: renesas: Switch to using upstream DT on 64bit Renesas SoCs

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

The configuration update has been done using the following script:
```
sed -i '/^CONFIG_DEFAULT_DEVICE_TREE/ s@="@&renesas/@' `git grep -li renesas configs`
sed -i '/^CONFIG_OF_LIST/ s@r8a@renesas/&@g' `git grep -li renesas configs`
```

There are SoCs which are not included in this patch. The 32bit SoCs
require further infrastructure work. R8A779H0 is coming during the
next upstream DT synchronization cycle as it is not included in
current upstream DTs yet.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Adam Ford <aford173@gmail.com> # Beacon boards
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
8 months agoARM: dts: renesas: Replace R8A77950 with R8A77951
Marek Vasut [Mon, 18 Mar 2024 14:59:37 +0000 (15:59 +0100)]
ARM: dts: renesas: Replace R8A77950 with R8A77951

R-Car R8A77950 H3 ES1.* was only available to an internal development
group and needed a lot of quirks and workarounds. Public users only
have R-Car R8A77950 H3 ES2 and newer. Switch existing systems to use
R8A77951 device trees.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 months agoARM: dts: renesas: Stop using the -u-boot DTs for build
Marek Vasut [Sun, 17 Mar 2024 06:23:38 +0000 (07:23 +0100)]
ARM: dts: renesas: Stop using the -u-boot DTs for build

The U-Boot build system can automatically paste -u-boot.dtsi at the
end of matching .dts during build. Stop emulating this behavior and
rename the -u-boot.dts files to -u-boot.dtsi, drop "#include...dts"
from those new u-boot.dtsi files, and update board configuration
accordingly.

The rename, '#include...dts` scrubbing and configuration update has
been done using the following script:
```
$ find . -name r[78]\*-u-boot.dts | sort -u | while read line ; do \
  git mv ${line%-u-boot.dts}-u-boot.dts ${line%-u-boot.dts}-u-boot.dtsi ; \
  done
$ sed -i '/^#include.*dts"/ d' `find . -name r[78]\*-u-boot.dtsi`
$ sed -i 's@-u-boot@@g' `git grep -li renesas configs`
```
The Salvator-X and ULCB board files have been updated manually.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Acked-by: Adam Ford <aford173@gmail.com>
8 months agosandbox: don't call os_close with invalid file descriptor
Heinrich Schuchardt [Wed, 10 Apr 2024 21:50:34 +0000 (23:50 +0200)]
sandbox: don't call os_close with invalid file descriptor

If open() fails it returns -1. Calling close() with this value
makes no sense. Return -EIO instead.

Addresses-Coverity-ID: 185828 Improper use of negative value
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fixes: 566bf3a8698 ("sandbox: Add a function to read a host file")
Reviewed-by: Sean Anderson <seanga2@gmail.com>
8 months agoarm: mach-k3: security: Lower verbosity of cert message for GP
Andrew Davis [Wed, 10 Apr 2024 18:38:34 +0000 (13:38 -0500)]
arm: mach-k3: security: Lower verbosity of cert message for GP

When we find a certificate on an image to be booted on a GP device we
print out a message explaining that the certificate is being skipped.
This message is rather long and is printed for every image. Shorten
the message and make the long version into a debug message.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am64x_evm_*_defconfig: Increase offsets for eMMC raw boot
Judith Mendez [Wed, 10 Apr 2024 18:20:16 +0000 (13:20 -0500)]
configs: am64x_evm_*_defconfig: Increase offsets for eMMC raw boot

EMMC boot can fail due to the size of R5 SPL image growing beyond the
500KB of memory allocated in eMMC. Update offsets for eMMMC raw boot
to load each binary from the correct address in eMMC according to the
following eMMC layout:

            boot0/1 partition
    0x0+----------------------------------+
       |     tiboot3.bin (1 MB)           |
  0x800+----------------------------------+
       |       tispl.bin (2 MB)           |
0x1800+-----------------------------------+
       |       u-boot.img (4 MB)          |
0x3800+-----------------------------------+
       |      environment (128 KB)        |
0x3900+-----------------------------------+

Signed-off-by: Judith Mendez <jm@ti.com>
8 months agoconfigs: arbel: Use generic timer and npcm reset driver
Jim Liu [Wed, 10 Apr 2024 05:54:37 +0000 (13:54 +0800)]
configs: arbel: Use generic timer and npcm reset driver

Modify defconfig to use generic timer and npcm reset driver

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
8 months agofs: fat: fill creation and change date
Heinrich Schuchardt [Tue, 9 Apr 2024 20:06:07 +0000 (22:06 +0200)]
fs: fat: fill creation and change date

The FAT specification requires that the change date is set.

If a DM RTC device exists, set the creation and change date to the current
date when updating the directory entry. Otherwise use the date 2020-01-01.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agofs: fat: convert change month correctly
Heinrich Schuchardt [Tue, 9 Apr 2024 18:04:56 +0000 (20:04 +0200)]
fs: fat: convert change month correctly

The month is stored in 5 - 8. We need to shift it by 5 bits.

Cf. Microsoft FAT Specification, 2005-08-30

Fixes: 13c11c665320 ("fs: fat: add file attributes to struct fs_dirent")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agotools: copyfile: use 64k instead of 512 buffer
Ahelenia Ziemiańska [Tue, 9 Apr 2024 12:14:34 +0000 (14:14 +0200)]
tools: copyfile: use 64k instead of 512 buffer

This is a trivial but significant optimization:
mkimage took >200ms (and 49489 writes (of which 49456 512)),
now it takes  110ms (and   419 writes (of which   386 64k)).

sendfile is much more appropriate for this and is done in one syscall,
but doesn't bring any significant speedups over 64k r/w
at the 13M size ranges, so there's no need to introduce
#if __linux__
while((size = sendfile(fd_dst, fd_src, NULL, 128 * 1024 * 1024)) > 0)
;
if(size != -1) {
ret = 0;
goto out;
}
#endif

Also extract the buffer size to a macro.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
8 months agotest: typo curren
Heinrich Schuchardt [Tue, 9 Apr 2024 07:55:49 +0000 (09:55 +0200)]
test: typo curren

Fix typos in test_eficonfig.py: %s/curren/current/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
8 months agoMakefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM
Jonathan Humphreys [Mon, 8 Apr 2024 21:28:43 +0000 (16:28 -0500)]
Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM

When CONFIG_OF_UPSTREAM is enabled, DTS files are in SOC subdirectories (vs the
top level dts directory), but when CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
the dynamically created dtsi file containing the capsule ESL DT node is in the
parent directory. This results in a build failure because the #include inserted
in the DTS file is local to the current directory.  Update Makefile to have the
DT preprocessing of #includes search in the parent (dts top level) directory
too.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoMerge patch series "configs: ti: Enable basic settings for SystemReady ACS"
Tom Rini [Wed, 17 Apr 2024 19:16:12 +0000 (13:16 -0600)]
Merge patch series "configs: ti: Enable basic settings for SystemReady ACS"

Jonathan Humphreys <j-humphreys@ti.com> says:

Set basic settings needed for System Ready IR ACS testing, for several TI SoC
based platforms: AM64, AM62, AM62p, BeaglePlay, J7, and BeagleboneAI.

For AM64, AM62, and AM62p, also includes some config cleanup.  Should be no
functional change.

8 months agoconfigs: beagleboneai64: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:11:00 +0000 (16:11 -0500)]
configs: beagleboneai64: Enable RTC emulation

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: beagleboneai64: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:59 +0000 (16:10 -0500)]
configs: beagleboneai64: Enable basic EFI CMD support

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62x: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:58 +0000 (16:10 -0500)]
configs: am62x: Enable RTC emulation

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62x: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:57 +0000 (16:10 -0500)]
configs: am62x: Enable basic EFI CMD support

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62x: cosmetic config cleanup
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:56 +0000 (16:10 -0500)]
configs: am62x: cosmetic config cleanup

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62px: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:55 +0000 (16:10 -0500)]
configs: am62px: Enable RTC emulation

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62px: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:54 +0000 (16:10 -0500)]
configs: am62px: Enable basic EFI CMD support

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am62px: cosmetic config cleanup
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:53 +0000 (16:10 -0500)]
configs: am62px: cosmetic config cleanup

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: beagleplay: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:52 +0000 (16:10 -0500)]
configs: beagleplay: Enable RTC emulation

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: beagleplay: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:51 +0000 (16:10 -0500)]
configs: beagleplay: Enable basic EFI CMD support

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: j721e: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:50 +0000 (16:10 -0500)]
configs: j721e: Enable RTC emulation

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: j721e: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:49 +0000 (16:10 -0500)]
configs: j721e: Enable basic EFI CMD support

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am64x: Enable RTC emulation
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:48 +0000 (16:10 -0500)]
configs: am64x: Enable RTC emulation

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am64x: Enable basic EFI CMD support
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:47 +0000 (16:10 -0500)]
configs: am64x: Enable basic EFI CMD support

This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoconfigs: am64x: cosmetic config cleanup
Jonathan Humphreys [Mon, 8 Apr 2024 21:10:46 +0000 (16:10 -0500)]
configs: am64x: cosmetic config cleanup

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
8 months agoMerge patch series "zfs: Fix zfs support on aarch64"
Tom Rini [Wed, 17 Apr 2024 16:08:03 +0000 (10:08 -0600)]
Merge patch series "zfs: Fix zfs support on aarch64"

mwleeds@mailtundra.com <mwleeds@mailtundra.com> says:

This patch series is needed to get U-Boot to boot from a ZFS filesystem
on an aarch64 computer. Some of the patches are not architecture specific
and would be needed to boot ZFS on other platforms as well. The ZFS
support in U-Boot hasn't been substantively touched in several years and
to me it seems like it must have been broken for a long time on all
platforms, but I have only tested on aarch64.

Since there doesn't seem to be a mantainer for this area who I can cc,
I'm hoping these patches get seen and pulled in by a general U-Boot
maintainer.

[trini: Per Igor's comment and Phaedrus agreement, dropped his Tested-by
 on the patches themselves]

8 months agozfs: Fix zfs_read() to actually work
mwleeds@mailtundra.com [Sun, 7 Apr 2024 01:47:29 +0000 (18:47 -0700)]
zfs: Fix zfs_read() to actually work

Without this patch, the while loop being modified goes on infinitely,
but with the patch I am able to boot linux on zfs on a jetson tx2 nx.

It seems like this code was never tested because the logic is clearly
wrong. The function do_div(a,b) does a division that modifies the first
parameter to have a = a / b, and returns the remainder of the division.
So clearly in the usual case when file->offset = 0, the line
"blkid = do_div(blkid, blksz);" just results in blkid being set to zero
on every iteration of the loop, rather than being incremented as blocks
are read. Hence the zeroth block is read over and over and this becomes
an infinite loop.

So instead capture the remainder of the division in a "blkoff" variable,
and use that to properly calculate the memory address to move from in
memmove() below.

For example, if file->offset were 1337, on the first iteration of the
loop blkid would be 0 and blkoff would be 1337. If the blksz is 131072
(as it was for me), that amount of data would be copied into
data->file_buf. movesize would be 131072 - 1337 = 129735 so 129735 bytes
would be moved into buf. On the second iteration of the loop (assuming
there is one), red would be 129735, blkid would be 1, blkoff would be 0,
and 131072 bytes would be copied into buf. And so on...

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
8 months agozfs: Fix return value of fs_devread()
mwleeds@mailtundra.com [Sun, 7 Apr 2024 01:47:28 +0000 (18:47 -0700)]
zfs: Fix return value of fs_devread()

As evidenced by how other filesystems handle it, a return value of 0
from fs_devread() means failure; nonzero means success. The opposite
assumption was being made in zfs.c for the use of zfs_devread() so fix
the confusion by making zfs_devread() return 0 on success.

It probably doesn't make sense to change the handling of zfs_devread()
in zfs.c instead, because as it is it matches the semantics of the other
functions there.

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
8 months agozfs: Fix unaligned read of uint64
mwleeds@mailtundra.com [Sun, 7 Apr 2024 01:47:27 +0000 (18:47 -0700)]
zfs: Fix unaligned read of uint64

Without this patch, when trying to boot zfs using U-Boot on a Jetson TX2
NX (which is aarch64), I get a CPU reset error like so:

"Synchronous Abort" handler, esr 0x96000021
elr: 00000000800c9000 lr : 00000000800c8ffc (reloc)
elr: 00000000fff77000 lr : 00000000fff76ffc
x0 : 00000000ffb40f04 x1 : 0000000000000000
x2 : 000000000000000a x3 : 0000000003100000
x4 : 0000000003100000 x5 : 0000000000000034
x6 : 00000000fff9cc6e x7 : 000000000000000f
x8 : 00000000ff7f84a0 x9 : 0000000000000008
x10: 00000000ffb40f04 x11: 0000000000000006
x12: 000000000001869f x13: 0000000000000001
x14: 00000000ff7f84bc x15: 0000000000000010
x16: 0000000000002080 x17: 00000000001fffff
x18: 00000000ff7fbdd8 x19: 00000000ffb405f8
x20: 00000000ffb40dd0 x21: 00000000fffabe5e
x22: 000000ea77940000 x23: 00000000ffb42090
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000bab10c x29: 00000000ff7f85f0

Code: d00001a0 9103a000 94006ac6 f9401ba0 (f9400000)
Resetting CPU ...

This happens when be64_to_cpu() is called on a value that exists at a
memory address that's 4 byte aligned but not 8 byte aligned (e.g. an
address ending in 04). The call stack where that happens is:
check_pool_label() ->
zfs_nvlist_lookup_uint64(vdevnvlist, ZPOOL_CONFIG_ASHIFT,...) ->
be64_to_cpu()

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
Fixes: 4d3c95f5ea7c ("zfs: Add ZFS filesystem support")
8 months agozfs: Add a comment to clarify nvlist memory layout
mwleeds@mailtundra.com [Sun, 7 Apr 2024 01:47:26 +0000 (18:47 -0700)]
zfs: Add a comment to clarify nvlist memory layout

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
8 months agozfs: Fix malloc() success check
mwleeds@mailtundra.com [Sun, 7 Apr 2024 01:47:25 +0000 (18:47 -0700)]
zfs: Fix malloc() success check

This code was hitting the error code path whenever malloc() succeeded
rather than when it failed, so presumably this part of the code hasn't
been tested. I had to apply this fix (and others) to get U-Boot to boot
from ZFS on an Nvidia Jetson TX2 NX SoM (an aarch64 computer).

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
8 months agonet: wget: fix TCP sequence number wrap around issue
Yasuharu Shibata [Tue, 16 Apr 2024 00:26:24 +0000 (09:26 +0900)]
net: wget: fix TCP sequence number wrap around issue

If tcp_seq_num is wrap around, tcp_seq_num >= initial_data_seq_num
isn't satisfied and store_block() isn't called.
The condition has a wrap around issue, so it is fixed in this patch.

Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Reported-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Fabio Estevam <festevam@denx.de>
8 months agonet: wget: Support retransmission a dropped packet
Yasuharu Shibata [Sun, 14 Apr 2024 10:46:07 +0000 (19:46 +0900)]
net: wget: Support retransmission a dropped packet

The server sends multiple packets without waiting for an ACK
by window control and if some packets are dropped,
wget will return an ACK including the dropped packets.

Following log indicates this issue.

  wget_handler() wget: Transferring, seq=97bbdd4a, ack=30,len=580
  wget_handler() wget: Transferring, seq=97bbedca, ack=30,len=580

First packet of TCP sequence number is 0x97bbdd4a.
Second packet of TCP sequence number should be 0x97bbe2ca,
however it is 0x97bbedca and returns its ACK, so the server
suppose that 0x97bbe2ca and 0x97bbedca are received appropriately.
In this case, 0x97bbe2ca was lost and the data of wget was broken.

In this patch, next_data_seq_num holds the next expected
TCP sequence number.
If the TCP sequence number different from next_data_seq_num,
trying to retransmit the packet.

Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
8 months agoMerge tag 'u-boot-imx-master-20240415' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Mon, 15 Apr 2024 13:39:14 +0000 (07:39 -0600)]
Merge tag 'u-boot-imx-master-20240415' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

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

- Update the imx_rgpio2p to only access one address as per the
  dt-schema.
- Remove unused imx9_cpu.c file.
- Only use the LPUART ipg clk for i.MX7ULP.
- Use the correct anatop base for accessing the PLL clocks on i.MX93.

8 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Mon, 15 Apr 2024 13:38:51 +0000 (07:38 -0600)]
Merge https://source.denx.de/u-boot/custodians/u-boot-mmc

8 months agoMerge tag 'u-boot-socfpga-next-20240415' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 15 Apr 2024 13:38:18 +0000 (07:38 -0600)]
Merge tag 'u-boot-socfpga-next-20240415' of https://source.denx.de/u-boot/custodians/u-boot-socfpga

- Add option to reprogram FPGA every reboot, enable this as default in
  chameleonv3 defconfig.
- Fixes: Rename CONFIG_SPL_SOCFPGA_SEC_REG to CONFIG_SPL_SOCFPGA_DT_REG,
  so the driver can be built when CONFIG_SPL_SOCFPGA_DT_REG is set in
  defconfig.

8 months agoclk: imx93: fix anatop base
Peng Fan [Fri, 12 Apr 2024 14:24:54 +0000 (22:24 +0800)]
clk: imx93: fix anatop base

The PLL clk needs use anatop base, otherwise wrong PLL address will
be used.

Fixes: 9c153e46661b ("clk: imx: add i.MX93 CCF driver")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
8 months agocpu: drop imx9_cpu
Peng Fan [Fri, 12 Apr 2024 14:24:53 +0000 (22:24 +0800)]
cpu: drop imx9_cpu

This was wrongly committed, no user, remove it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
8 months agoserial: lpuart: use ipg clk for i.MX7ULP
Peng Fan [Fri, 12 Apr 2024 14:24:52 +0000 (22:24 +0800)]
serial: lpuart: use ipg clk for i.MX7ULP

To i.MX7ULP compatible lpuart, there is only ipg clk, no per clk.
So add a devtype check for i.MX7ULP.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
8 months agogpio: imx_rgpio2p: support one address
Peng Fan [Fri, 12 Apr 2024 14:24:51 +0000 (22:24 +0800)]
gpio: imx_rgpio2p: support one address

The i.MX8ULP/93 gpio dt-schema have been updated to only have one
address entry, update the driver to support it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
8 months agommc: cv1800b_sdhci: Remove the unused argument
Jaehoon Chung [Mon, 15 Apr 2024 07:56:50 +0000 (16:56 +0900)]
mmc: cv1800b_sdhci: Remove the unused argument

Remove the unused argument about cmd_error.

Fixes: a3b2786651c7 ("mmc: Drop unused mmc_send_tuning() cmd_error parameter")
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: hi6220_dw_mmc: add fifoth_val to private data and set it in .probe
Yang Xiwen [Thu, 1 Feb 2024 14:05:44 +0000 (22:05 +0800)]
mmc: hi6220_dw_mmc: add fifoth_val to private data and set it in .probe

The value defaults to 0 and is ignored by dw_mmc code, so the other
users are not affected.

Setting this explicitly fixes some weird reading error found on Hi3798MV200.

Fixes: 8a5dc8140e62 ("mmc: hi6220_dw_mmc: add compatible for HC2910 support")
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: dw_mmc: Don't return error if data busy timeout
Yang Xiwen [Thu, 1 Feb 2024 14:05:43 +0000 (22:05 +0800)]
mmc: dw_mmc: Don't return error if data busy timeout

As described in [1], some poor hardware or cards would fail to release
the bus and keep driving data lines low. Ignore it and send the next cmd
directly seems okay for most cases.

[1]: https://patchwork.kernel.org/project/linux-mmc/patch/1424458179-5456-1-git-send-email-dianders@chromium.org/

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: hi6220-dwmmc: handle clocks and resets if CONFIG_CLK and CONFIG_DM_RESET enabled
Yang Xiwen [Thu, 1 Feb 2024 14:05:42 +0000 (22:05 +0800)]
mmc: hi6220-dwmmc: handle clocks and resets if CONFIG_CLK and CONFIG_DM_RESET enabled

This can avoid hardcoding a clock rate in driver. Also can enable the
clocks and deassert the resets if the pre-bootloader does not do this
for us.

Currently only enabled for Hi3798MV200.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: Unconditionally call mmc_deinit()
Marek Vasut [Sun, 17 Mar 2024 03:01:22 +0000 (04:01 +0100)]
mmc: Unconditionally call mmc_deinit()

Place the SDR104/HS200/HS400 checks into the mmc_deinit() and always
call it. This simplifies the code and removes ifdeffery. No functional
change is expected.

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
8 months agommc: renesas-sdhi: Do not access SCC during tuning in send_cmd callback
Marek Vasut [Sat, 24 Feb 2024 22:32:11 +0000 (23:32 +0100)]
mmc: renesas-sdhi: Do not access SCC during tuning in send_cmd callback

Do not access SCC when sending commands during tuning operation as that
will disrupt the tuning operation. The tuning operation is adjusting the
SCC settings itself in execute_tuning callback.

When renesas_sdhi_execute_tuning() is called by the MMC core code, a loop
which consists of renesas_sdhi_prepare_tuning(), mmc_send_tuning() and
renesas_sdhi_compare_scc_data() iterates over each SCC tuning tap.

The renesas_sdhi_prepare_tuning() configures the SCC tuning tap number into
hardware, mmc_send_tuning() triggers transfer of tuning block which depends
on the bus mode for which the bus is currently being tuned, this information
is supplied by the MMC core code, and finally renesas_sdhi_compare_scc_data()
tests the received tuning block for validity.

Because renesas_sdhi_prepare_tuning() configures the SCC tuning tap into
the hardware to fit the tuning operation, mmc_send_tuning() which triggers
command transfer using renesas_sdhi_send_cmd() must not manipulate with
the SCC in any way. Currently renesas_sdhi_send_cmd() does unconditionally
call renesas_sdhi_check_scc_error(), which may adjust the SCC tuning tap
position by writing RENESAS_SDHI_SCC_TAPSET, which would overwrite the
required tuning configuration set by renesas_sdhi_prepare_tuning() and
disrupt the tuning operation.

Fix this by skipping the renesas_sdhi_check_scc_error() call in case the
MMC subsystem is in tuning state. This way, the SCC settings are left
unmodified by command transfer during tuning operation.

Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Tested-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: Add generic tuning flag
Marek Vasut [Sat, 24 Feb 2024 22:32:10 +0000 (23:32 +0100)]
mmc: Add generic tuning flag

Set generic mmc->tuning flag when performing tuning to indicate
this condition to drivers. Drivers may use this to bypass various
checks during tuning.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: Convert hs400_tuning flag from u8 to bool
Marek Vasut [Sat, 24 Feb 2024 22:32:09 +0000 (23:32 +0100)]
mmc: Convert hs400_tuning flag from u8 to bool

This hs400_tuning is a flag, make it bool. No functional change.
This will be useful in the following patch, which adds another
more generic flag, where the compiler can better use the space
now reserved for the u8 to store more flags in it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: renesas-sdhi: Stop transmission in case tuning block transfer fails
Marek Vasut [Tue, 20 Feb 2024 08:38:45 +0000 (09:38 +0100)]
mmc: renesas-sdhi: Stop transmission in case tuning block transfer fails

The current code uses the state of tuning block received by SCC to
determine whether or not to send transmission stop command. This is
not correct. Use the state of tuning block transfer to determine
whether or not to send transmission stop command instead, because
the transmission stop command has to be sent in case the tuning
block transfer failed.

This requires two changes, separate variable to store and check the
state of tuning block received by SCC, and another separate variable
to store and check return value from transmission stop command.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Tested-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: tmio: Check INFO1 for completion during DMA transfer
Marek Vasut [Tue, 20 Feb 2024 08:38:14 +0000 (09:38 +0100)]
mmc: tmio: Check INFO1 for completion during DMA transfer

In case a CRC error occurs during DMA transfer, the transfer completion
flag is not set in TMIO_SD_DMA_INFO1 and the transfer would eventually
time out. The timeout could be very long in case the transfer consists
of a large amount of blocks, the base timeout is 10 seconds and every
block adds 100 us more.

In case a CRC error does occur, a completion flag is set in a different
register, TMIO_SD_INFO1. Use this other completion flag to detect DMA
transfer ended and stop waiting for TMIO_SD_DMA_INFO1 completion flag.
This reduces the lengthy timeout in case of an error. The unconditional
check of TMIO_SD_DMA_INFO2 register for DMA related errors must not be
skipped in any case to actually recognize the DMA error and report it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Tested-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agommc: Drop unused mmc_send_tuning() cmd_error parameter
Marek Vasut [Tue, 20 Feb 2024 08:36:23 +0000 (09:36 +0100)]
mmc: Drop unused mmc_send_tuning() cmd_error parameter

The cmd_error parameter is not used, remove it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 months agommc: arm_pl180_mmci: Rely on DM
Linus Walleij [Thu, 8 Feb 2024 09:33:43 +0000 (10:33 +0100)]
mmc: arm_pl180_mmci: Rely on DM

The PL180/MMCI driver is implied to use CONFIG_DM and the ARM
defconfigs such as configs/vexpress_ca9x4_defconfig will get it
as well.

With a simple oneline to default to not being the v2 variant,
the original ARM MMCI variant works fine with the driver as well.
The IP version actually needs to be read out from a register on
the ARM versions, but we will simply assume we are running on the
original hardware if arm,primecell-periphid is not explicitly
specified in the device tree.

Drop the !CONFIG_DM code and depend on DM_MMC.

Tested on the Versatile Express CA9x4 board.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 months agommc: Add SPL_MMC_PWRSEQ to fix link issue when building SPL
Jonas Karlman [Sat, 27 Jan 2024 17:12:35 +0000 (17:12 +0000)]
mmc: Add SPL_MMC_PWRSEQ to fix link issue when building SPL

With MMC_PWRSEQ enabled the following link issue may happen when
building SPL and SPL_PWRSEQ is not enabled.

  aarch64-linux-gnu-ld.bfd: drivers/mmc/meson_gx_mmc.o: in function `meson_mmc_probe':
  drivers/mmc/meson_gx_mmc.c:295: undefined reference to `pwrseq_set_power'

Fix this by adding a SPL_MMC_PWRSEQ Kconfig option used to enable mmc
pwrseq support in SPL.

Also add depends on DM_GPIO to fix following link issue:

  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.o: in function `mmc_pwrseq_set_power':
  drivers/mmc/mmc-pwrseq.c:26: undefined reference to `gpio_request_by_name'
  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.c:29: undefined reference to `dm_gpio_set_value'
  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.c:31: undefined reference to `dm_gpio_set_value'

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
8 months agommc: Don't suggest to build modules in Kconfig.
Heinrich Schuchardt [Tue, 23 Jan 2024 16:18:16 +0000 (17:18 +0100)]
mmc: Don't suggest to build modules in Kconfig.

U-Boot does not support building kernel modules.

Fixes: 3c0dbed232bd ("mmc: arm_pl180_mmci: adapt driver to DM usage")
Fixes: 36645f45a048 ("drivers: mmc: Add sdhci driver for Broadcom iProc platform")
Fixes: dadd43c14368 ("mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver")
Fixes: b312c590bcd8 ("mmc: Add MMC support for stm32h7 Socs")
Fixes: d24b69395949 ("mmc: mtk-sd: add SD/MMC host controller driver for MT7623 SoC")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
8 months agommc: Avoid buffer overrun in mmc_startup()
Heinrich Schuchardt [Thu, 4 Jan 2024 03:49:42 +0000 (04:49 +0100)]
mmc: Avoid buffer overrun in mmc_startup()

If the CSD register contains a reserved value (4 - 7) in bits 0:2 of the
TRAN_SPEED field, a buffer overrun occurs. Resize the mapping table.

According to the original report
https://lore.kernel.org/u-boot/20180826231332.2491-11-erosca@de.adit-jv.com/
reserved values have been observed resulting in a buffer overrun.

Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Fixes: 272cc70b211e ("Add MMC Framework")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>