]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
11 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-watchdog
Tom Rini [Thu, 19 Oct 2023 13:39:00 +0000 (09:39 -0400)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-watchdog

- sandbox: watchdog: Avoid an error on startup (Simon)
- nuvoton: Fix reset/expire function error (Jim)

11 months agowdt: nuvoton: Fix reset/expire function error
Jim Liu [Wed, 18 Oct 2023 02:09:00 +0000 (10:09 +0800)] 
wdt: nuvoton: Fix reset/expire function error

Fix npcm845 watchdog halt for reset function and expire function.
Reset function is restart wdt.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agosandbox: watchdog: Avoid an error on startup
Simon Glass [Thu, 10 Aug 2023 15:53:13 +0000 (09:53 -0600)] 
sandbox: watchdog: Avoid an error on startup

For some time now running sandbox with -T produces an error:

   Core:  270 devices, 95 uclasses, devicetree: board
   WDT:   Not starting wdt-gpio-toggle
   wdt_gpio wdt-gpio-level: Request for wdt gpio failed: -16
   WDT:   Not starting wdt@0
   MMC:   mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD)

Use an unallocated GPIO to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 1fc45d6483d ("watchdog: add pulse support to gpio watchdog driver")
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoMerge branch '2023-10-17-spl-test-some-load-methods'
Tom Rini [Wed, 18 Oct 2023 12:28:00 +0000 (08:28 -0400)] 
Merge branch '2023-10-17-spl-test-some-load-methods'

To quote the author:
This series adds some tests for various SPL load methods, with the
intent of helping debug v6 of [1]. With that in mind, notable omissions
include NAND and ROMAPI, which both lack sandbox implementations, and
OS_BOOT, which I have deferred due to its complexity. Semihosting is
also omitted, but I think we can test that with qemu.

In order to test all of these methods, we must first generate suitable
images, possibly on filesystems. While other tests have historically
generated these images using external tools (e.g. mkimage, mkfs, etc.),
I have chosen to generate them on the fly. This is for a few reasons:

- By removing external dependencies on pytest to create certain files,
  the tests become self-contained. This makes them easier to iterate on
  and debug.
- By generating tests at runtime, we can dynamically vary the content.
  This helps detect test failures, as even if tests are loaded to the
  same location, the expected content will be different.
- We are not testing the image parsers themselves (e.g.
  spl_load_simple_fit or fs_read) but rather the load methods (e.g.
  spl_mmc_load_image). It is unnecessary to exercise full functionality
  or generate 100% correct images.
- By reducing functionality to only what is necessary, the complexity of
  various formats can often be greatly reduced.

This series depends on [2-3], which are small fixes identified through
this patch set. The organization of patches in this series is as
follows:

- General fixes for bugs which are unlikely to be triggered outside of
  this series
- Changes to IMX8 container images to facilitate testing
- General prep. work, particularly regarding linker issues
- The tests themselves

Passing CI at [4].

[1] https://lore.kernel.org/all/20230731224304.111081-1-sean.anderson@seco.com/
[2] https://lore.kernel.org/all/20230930204246.515254-1-seanga2@gmail.com/
[3] https://lore.kernel.org/all/20231008014748.1987840-1-seanga2@gmail.com/
[4] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18128

11 months agotest: spl: Add a test for the SPI load method
Sean Anderson [Sat, 14 Oct 2023 20:48:05 +0000 (16:48 -0400)] 
test: spl: Add a test for the SPI load method

Add test for the SPI load method. This one is pretty straightforward. We
can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image
doesn't know the total image size and has to guess from fdt_totalsize. This
doesn't include external data, so loading it will fail.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add a test for the NOR load method
Sean Anderson [Sat, 14 Oct 2023 20:48:04 +0000 (16:48 -0400)] 
test: spl: Add a test for the NOR load method

Add a test for the NOR load method. Since NOR is memory-mapped we can
substitute a buffer instead. The only major complication is testing LZMA
decompression.  It's too complex to implement LZMA compression in a test, and we
have no in-tree compressor, so we just include some pre-compressed data. This
data was generated through something like

    generate_data(plain, plain_size, "lzma")
    cat plain.dat | lzma | hexdump -C

and was cleaned up further in my editor.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add a test for the NET load method
Sean Anderson [Sat, 14 Oct 2023 20:48:03 +0000 (16:48 -0400)] 
test: spl: Add a test for the NET load method

Add a test for loading U-Boot over TFTP. As with other sandbox net
routines, we need to initialize our packets manually since things like
net_set_ether and net_set_udp_header always use "our" addresses. We use
BOOTP instead of DHCP, since DHCP has a tag/length-based format which is
harder to parse. Our TFTP implementation doesn't define as many constants
as I'd like, so I create some here. Note that the TFTP block size is
one-based, but offsets are zero-based.

In order to avoid address errors, we need to set up/define some additional
address information settings. dram_init_banksize would be a good candidate
for settig up bi_dram, but it gets called too late in board_init_r.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add a test for the MMC load method
Sean Anderson [Sat, 14 Oct 2023 20:48:02 +0000 (16:48 -0400)] 
test: spl: Add a test for the MMC load method

Add a test for the MMC load method. This shows the general shape of tests
to come: The main test function calls do_spl_test_load with an appropriate
callback to write the image to the medium.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add a test for spl_blk_load_image
Sean Anderson [Sat, 14 Oct 2023 20:48:01 +0000 (16:48 -0400)] 
test: spl: Add a test for spl_blk_load_image

Add a test for spl_blk_load_image, currently used only by NVMe. Because
there is no sandbox NVMe driver, just use MMC instead. Avoid falling back
to raw images to make failures more obvious.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add functions to create filesystems
Sean Anderson [Sat, 14 Oct 2023 20:48:00 +0000 (16:48 -0400)] 
test: spl: Add functions to create filesystems

Add some functions for creating fat/ext2 filesystems with a single file and
a test for them. Filesystems require block devices, and it is easiest to
just use MMC for this. To get an MMC, we must also pull in the test device
tree. SPL_TIMER is necessary for SPL_MMC, perhaps because it uses a timeout.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Add functions to create images
Sean Anderson [Sat, 14 Oct 2023 20:47:59 +0000 (16:47 -0400)] 
test: spl: Add functions to create images

This add some basic functions to create images, and a test for said
functions. This is not intended to be a test of the image parsing
functions, but rather a framework for creating minimal images for testing
load methods. That said, it does do an OK job at finding bugs in the image
parsing directly.

Since we have two methods for loading/parsing FIT images, add LOAD_FIT_FULL
as a separate CI run.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Fix spl_test_load not failing if fname doesn't exist
Sean Anderson [Sat, 14 Oct 2023 20:47:58 +0000 (16:47 -0400)] 
test: spl: Fix spl_test_load not failing if fname doesn't exist

Returning a negative value from a unit test doesn't automatically fail the
test.  We have to fail an assertion. Modify the test to do so.

This now causes the test to count as a failure on VPL. This is because the
fname of SPL (and U-Boot) is generated with make_exec in os_jump_to_image.
The original name of SPL is gone, and we can't determine the name of U-Boot
from the generated name.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: spl: Split tests up and use some configs
Sean Anderson [Sat, 14 Oct 2023 20:47:57 +0000 (16:47 -0400)] 
test: spl: Split tests up and use some configs

In order to make adding new spl unit tests easier, especially when they may
have many dependencies, add some Kconfigs for the existing image test.
Split it into the parts which are generic (such as callbacks) and the
test-specific parts.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agosandbox: Support -T in spl
Sean Anderson [Sat, 14 Oct 2023 20:47:56 +0000 (16:47 -0400)] 
sandbox: Support -T in spl

The test devicetree is only compiled for U-Boot proper. When accessing it in
SPL we need to go up one directory.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agospl: Use map_sysmem where appropriate
Sean Anderson [Sat, 14 Oct 2023 20:47:55 +0000 (16:47 -0400)] 
spl: Use map_sysmem where appropriate

All "physical" addresses in SPL must be converted to virtual addresses
before access in order for sandbox to work. Add some calls to map_sysmem in
appropriate places. We do not generally call unmap_sysmem, since we need
the image memory to still be mapped when we jump to the image. This doesn't
matter at the moment since unmap_sysmem is a no-op.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agospl: Add callbacks to invalidate cached devices
Sean Anderson [Sat, 14 Oct 2023 20:47:54 +0000 (16:47 -0400)] 
spl: Add callbacks to invalidate cached devices

Several SPL functions try to avoid performing initialization twice by
caching devices. This is fine for regular boot, but does not work with
UNIT_TEST, since all devices are torn down after each test. Add some
functions to invalidate the caches which can be called before testing these
load methods.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agonet: bootp: Fall back to BOOTP from DHCP when unit testing
Sean Anderson [Sat, 14 Oct 2023 20:47:53 +0000 (16:47 -0400)] 
net: bootp: Fall back to BOOTP from DHCP when unit testing

If we sent a DHCP packet and get a BOOTP response from the server, we
shouldn't try to send a DHCPREQUEST packet, since it won't be DHCPACKed.
Transition straight to BIND. This is only enabled for UNIT_TEST to avoid
bloat, since I suspect the number of BOOTP servers in the wild is
vanishingly small.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agonet: bootp: Move port numbers to header
Sean Anderson [Sat, 14 Oct 2023 20:47:52 +0000 (16:47 -0400)] 
net: bootp: Move port numbers to header

These defines are useful when testing bootp.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
11 months agonet: Fix compiling SPL when fastboot is enabled
Sean Anderson [Sat, 14 Oct 2023 20:47:51 +0000 (16:47 -0400)] 
net: Fix compiling SPL when fastboot is enabled

When fastboot is enabled in U-Boot proper and SPL_NET is enabled, we will
try to (unsuccessfully) reference it in SPL. Fix these linker errors by
conditioning on SPL_UDP/TCP_FUNCTION_FASTBOOT.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
11 months agofs: ext4: Add some defines for testing
Sean Anderson [Sat, 14 Oct 2023 20:47:50 +0000 (16:47 -0400)] 
fs: ext4: Add some defines for testing

Add various defines which are not necessary for reading/writing
filesystems, but which are useful for creating them. These mostly come from
Linux v6.5-rc2 (what I had checked out).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agofs: ext4: Fix building ext4 in SPL if write is enabled
Sean Anderson [Sat, 14 Oct 2023 20:47:49 +0000 (16:47 -0400)] 
fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agofs: Disable sandbox filesystem in SPL
Sean Anderson [Sat, 14 Oct 2023 20:47:48 +0000 (16:47 -0400)] 
fs: Disable sandbox filesystem in SPL

Don't bother compiling the sandbox filesystem in SPL for now, as it is not
needed.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agolib: acpi: Fix linking SPL when ACPIGEN is enabled
Sean Anderson [Sat, 14 Oct 2023 20:47:47 +0000 (16:47 -0400)] 
lib: acpi: Fix linking SPL when ACPIGEN is enabled

lib/acpi/acpigen.o is only compiled into SPL when SPL_ACPIGEN is enabled.
Update several files which reference these functions accordingly.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agospl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same time
Sean Anderson [Sat, 14 Oct 2023 20:47:46 +0000 (16:47 -0400)] 
spl: Allow enabling SPL_OF_REAL and SPL_OF_PLATDATA at the same time

Sandbox unit tests in U-Boot proper load a test device tree to have some
devices to work with. In order to do the same in SPL, we must enable
SPL_OF_REAL. However, we already have SPL_OF_PLATDATA enabled. When
generating platdata from a devicetree, it is expected that we will not need
devicetree access functions (even though SPL_OF_CONTROL is enabled). This
expectation does not hold for sandbox, so allow user control of
SPL_OF_REAL.

There are several places in the tree where conditions involving OF_PLATDATA
or OF_REAL no longer function correctly when both of these options can be
selected at the same time. Adjust these conditions accordingly.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoMove i.MX8 container image loading support to common/spl
Sean Anderson [Sat, 14 Oct 2023 20:47:45 +0000 (16:47 -0400)] 
Move i.MX8 container image loading support to common/spl

To facilitate testing loading i.MX8 container images, move the
parse-container code to common/spl.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoarm: imx: Check header before calling spl_load_imx_container
Sean Anderson [Sat, 14 Oct 2023 20:47:44 +0000 (16:47 -0400)] 
arm: imx: Check header before calling spl_load_imx_container

Make sure we have an IMX header before calling spl_load_imx_container,
since if we don't it will fail with -ENOENT. This allows us to fall back to
legacy/raw images if they are also enabled.

This is a functional change, one which likely should have been in place
from the start, but a functional change nonetheless. Previously, all
non-IMX8 images (except FITs without FIT_FULL) would be optimized out if
the only image load method enabled supported IMX8 images. With this change,
support for other image types now has an effect.

There are seven boards with SPL_LOAD_IMX_CONTAINER enabled: three with
SPL_BOOTROM_SUPPORT:

    imx93_11x11_evk_ld imx93_11x11_evk imx8ulp_evk

and four with SPL_MMC:

    deneb imx8qxp_mek giedi imx8qm_mek

All of these boards also have SPL_RAW_IMAGE_SUPPORT and
SPL_LEGACY_IMAGE_FORMAT enabled as well. However, none have FIT support
enabled. Of the six load methods affected by this patch, only SPL_MMC and
SPL_BOOTROM_SUPPORT are enabled with SPL_LOAD_IMX_CONTAINER.
spl_romapi_load_image_seekable does not support legacy or raw images, so
there is no growth. However, mmc_load_image_raw_sector does support loading
legacy/raw images. Since these images could not have been booted before, I
have disabled support for legacy/raw images on these four boards. This
reduces bloat from around 800 bytes to around 200.

There are no in-tree boards with SPL_LOAD_IMX_CONTAINER and AHAB_BOOT both
enabled, so we do not need to worry about potentially falling back to
legacy images in a secure boot scenario.

Future work could include merging imx_container.h with imx8image.h, since
they appear to define mostly the same structures.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoarm: imx: Add function to validate i.MX8 containers
Sean Anderson [Sat, 14 Oct 2023 20:47:43 +0000 (16:47 -0400)] 
arm: imx: Add function to validate i.MX8 containers

Add a function to abstract the common task of validating i.MX8 container
image headers.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoarm: imx: Use log_err for errors in read_auth_container
Sean Anderson [Sat, 14 Oct 2023 20:47:42 +0000 (16:47 -0400)] 
arm: imx: Use log_err for errors in read_auth_container

To allow for more flexible handling of errors, use log_err instead of
printf.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoarm: imx: Add newlines after error messages
Sean Anderson [Sat, 14 Oct 2023 20:47:41 +0000 (16:47 -0400)] 
arm: imx: Add newlines after error messages

These error messages are missing newlines. Add them.

Fixes: 6e81ca220e0 ("imx: parse-container: Use malloc for container processing")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoarm: imx: Fix i.MX8 container load address
Sean Anderson [Sat, 14 Oct 2023 20:47:40 +0000 (16:47 -0400)] 
arm: imx: Fix i.MX8 container load address

We should load images to their destination, not their entry point.

Fixes: 7b86cd4274e ("imx8: support parsing i.MX8 Container file")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agospl: fit: Fix entry point for SPL_LOAD_FIT_FULL
Sean Anderson [Sat, 14 Oct 2023 20:47:39 +0000 (16:47 -0400)] 
spl: fit: Fix entry point for SPL_LOAD_FIT_FULL

The entry point is not always the same as the load address. Use the value
of the entry property if it exists.

Fixes: 8a9dc16e4d0 ("spl: Add full fitImage support")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agospl: nor: Don't allocate header on stack
Sean Anderson [Sat, 14 Oct 2023 20:47:38 +0000 (16:47 -0400)] 
spl: nor: Don't allocate header on stack

spl_image_info.name contains a reference to legacy_img_hdr. If we allocate
the latter on the stack, it will be clobbered after we return. This was
addressed for NAND back in 06377c5a1fc ("spl: spl_legacy: Fix NAND boot on
OMAP3 BeagleBoard"), but that commit didn't fix NOR.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
11 months agospl: legacy: Fix referencing _image_binary_end
Sean Anderson [Sat, 14 Oct 2023 20:47:37 +0000 (16:47 -0400)] 
spl: legacy: Fix referencing _image_binary_end

On non-arm architectures, _image_binary_end is defined as a ulong and not a
char[]. Take the address of it when accessing it, which is correct for
both.

Fixes: 1b8a1be1a1f ("spl: spl_legacy: Fix spl_end address")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoRevert "fs: ext4: check the minimal partition size to mount"
Sean Anderson [Sat, 30 Sep 2023 20:42:46 +0000 (16:42 -0400)] 
Revert "fs: ext4: check the minimal partition size to mount"

This check breaks small partitions (under 1024 blocks) because part_length
is in units of part.blksz and not bytes. Given the purpose of this
function, we really want to make sure the partition is SUPERBLOCK_START +
SUPERBLOCK_SIZE (2048) bytes so we can call ext4_read_superblock without
error.

The obvious solution is to convert callers from things like

ext4fs_mount(part_info.size)

to

ext4fs_mount(part_info.size * part_info.blksz);

However, I'm not really a fan of the bloat that would cause, especially
since the error is now suppressed. I think the best course of action here
is to just revert the patch.

This reverts commit 9905cae65e03335aefcb1ebfab5b7ee62d89f64e.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
11 months agospl: mmc: Fix subsequent calls to spl_mmc_load with CONFIG_BLK
Sean Anderson [Sun, 8 Oct 2023 01:47:48 +0000 (21:47 -0400)] 
spl: mmc: Fix subsequent calls to spl_mmc_load with CONFIG_BLK

MMC devices do not have uclass platdata containing blk_descs, only their
child block devices do. Fortunately, we have a function just for this
purpose. This fixes subsequent calls to spl_mmc_load.

Fixes: bf28d9a6599 ("spl: mmc: Use correct MMC device when loading image")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
11 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Tue, 17 Oct 2023 13:15:56 +0000 (09:15 -0400)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh

- RZ/G2L part 1, except for two serial port patches which I had to drop
  as they broke R2Dplus, they will come later via subsequent PR.

11 months agoboard: rzg2l: Add RZ/G2L SMARC EVK board
Paul Barker [Mon, 16 Oct 2023 09:25:43 +0000 (10:25 +0100)] 
board: rzg2l: Add RZ/G2L SMARC EVK board

The Renesas RZ/G2L SMARC Evaluation Board Kit consists of the RZ/G2L
System-on-Module (SOM) based on the R9A07G044L2 SoC, and a common SMARC
carrier board.

The ARM TrustedFirmware code for the Renesas RZ/G2L SoC family passes a
devicetree blob to the bootloader as an argument in the same was
previous R-Car gen3/gen4 SoCs. This blob contains a compatible string
which can be used to identify the particular SoC we are running on and
this is used to select the appropriate device tree to load.

The configuration renesas_rzg2l_smarc_defconfig is added to support
building for this target. In the future this defconfig will be extended
to support other SoCs and evaluation boards from the RZ/G2L family.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: dts: Import RZ/G2L SMARC EVK device tree
Paul Barker [Mon, 16 Oct 2023 09:25:42 +0000 (10:25 +0100)] 
arm: dts: Import RZ/G2L SMARC EVK device tree

The Renesas RZ/G2L SMARC Evaluation Board Kit consists of the RZ/G2L
System-on-Module (SOM) based on the R9A07G044L2 SoC, and a common SMARC
carrier board.

This patch is based on the corresponding Linux v6.5 device tree
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Support RZ/G2L memory map
Paul Barker [Mon, 16 Oct 2023 09:25:41 +0000 (10:25 +0100)] 
arm: rmobile: Support RZ/G2L memory map

The memory map for the RZ/G2L family differs from that of previous R-Car
Gen3/Gen4 SoCs.

A high level memory map can be seen in figure 5.2 (section 5.2.1) of the
RZ/G2L data sheet rev 1.30 published May 12, 2023. A summary is included
here (note that this is a 34-bit address space):
  * 0x0_0000_0000 - 0x0_0002_FFFF SRAM area
  * 0x0_0003_0000 - 0x0_0FFF_FFFF Reserved area
  * 0x0_1000_0000 - 0x0_1FFF_FFFF I/O register area
  * 0x0_2000_0000 - 0x0_2FFF_FFFF SPI Multi area
  * 0x0_3000_0000 - 0x0_3FFF_FFFF Reserved area
  * 0x0_4000_0000 - 0x1_3FFF_FFFF DDR area (4 GiB)
  * 0x1_4000_0000 - 0x3_FFFF_FFFF Reserved area

Within the DDR area, the first 128 MiB are reserved by TrustedFirmware.
The region from 0x43F00000 to 0x47DFFFFF inclusive is protected for use
in TrustedFirmware/OP-TEE, but all other memory is included in the
memory map. This reservation is the same as used in R-Car
Gen3/Gen4 and RZ/G2{H,M,N,E} SoCs.

DRAM information is initialised based on the data in the fdt.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Add CPU detection for RZ/G2L
Paul Barker [Mon, 16 Oct 2023 09:25:40 +0000 (10:25 +0100)] 
arm: rmobile: Add CPU detection for RZ/G2L

The ARM TrustedFirmware code for the Renesas RZ/G2L SoC family passes a
devicetree blob to the bootloader as an argument in the same was
previous R-Car Gen3/Gen4 SoCs. This blob contains a compatible string
which can be used to identify the particular SoC we are running on.

We do this as reading the DEVID & PRR registers from u-boot is not
sufficient to differentiate between the R9A07G044L (RZ/G2L) and
R9A07G044C (RZ/G2LC) SoCs. An additional read from offset 0x11861178 is
needed but this address is in the OTP region which can only be read from
the secure world (i.e. TrustedFirmware). So we have to rely on
TrustedFirmware to determine the SoC and pass this information to u-boot
via an fdt blob.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Include <asm/types.h> in header
Paul Barker [Mon, 16 Oct 2023 09:25:39 +0000 (10:25 +0100)] 
arm: rmobile: Include <asm/types.h> in header

We don't want to rely on source files including <asm/types.h> before
<asm/arch/rmobile.h>.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agommc: renesas-sdhi: Initialize module on RZ/G2L
Paul Barker [Mon, 16 Oct 2023 09:25:38 +0000 (10:25 +0100)] 
mmc: renesas-sdhi: Initialize module on RZ/G2L

On the Renesas RZ/G2L SoC family, we must ensure that the required clock
signals are enabled and the reset signal is de-asserted before we try to
communicate with the SDHI module.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agommc: renesas-sdhi: Refactor probe function
Paul Barker [Mon, 16 Oct 2023 09:25:37 +0000 (10:25 +0100)] 
mmc: renesas-sdhi: Refactor probe function

Move the assignment of priv->quirks earlier in the function. This allows
us to drop the quirks local variable and makes it easier to maintain
clean error handling when we add RZ/G2L support in the next patch.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoserial: sh: Sort includes
Paul Barker [Mon, 16 Oct 2023 09:25:35 +0000 (10:25 +0100)] 
serial: sh: Sort includes

Tidy up the existing include list before we add more includes in the
following patch.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoMerge tag 'u-boot-imx-20231016' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 16 Oct 2023 21:34:38 +0000 (17:34 -0400)] 
Merge tag 'u-boot-imx-20231016' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20231016
-------------------

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

- Imrovement MX93
- Toradex: fixes
- Convert to DM (serial, watchdog) for some boards
- HAB improvements for Secure Boot
- DTO overlay for DHCOM
- USB fixes, Mass storage for MX28
- Cleanup some code
- Phytec MX8M : EEProm detection, fixes
- Gateworks Boards improvements

11 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 16 Oct 2023 16:15:37 +0000 (12:15 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- dns325: Enable 2nd harddrive (Peter & Stefan)
- marvell: cn9310-crb: Misc fixes to SPI / pincntrl in DTS (Chris)
- kirkwood: Add support for ZyXEL NSA325 board (Tony)
- sata_mv: Add bootstd hook to enable sata_bootdev (Tony)
- x240/AC5/AC5X: Disable SMBIOS (Chris)
- Revert "arm: mvebu: x240: Use i2c-gpio instead of built in controller"
  (Chris)
- DS116/N2350: Enable bootstd (Tony)
- clearfog: Support multiple DDR sizes (Josua)

11 months agoMerge branch '2023-10-16-assorted-cmd-updates'
Tom Rini [Mon, 16 Oct 2023 14:25:11 +0000 (10:25 -0400)] 
Merge branch '2023-10-16-assorted-cmd-updates'

- Update the mac command a bit, to be more widely useful and add a
  helper macro to declare CONFIG_SYS_LONGHELP text

11 months agoimx8mp-evk: Add USB0 OTG support
Fabio Estevam [Mon, 16 Oct 2023 00:24:37 +0000 (21:24 -0300)] 
imx8mp-evk: Add USB0 OTG support

Add USB0 OTG support.

Currently, the USB0 OTG nodes are not enabled in the Linux kernel
devicetree.

For this reason, enable the USB0 OTG nodes inside imx8mp-evk-u-boot.dtsi
for now.

Also select several useful options such as USB gadget and fastboot.

Tested by running "ums 0 mmc 2".

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
11 months agoarm64: dts: imx8mp: Make GPIO3 available early in U-Boot proper on i.MX8MP DHCOM
Marek Vasut [Sun, 15 Oct 2023 22:41:14 +0000 (00:41 +0200)] 
arm64: dts: imx8mp: Make GPIO3 available early in U-Boot proper on i.MX8MP DHCOM

The GPIO3 has to be available early during U-Boot proper start up for
DRAM size detect to work correctly. The GPIO3 is currently available in
SPL and late in U-Boot proper, which is insufficient. Add the missing
bootph-all to make the GPIO3 available also early in U-Boot proper.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agopico-pi-imx7d: Unselect CONFIG_CONSOLE_MUX
Fabio Estevam [Wed, 4 Oct 2023 00:58:31 +0000 (21:58 -0300)] 
pico-pi-imx7d: Unselect CONFIG_CONSOLE_MUX

Unselect CONFIG_CONSOLE_MUX to fix the following
error for the input, output and error interfaces:

U-Boot 2023.10 (Oct 03 2023 - 21:23:18 -0300)
...
In:    No input devices available!
Out:   No output devices available!
Err:   No error devices available!
Net:   eth0: ethernet@30be0000
Hit any key to stop autoboot:  0

Signed-off-by: Fabio Estevam <festevam@denx.de>
11 months agomxs: Kconfig: Remove TARGET_XFI3 symbol
Fabio Estevam [Wed, 19 Jul 2023 01:25:48 +0000 (22:25 -0300)] 
mxs: Kconfig: Remove TARGET_XFI3 symbol

The xfi3 target has been removed by commit 539fba2c10e7 ("arm:
Remove xfi3 board"), but it missed to remove an entry from the
mxs Kconfig.

Remove it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
11 months agosmegw01: Convert to watchdog driver model
Fabio Estevam [Tue, 8 Aug 2023 21:40:40 +0000 (18:40 -0300)] 
smegw01: Convert to watchdog driver model

Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
the 'reset' command in U-Boot to not cause a board reset.

Fix it by switching to the watchdog driver model via sysreset, which
is the preferred method for implementing the watchdog reset.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
11 months agomx7dsabresd: Convert to watchdog driver model
Fabio Estevam [Tue, 8 Aug 2023 21:40:39 +0000 (18:40 -0300)] 
mx7dsabresd: Convert to watchdog driver model

Commit 68dcbdd594d4 ("ARM: imx: Add weak default reset_cpu()") caused
the 'reset' command in U-Boot to not cause a board reset.

Fix it by switching to the watchdog driver model via sysreset, which
is the preferred method for implementing the watchdog reset.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
11 months agoimx7d-sdb-u-boot: Pass SPDX-License tag
Fabio Estevam [Tue, 8 Aug 2023 21:40:38 +0000 (18:40 -0300)] 
imx7d-sdb-u-boot: Pass SPDX-License tag

SPDX-License tag is missing and checkpatch complains about it.

Add the SPDX-License tag using the same one from imx7d-sdb.dts.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
11 months agoimx93_evk: defconfig: enable clock driver
Sébastien Szymanski [Tue, 25 Jul 2023 08:08:56 +0000 (10:08 +0200)] 
imx93_evk: defconfig: enable clock driver

Add clocks nodes in u-boot.dtsi file.
Remove init_uart_clk() call.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
11 months agoarm64: dts: imx8mp: Add DT overlay describing i.MX8MP DHCOM SoM rev.100
Marek Vasut [Thu, 21 Sep 2023 18:44:20 +0000 (20:44 +0200)] 
arm64: dts: imx8mp: Add DT overlay describing i.MX8MP DHCOM SoM rev.100

The current imx8mp-dhcom-som.dtsi describes production rev.200 SoM,
add DT overlay which reinstates rev.100 SoM description to permit
prototype rev.100 SoMs to be used until they get phased out.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agoarm64: dts: imx8mp: Drop i.MX8MP DHCOM rev.100 PHY address workaround from PDK3 DT
Marek Vasut [Thu, 21 Sep 2023 18:44:19 +0000 (20:44 +0200)] 
arm64: dts: imx8mp: Drop i.MX8MP DHCOM rev.100 PHY address workaround from PDK3 DT

In case the i.MX8MP DHCOM rev.100 has been populated on the PDK3
carrier board, the on-SoM PHY PHYAD1 signal has been pulled high
by the carrier board and changed the PHY MDIO address from 5 to 7.
This has been fixed on production rev.200 SoM by additional buffer
on the SoM PHYAD/LED signals, remove the workaround.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agoarm64: dts: imx8mp: Update i.MX8MP DHCOM SoM DT to production rev.200
Marek Vasut [Thu, 21 Sep 2023 18:44:18 +0000 (20:44 +0200)] 
arm64: dts: imx8mp: Update i.MX8MP DHCOM SoM DT to production rev.200

The current imx8mp-dhcom-som.dtsi describes prototype rev.100 SoM,
update the DT to describe production rev.200 SoM which brings the
following changes:
- Fast SoC GPIOs exposed on the SoM edge connector
- Slow GPIOs like component resets moved to I2C GPIO expander
- ADC upgraded from TLA2024 to ADS1015 with conversion interrupt
- EEPROM size increased from 256 B to 4 kiB

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agoarm64: dts: imx8mp: Switch to DT overlays for i.MX8MP DHCOM SoM
Marek Vasut [Thu, 21 Sep 2023 18:44:17 +0000 (20:44 +0200)] 
arm64: dts: imx8mp: Switch to DT overlays for i.MX8MP DHCOM SoM

Add DT overlays to support additional DH i.MX8MP DHCOM SoM 660-100
population options with 1x or 2x RMII PHY mounted on PDK2 or PDK3
carrier boards.

Use SPL DTO support to apply matching SoM specific DTO to cater
for the SoM differences. Remove ad-hoc patching of control DT from
fdtdec_board_setup().

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agospl: fit: Add board level function to decide application of DTO
Marek Vasut [Thu, 21 Sep 2023 18:44:16 +0000 (20:44 +0200)] 
spl: fit: Add board level function to decide application of DTO

Add board-specific function used to indicate whether a DTO from fitImage
configuration node 'fdt' property DT and DTO list should be applied onto
the base DT or not applied.

This is useful in case of DTOs which implement e.g. different board revision
details, where such DTO should be applied on one board revision, and should
not be applied on another board revision.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agoimx: hab: Use size parameter
Marek Vasut [Thu, 31 Aug 2023 14:57:24 +0000 (16:57 +0200)] 
imx: hab: Use size parameter

The current code works by sheer coincidence, because (see HABv4 API
documentation, section 3.4) the RVT authenticate_image call updates
the size that is passed in with the actual size ROM code pulls from
IVT/CSF . So if the input size is larger, that is "fine" . Pass in
size instead to make this really correct.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agocmd/ti: Update Kconfig logic and Makefile recursion logic
Tom Rini [Sat, 7 Oct 2023 19:36:58 +0000 (15:36 -0400)] 
cmd/ti: Update Kconfig logic and Makefile recursion logic

- Add some dependencies to CMD_DDR3 as this is only valid on some
  platforms (which tend to select it as well).
- The proper gate for going in to cmd/ti is not
  CONFIG_TI_COMMON_CMD_OPTIONS as nothing under there is controlled by
  that symbol but the general TI architecture options.

Signed-off-by: Tom Rini <trini@konsulko.com>
11 months agocmd: Convert existing long help messages to the new macro
Tom Rini [Sat, 7 Oct 2023 19:13:08 +0000 (15:13 -0400)] 
cmd: Convert existing long help messages to the new macro

- Generally we just drop the #ifdef CONFIG_SYS_LONGHELP and endif lines
  and use U_BOOT_LONGHELP to declare the same variable name as before
- In a few places, either rename the variable to follow convention or
  introduce the variable as it was being done inline before.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agocommand.h: Add a U_BOOT_LONGHELP macro
Tom Rini [Sat, 7 Oct 2023 19:13:07 +0000 (15:13 -0400)] 
command.h: Add a U_BOOT_LONGHELP macro

In order to be able to discard unused long help texts without further
linker lists, add a macro for defining the long help messages which uses
__maybe_unused.  This allows us to discard them as unreferenced as part
of the link.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoeeprom: starfive: add 'mac raw' command
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:47 +0000 (14:01 +0200)] 
eeprom: starfive: add 'mac raw' command

Add a sub-command to print a hexdump of the EEPROM content.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoeeprom: starfive: raw dump if unsupported data version
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:46 +0000 (14:01 +0200)] 
eeprom: starfive: raw dump if unsupported data version

If the data version field of the EEPROM is not supported, provide a hexdump
of the data.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoeeprom: starfive: re-implement mac command
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:45 +0000 (14:01 +0200)] 
eeprom: starfive: re-implement mac command

The different implementations of the mac command have board or vendor
specific sub-commands.

Add the command definition specific to the VisionFive 2 board.

Don't call cmd_usage() directly but return CMD_RET_USAGE instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoeeprom: SiFive Unmatched: re-implement mac command
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:44 +0000 (14:01 +0200)] 
eeprom: SiFive Unmatched: re-implement mac command

The different implementations of the mac command have board or vendor
specific sub-commands.

Add the command definition specific to the SiFive HiFive Unmatched board.

Don't call cmd_usage() directly but return CMD_RET_USAGE instead.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agofreescale: fix long help handling in mac command
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:43 +0000 (14:01 +0200)] 
freescale: fix long help handling in mac command

CONFIG_SYS_LONGHELP=n we want to reduce the size of the U-Boot binary.
The long text should be reduced to and empty string in this case.

There is not need to call cmd_usage() directly. It is sufficient to
return CMD_RET_USAGE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agocmd: move mac command
Heinrich Schuchardt [Sat, 30 Sep 2023 12:01:42 +0000 (14:01 +0200)] 
cmd: move mac command

Board specific implementations of the 'mac' command differ concerning the
supported sub-commands.

Move the Freescale specific mac command definition to the board code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agogpio: Add RZ/G2L GPIO driver
Paul Barker [Mon, 16 Oct 2023 09:25:33 +0000 (10:25 +0100)] 
gpio: Add RZ/G2L GPIO driver

This driver adds support for the gpio features of the GPIO/PFC module in
the Renesas RZ/G2L (R9A07G044) SoC.

The new `rzg2l-pfc-gpio` driver is bound to the same device tree node as
the `rzg2l-pfc-pinctrl` driver as the same hardware block provides both
GPIO and pin multiplexing features.

This patch is based on the corresponding Linux v6.5 driver
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agopinctrl: renesas: Add RZ/G2L PFC driver
Paul Barker [Mon, 16 Oct 2023 09:25:32 +0000 (10:25 +0100)] 
pinctrl: renesas: Add RZ/G2L PFC driver

This driver adds support for the pinctrl features of the GPIO/PFC module
in the Renesas RZ/G2L (R9A07G044) SoC.

A multi-function `rzg2l-pfc` driver is defined for UCLASS_NOP, which
binds the `rzg2l-pfc-pinctrl` UCLASS_PINCTRL driver dynamically. We also
define common macros and functions for the PFC in <renesas/rzg2l-pfc.h>.
This makes it easy to add an additional UCLASS_GPIO driver for the GPIO
functionality of this module in a follow-up patch.

This patch is based on the corresponding Linux v6.5 driver
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agocmd: gpio: Skip output on -ENOENT
Paul Barker [Mon, 16 Oct 2023 09:25:31 +0000 (10:25 +0100)] 
cmd: gpio: Skip output on -ENOENT

On the Renesas RZ/G2L SoC family, valid GPIO numbers are not contiguous.
This is determined by the device tree, where a fixed number of bits are
used for the 'pin' number within a 'port', even though not all ports
have the same number of pins. The device tree can't be changed here
without breaking backwards compatibility in Linux, which we don't want
to do.

To avoid printing a status for each of these invalid GPIO numbers when
a user executes `gpio status -a`, we allow gpio_get_function() to return
-ENOENT when the given offset does not refer to a valid GPIO pin and we
skip printing anything if this occurs.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Restrict PINCTRL_PFC selection to R-Car gen3/gen4
Paul Barker [Mon, 16 Oct 2023 09:25:30 +0000 (10:25 +0100)] 
arm: rmobile: Restrict PINCTRL_PFC selection to R-Car gen3/gen4

The RZ/G2L family uses CONFIG_RCAR_64 but does not share a common PFC
driver with the R-Car gen3 & gen4 boards.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoclk: renesas: Add RZ/G2L & RZ/G2LC CPG driver
Paul Barker [Mon, 16 Oct 2023 09:25:29 +0000 (10:25 +0100)] 
clk: renesas: Add RZ/G2L & RZ/G2LC CPG driver

This driver provides clock and reset control for the Renesas R9A07G044L
(RZ/G2L) and R9A07G044C (RZ/G2LC) SoC. It consists of two parts:

* driver code which is applicable to all SoCs in the RZ/G2L family.

* static data describing the clocks and resets which are specific to the
  R9A07G044{L,C} SoCs. The identifier r9a07g044 (without a final letter)
  is used to indicate that both SoCs are supported.

clk_set_rate() and clk_get_rate() are implemented only for the clocks
that are actually used in u-boot.

The CPG driver is marked with DM_FLAG_PRE_RELOC to ensure that its bind
function is called before the SCIF (serial port) driver is probed. This
is required so that we can de-assert the relevant reset signal during
the serial driver probe function.

This patch is based on the corresponding Linux v6.5 driver
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Add basic R9A07G044L SoC support
Paul Barker [Mon, 16 Oct 2023 09:25:28 +0000 (10:25 +0100)] 
arm: rmobile: Add basic R9A07G044L SoC support

Add a config option for the R9A07G044L SoC used in the RZ/G2L so that we
can make use of this in the subsequent driver patches.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoarm: rmobile: Add basic RZ/G2L family support
Paul Barker [Mon, 16 Oct 2023 09:25:27 +0000 (10:25 +0100)] 
arm: rmobile: Add basic RZ/G2L family support

The Renesas RZ/G2L family includes the following ARM SoCs:

* RZ/G2L  (r9a07g044l)
* RZ/G2LC (r9a07g044c)
* RZ/G2UL (r9a07g043u)
* RZ/V2L  (r9a07g054l)

Support for individual SoCs and evaluation boards will be added in
separate patches.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agodt-bindings: Add RZ/G2L IRQC bindings
Paul Barker [Mon, 16 Oct 2023 09:25:26 +0000 (10:25 +0100)] 
dt-bindings: Add RZ/G2L IRQC bindings

Import bindings for the Interrupt Controller (IRQC) module in the
Renesas RZ/G2L SoC family.

This patch is based on the dt-bindings in Linux v6.5
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agodt-bindings: Add RZ/G2L PFC bindings
Paul Barker [Mon, 16 Oct 2023 09:25:25 +0000 (10:25 +0100)] 
dt-bindings: Add RZ/G2L PFC bindings

Import bindings for the Port Function Control (PFC) module in the
Renesas RZ/G2L SoC family.

This patch is based on the dt-bindings in Linux v6.5
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agodt-bindings: Add RZ/G2L CPG bindings
Paul Barker [Mon, 16 Oct 2023 09:25:24 +0000 (10:25 +0100)] 
dt-bindings: Add RZ/G2L CPG bindings

Import bindings for the Clock Pulse Generator (CPG) module in the
Renesas RZ/G2L SoC family.

This patch is based on the dt-bindings in Linux v6.5
(commit 52e12027d50affbf60c6c9c64db8017391b0c22e).

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoserial: sh: Fix compile error when lacking HSCIF support
Paul Barker [Mon, 16 Oct 2023 09:25:23 +0000 (10:25 +0100)] 
serial: sh: Fix compile error when lacking HSCIF support

If we attempt to compile serial_sh.c for a system which lacks HSCIF
support (e.g. R8A7740), we see the following compilation error:

    In file included from drivers/serial/serial_sh.c:20:
    drivers/serial/serial_sh.c: In function ‘sh_serial_init_generic’:
    drivers/serial/serial_sh.h:429:35: warning: implicit declaration of function ‘sci_HSSRR_out’; did you mean ‘sci_SCSCR_out’? [-Wimplicit-function-declaration]
      429 | #define sci_out(port, reg, value) sci_##reg##_out(port, value)
          |                                   ^~~~
    drivers/serial/serial_sh.c:62:17: note: in expansion of macro ‘sci_out’
       62 |                 sci_out(port, HSSRR, HSSRR_SRE | HSSRR_SRCYC8);
          |                 ^~~~~~~

To fix this, only try to support access to the HSSRR register for SoCs
where it actually exists.

Support for the RZ/G2L will be introduced in following patches, which
selects CONFIG_RCAR_64 but does not have HSCIF interfaces, so check for
CONFIG_RCAR_GEN2 || CONFIG_RCAR_GEN3 || CONFIG_RCAR_GEN4 to determine if
HSCIF is present.

Fixes: bbe36e29ca2c ('serial: sh: Add HSCIF support for R-Car SoC')
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
11 months agoMerge tag 'u-boot-amlogic-20231015' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 16 Oct 2023 13:09:54 +0000 (09:09 -0400)] 
Merge tag 'u-boot-amlogic-20231015' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- add Amlogic A1 clock driver
- add Amlogic A1 reset support
- add USB Device support for Amlogic A1
- enable RNG on Amlogic A1 & Amlogic S4
- move Amlogic Secure Monitor to standalone driver

11 months agoserial: lpuart: Enable IPG clock
Ye Li [Tue, 25 Jul 2023 08:08:55 +0000 (10:08 +0200)] 
serial: lpuart: Enable IPG clock

Current codes only ennable the PER clock. However on iMX8 the LPUART
also needs IPG clock which is an LPCG. Should not depend on the default
LPCG setting.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
11 months agoarm: dts: imx93: add a per clock for LPUART1
Alice Guo [Tue, 25 Jul 2023 08:08:54 +0000 (10:08 +0200)] 
arm: dts: imx93: add a per clock for LPUART1

When CLK is enabled, get_lpuart_clk_rate() needs to get a per clock of
lpuart, so that add a per clock for lpuart1.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
11 months agoclk: imx: add i.MX93 CCF driver
Sébastien Szymanski [Tue, 25 Jul 2023 08:08:53 +0000 (10:08 +0200)] 
clk: imx: add i.MX93 CCF driver

Add i.MX93 CCF driver support.
Modifed from Linux Kernel v6.5-rc2 and adapted for U-Boot.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
11 months agoARM: dts: imx: Switch USB1 port control to GPIO on Data Modul i.MX8M Plus eDM SBC
Marek Vasut [Sat, 15 Jul 2023 18:24:16 +0000 (20:24 +0200)] 
ARM: dts: imx: Switch USB1 port control to GPIO on Data Modul i.MX8M Plus eDM SBC

The USB_PWR signal operation is not reliable on this DWC3 controller
instance in case the signal is active high. Switch to GPIO control,
which always behaves correctly. Perform the change in u-boot extras
until this hits Linux upstream.

Signed-off-by: Marek Vasut <marex@denx.de>
11 months agoarm: mvebu: AC5/AC5X: Disable SMBIOS
Chris Packham [Fri, 13 Oct 2023 03:00:11 +0000 (16:00 +1300)] 
arm: mvebu: AC5/AC5X: Disable SMBIOS

The RD-AC5X doesn't make use of EFI or SMBIOS. Recently we started seeing
boot failures such as

    WARNING: SMBIOS table_address overflow 27f60f020
    Failed to write SMBIOS table
    initcall failed at event 10/(unknown) (err=-22)
    ### ERROR ### Please RESET the board ###

The error is because the physical address of the RAM on the AC5X SoC is
above the 32GiB boundary. As we don't need SMBIOS or EFI this can be
safely disabled.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoarm: mvebu: clearfog: support 512MB memory size from tlv eeprom
Josua Mayer [Sun, 8 Oct 2023 14:58:04 +0000 (16:58 +0200)] 
arm: mvebu: clearfog: support 512MB memory size from tlv eeprom

Handle 2GBit memory size value "2" from tlv eeprom on ddr
initialisation, to support SoMs with 512MB ddr memory.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoarm: mvebu: clearfog: read number of ddr channels from tlv data
Josua Mayer [Sun, 8 Oct 2023 14:58:03 +0000 (16:58 +0200)] 
arm: mvebu: clearfog: read number of ddr channels from tlv data

Extend the existing tlv vendor extension used for ram size by one byte to
also store the number of ddr channels.
The length of the tlv entry can indicate whether the new information is
present. If not default to single channel.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoarm: mvebu: Enable bootstd for Thecus N2350 board
Tony Dinh [Sat, 7 Oct 2023 22:08:13 +0000 (15:08 -0700)] 
arm: mvebu: Enable bootstd for Thecus N2350 board

Enable bootstd for Thecus N2350 board, and remove distroboot.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoarm: mvebu: Enable bootstd for Synology DS116 board
Tony Dinh [Sat, 7 Oct 2023 21:35:47 +0000 (14:35 -0700)] 
arm: mvebu: Enable bootstd for Synology DS116 board

Enable bootstd for Synology DS116 board, and remove distroboot.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoRevert "arm: mvebu: x240: Use i2c-gpio instead of built in controller"
Chris Packham [Tue, 3 Oct 2023 03:57:39 +0000 (16:57 +1300)] 
Revert "arm: mvebu: x240: Use i2c-gpio instead of built in controller"

This reverts commit 5c1c6b7306f2b4c0fd50c7cb5d757e245b93606e. The reason
for switching to i2c-gpio was due to an issue we were seeing in the
Linux kernel where the CPU would lock up on certain adverse I2C bus
conditions. We were never able to reproduce the lockup in U-Boot but
assumed that was probably just luck.

Since then we have discovered that the lock up was due to the I2C
transaction offload engine in the I2C controller not coping with the
adverse bus conditions (basically it thinks there's another master and
waits for a STOP condition that never comes). U-Boot doesn't use the I2C
offload feature so is not susceptible to the lockup.

We can therefore safely return to using the built-in I2C controller.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoarm: mvebu: x240: Disable SMBIOS
Chris Packham [Tue, 3 Oct 2023 03:57:38 +0000 (16:57 +1300)] 
arm: mvebu: x240: Disable SMBIOS

The x240 doesn't make use of EFI or SMBIOS. Recently we started seeing
boot failures such as

    WARNING: SMBIOS table_address overflow 23f60c020
    Failed to write SMBIOS table
    initcall failed at event 10/(unknown) (err=-22)
    ### ERROR ### Please RESET the board ###

The error is because the physical address of the RAM on the AC5X SoC is
above the 32GiB boundary. As we don't need SMBIOS or EFI this can be
safely disabled.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
11 months agoboard: phytec: phycore_imx8mp: Add 4000MTS RAM timings based on PCB rev
Teresa Remmet [Thu, 17 Aug 2023 08:57:11 +0000 (10:57 +0200)] 
board: phytec: phycore_imx8mp: Add 4000MTS RAM timings based on PCB rev

Starting with PCB revision 3 we can safely make use of higher RAM
frequency again. Make use of the EEPROM detection to determine the
revision and use the updated RAM timings for new SoMs.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
11 months agoboard: phytec: phycore-imx8mp: Add EEPROM detection initialisation
Teresa Remmet [Thu, 17 Aug 2023 08:57:08 +0000 (10:57 +0200)] 
board: phytec: phycore-imx8mp: Add EEPROM detection initialisation

Add EEPROM detection initialisation for phyCORE-i.MX8MM and
print SoM information during boot when successful.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
11 months agoboard: phytec: common: phytec_som_detection: Add helper for PCB revision
Teresa Remmet [Thu, 17 Aug 2023 08:57:10 +0000 (10:57 +0200)] 
board: phytec: common: phytec_som_detection: Add helper for PCB revision

Add helper function to read out the PCB revision of a PHYTEC SoM.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
11 months agoboard: phytec: phycore_imx8mp: Update 2GB RAM Timings
Teresa Remmet [Thu, 17 Aug 2023 08:57:09 +0000 (10:57 +0200)] 
board: phytec: phycore_imx8mp: Update 2GB RAM Timings

Due to PCB layout constraints in PCB revisions until including 1549.2,
a RAM frequency of 2 GHz can cause rare instabilities. Set the RAM
frequency to 1.5 GHz to achieve a stable system under all conditions.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
11 months agoboard: phytec: common: Add imx8m specific EEPROM detection support
Teresa Remmet [Thu, 17 Aug 2023 08:57:07 +0000 (10:57 +0200)] 
board: phytec: common: Add imx8m specific EEPROM detection support

Add imx8m specific detection part. Which includes checking the
EEPROM data for article number options.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
11 months agoboard: phytec: Add common PHYTEC SoM detection
Teresa Remmet [Thu, 17 Aug 2023 08:57:06 +0000 (10:57 +0200)] 
board: phytec: Add common PHYTEC SoM detection

Recent shipped PHYTEC SoMs come with an i2c  EEPROM containing
information about the hardware such as board revision and variant.
This can be used for RAM detection and loading device tree overlays
during kernel start.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Reviewed-by: Yannic Moog <y.moog@phytec.de>
Tested-by: Yannic Moog <y.moog@phytec.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
11 months agoarm: mvebu: sata_mv: Add bootstd hook to enable sata_bootdev
Tony Dinh [Wed, 6 Sep 2023 05:22:41 +0000 (22:22 -0700)] 
arm: mvebu: sata_mv: Add bootstd hook to enable sata_bootdev

Add hook in sata_mv probe to enable bootstd bootdev.

Note: bootdev_setup_for_sibling_blk() invocation is a noop if bootsd is
not enabled for ahci sata yet.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>