]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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.

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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)

14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 months agoarm: kirkwood: Add support for ZyXEL NSA325 board
Tony Dinh [Sat, 26 Aug 2023 03:33:29 +0000 (20:33 -0700)]
arm: kirkwood: Add support for ZyXEL NSA325 board

ZyXEL NSA325 specifications:

Marvell Kirkwood 88F6282 SoC
1.6 GHz CPU
1x GBE LAN port (Marvell MV88E1318)
512 MB RAM
128 MB Eon NAND, SLC
I2C
1x USB 3.0 (on PCIe bus)
2x USB 2.0
2x SATA (hot swap slots)
Serial console

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
14 months agoARM64: dts: marvell: cn9310-crb: Remove duplicate pinctrl
Chris Packham [Sun, 20 Aug 2023 23:31:05 +0000 (11:31 +1200)]
ARM64: dts: marvell: cn9310-crb: Remove duplicate pinctrl

The cn9130.dtsi defines a pinctrl node for SPI1 (until recently it was
mislabeled as spi0). Use this instead of having a duplicate definition
with a different label.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
14 months agoARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins
Chris Packham [Sun, 20 Aug 2023 23:31:04 +0000 (11:31 +1200)]
ARM64: dts: marvell: cn9310: Use appropriate label for spi1 pins

The CN9130-DB uses the SPI1 interface but had the pinctrl node labelled
as "cp0_spi0_pins". Use the label "cp0_spi1_pins" and update the node
name to "cp0-spi-pins-1" to avoid confusion with the pinctrl options for
SPI0.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
14 months agokirkwood: dns325: Enable 2nd harddrive
Stefan Roese [Fri, 11 Aug 2023 08:02:04 +0000 (10:02 +0200)]
kirkwood: dns325: Enable 2nd harddrive

The 2nd HD is not enabled in U-Boot on the D-Link DNS325. This patch
sets the responsible GPIO to high, enabling the drive.

Suggested-by: Peter Granilla
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tony Dinh <mibodhi@gmail.com>
14 months agotoradex: verdin-imx8mm/imx8mp: Remove bootcmd_mfg
Joao Paulo Goncalves [Wed, 4 Oct 2023 19:13:58 +0000 (16:13 -0300)]
toradex: verdin-imx8mm/imx8mp: Remove bootcmd_mfg

The bootcmd_mfg env variable is legacy from IMX downstream u-boot branch
and is not needed on mainline.

Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
14 months agosmegw01: Remove misuse of CONFIG_ENV_IS_NOWHERE
Eduard Strehlau [Tue, 10 Oct 2023 14:14:12 +0000 (11:14 -0300)]
smegw01: Remove misuse of CONFIG_ENV_IS_NOWHERE

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

Remove unnecessary misuse of CONFIG_ENV_IS_NOWHERE as default environment.

Based on the fix done by commit b16fd7f75f6d ("imx6q: acc: Remove misuse
of env is nowhere driver").

Signed-off-by: Eduard Strehlau <eduard@lionizers.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
14 months agomx28evk: Add USB Mass Storage support
Fabio Estevam [Mon, 9 Oct 2023 13:15:36 +0000 (10:15 -0300)]
mx28evk: Add USB Mass Storage support

Select the USB options to allow running "ums 0 mmc 0".

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
14 months agousb: ehci: mxs: Use regulator_set_enable_if_allowed()
Fabio Estevam [Mon, 9 Oct 2023 13:15:35 +0000 (10:15 -0300)]
usb: ehci: mxs: Use regulator_set_enable_if_allowed()

Since commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable() may be EALREADY or
EBUSY for fixed/GPIO regulators.

Switch to using the more relaxed regulator_set_enable_if_allowed() to
continue if regulator already was enabled or disabled.

This fixes the following error when running the 'ums' command:

=> ums 0 mmc 0
UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0xece000
Error enabling VBUS supply
g_dnl_register: failed!, error: -114
g_dnl_register failed

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
14 months agousb: ehci: mxs: Fix the USB node pointer retrieval
Fabio Estevam [Mon, 9 Oct 2023 13:15:34 +0000 (10:15 -0300)]
usb: ehci: mxs: Fix the USB node pointer retrieval

Use dev_ofnode() to retrieve the USB node pointer from the udevice
structure.

This fixes the following build error:

drivers/usb/host/ehci-mxs.c:143:38: error: 'struct udevice' has no member named 'node_'

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
14 months agoarm: mach-imx: Makefile: Extend u-boot-nand.imx padding
Hiago De Franco [Tue, 3 Oct 2023 21:26:54 +0000 (18:26 -0300)]
arm: mach-imx: Makefile: Extend u-boot-nand.imx padding

Extend the padding process of u-boot-nand.imx target by adding 10k bytes
of zeros to the end of the binary using the 'dd' command.

The existing padding method did not generate a functional binary,
as discussed in more detail in this thread [1]. Instead, we adopt the
end-padding calculation method documented in 'board/doc/colibri_imx7.rst'
as a reference, which is relevant for iMX7 with NAND storage.

Adding 10k bytes of zeros provides an approximate value that makes the
proper padding for these NAND devices.

[1] https://lore.kernel.org/all/CAC4tdFUqffQzRQFv5AGe_xtbFy1agr2SEpn_FzEdexhwjdryyw@mail.gmail.com/

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
14 months agotoradex: colibri_imx7: Enable nand/emmc detection and set boot variant
Hiago De Franco [Mon, 2 Oct 2023 11:57:49 +0000 (08:57 -0300)]
toradex: colibri_imx7: Enable nand/emmc detection and set boot variant

Add detection of eMMC vs NAND devices on the Colibri iMX7
board. A GPIO is configured to detect the presence of an on-board resistor
that is configured differently based on the flash memory used. Depending on
the detection result, the 'variant' environment variable is set to '-emmc'
or cleared, indicating the type of storage device.

This enhancement improves variant detection during system initialization
through USB recovery mode, where U-Boot is loaded directly to RAM. This
allows variant detection for an accurate device tree selection.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
14 months agoboard: toradex: verdin-imx8mm: set fixed LPDDR4 refresh rate as per errata ERR050805
Andrejs Cainikovs [Thu, 28 Sep 2023 14:39:33 +0000 (16:39 +0200)]
board: toradex: verdin-imx8mm: set fixed LPDDR4 refresh rate as per errata ERR050805

Update lpddr4 configuration and training using updated spreadsheet and
tools from NXP using data from previous spreadsheet and verified
toward datasheet:

- MX8M_Mini_LPDDR4_RPA_v22.xlsx
- mscale_ddr_tool_v3.31_setup.exe

The most relevant update is related to errata ERR050805:
"DRAM: Controller automatic derating logic may not work when
the LPDDR4 memory temperature is above 85 °C at initialization"

Other relevant fixes:
- DRAMTMG7 register: corrected calculation of T_CKPDX parameter
  (equal to tCKCKEH for LPDDR4)
- RANKCTL register: corrected calculations for ODTLon and ODTLoff
  to follow the JEDEC specification
- ADDRMAP7 register: added support for 17-row devices

As per errata ERR050805:

An issue exists with the automatic derating logic of the DDR
controller that only samples the LPDDR4 MR4 register when the
Temperature Update Flag (TUF) field (MR4[7] ) is 1’b1. If the
LPDDR4 memory is initialized and starts operation above 85 °C
(MR4[2:0] > 3’b011), the MR4 Temperature Update Flag (TUF) will
not be set. The DDR Controller will therefore not automatically
adjust the memory refresh rate or de-rate memory timings based
on the LPDDR4 memory temperature. This may cause the controller
incorrectly setting the refresh period, potentially cause the
LPDDR4 memory losing data contents and lead to possible data
integrity issues above 85 °C.

Errata provides three possible workaround options, while option 2
is the most reasonable:

Disable the automatic derating logic of the DDR controller and
apply fixed x2 refresh rate (0.5x refresh). This option is
suitable for designs that are expected to boot at or above 85 °C
and memory’s MR4[2:0] (Refresh Rate) DOES NOT report the following
conditions:
3b101: 0.25x refresh, no de-rating
3b110: 0.25x refresh, with de-rating
3b111: SDRAM High temperature operating limit exceeded

[1]: https://www.nxp.com/docs/en/errata/IMX8MM_0N87W.pdf

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
14 months agousbarmory: Add DM_I2C and DM_SERIAL support
Andrej Rosano [Thu, 21 Sep 2023 08:29:56 +0000 (08:29 +0000)]
usbarmory: Add DM_I2C and DM_SERIAL support

Use DM_I2C and DM_SERIAL as it is now mandatory.

Signed-off-by: Andrej Rosano <andrej.rosano@withsecure.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
14 months agomx8m: csf.sh: pad csf blob for u-boot.itb to CSF_SIZE minus IVT header
Rasmus Villemoes [Wed, 20 Sep 2023 10:33:52 +0000 (12:33 +0200)]
mx8m: csf.sh: pad csf blob for u-boot.itb to CSF_SIZE minus IVT header

When built with CONFIG_IMX_HAB, the full FIT image, including stuff
tacked on beyond the end of the fdt structure, is expected to be (fdt
size rounded up to 0x1000 boundary)+CONFIG_CSF_SIZE.

Now, when the FIT image is loaded from a storage device, it doesn't
really matter that the flash.bin that gets written to target isn't
quite that big - we will just load some garbage bytes that are never
read or used for anything. But when flash.bin is uploaded via uuu,
it's important that we actually serve at least as many bytes as the
target expects, or we will hang in rom_api_download_image().

Extend the logic in the csf.sh script so that the csf blob is padded
to CONFIG_CSF_SIZE minus the size of the IVT header.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
14 months agoimx: spl_imx_romapi.c: remove dead code
Rasmus Villemoes [Tue, 19 Sep 2023 13:49:32 +0000 (15:49 +0200)]
imx: spl_imx_romapi.c: remove dead code

These IS_ENABLED(CONFIG_SPL_LOAD_FIT) cases can no longer be reached,
and thus get_fit_image_size() is also redundant.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoimx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size
Rasmus Villemoes [Tue, 19 Sep 2023 13:49:31 +0000 (15:49 +0200)]
imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size

Currently, spl_imx_romapi uses a somewhat tricky workaround for the
fact that a FIT image with external data doesn't directly allow one to
know the full size of the file: It does a dummy spl_load_simple_fit(),
having the ->read callback remember the largest offset requested, and
then does a last call to rom_api_download_image() to fetch the
remaining part of the full FIT image.

We can avoid that by just keeping track of how much we have downloaded
already, and if the ->read() requests something outside the current
valid buffer, fetch up to the end of the current request.

The current method also suffers from not working when CONFIG_IMX_HAB
is enabled: While in that case u-boot.itb is not built with external
data, so the fdt header does contain the full size of the dtb
structure. However, it does not account for the extra CONFIG_CSF_SIZE
added by board_spl_fit_size_align(). And also, the data it hands out
during the first dummy spl_load_simple_fit() is of course garbage, and
wouldn't pass the verification.

So we really need to call spl_load_simple_fit() only once, let that
figure out just how big the FIT image is (including whatever data, CSF
or "ordinary" external data, has been tacked on beyond the fdt
structure), and always provide valid data from the ->read callback.

This only affects the CONFIG_SPL_LOAD_FIT case - I don't have any
hardware or experience with the CONFIG_SPL_LOAD_IMX_CONTAINER case, so
I leave that alone for now.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoimx8mp: binman: rename spl and u-boot nodes
Rasmus Villemoes [Tue, 19 Sep 2023 09:28:47 +0000 (11:28 +0200)]
imx8mp: binman: rename spl and u-boot nodes

The hab signing script doc/imx/habv4/csf_examples/mx8m/csf.sh does

  fdtget -t x u-boot.dtb /binman/imx-boot/uboot offset

to figure out the offset of u-boot.itb inside flash.bin. That works
fine for imx8mm, imx8mn, imx8mq, but fails for imx8mp because in that
case 'uboot' is merely a label and not actually the node name.

Homogenize these cases and make imx8mp the same as the other imx8m*
variants. The binman type is explicitly given and no longer derived
from the node name, and the csf.sh script will work for all four SOCs.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoverdin-imx8mp: drop unused tdx easy installer ifdef
Hiago De Franco [Mon, 4 Sep 2023 13:24:37 +0000 (10:24 -0300)]
verdin-imx8mp: drop unused tdx easy installer ifdef

Drop unused code related to CONFIG_TDX_EASY_INSTALLER, that existed only on
toradex downstream branch.

Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoimx: hab: Use CONFIG_SPL_LOAD_FIT_ADDRESS in the CSF example
Marek Vasut [Thu, 31 Aug 2023 14:56:03 +0000 (16:56 +0200)]
imx: hab: Use CONFIG_SPL_LOAD_FIT_ADDRESS in the CSF example

The SPL authenticates image starting from CONFIG_SPL_LOAD_FIT_ADDRESS
address, update the csf_fit.txt to match.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoarm: imx: imx8m: add optee configuration to ft_system_setup
Tim Harvey [Thu, 24 Aug 2023 19:05:17 +0000 (12:05 -0700)]
arm: imx: imx8m: add optee configuration to ft_system_setup

If optee is detected configure it in the Linux device-tree:
 - add /firmware/optee node
 - add /reserved-memory nodes for optee_core and optee_shm

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
14 months agoarm: dts: imx8m: move CAAM nodes into common u-boot.dtsi
Tim Harvey [Thu, 24 Aug 2023 19:03:56 +0000 (12:03 -0700)]
arm: dts: imx8m: move CAAM nodes into common u-boot.dtsi

Move the crypto and sec_jr* nodes from board-specific
u-boot.dtsi files into the common files. Additionally protect the
nodes with ifdef CONFIG_FSL_CAAM as they don't serve any purpose if
that is not enabled.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
14 months agoarm: dts: imx8mn: protect the firmware/optee node with ifdef
Tim Harvey [Thu, 24 Aug 2023 19:01:44 +0000 (12:01 -0700)]
arm: dts: imx8mn: protect the firmware/optee node with ifdef

There is no need to include the firmware/optee node if the optee
driver is not enabled.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoarm: dts: imx8mp: move firmware/optee node to common imx8mp-u-boot.dtsi
Tim Harvey [Thu, 24 Aug 2023 19:01:43 +0000 (12:01 -0700)]
arm: dts: imx8mp: move firmware/optee node to common imx8mp-u-boot.dtsi

Move the firmware/optee node to the common imx8mp-u-boot.dtsi and
protect it with an ifdef CONFIG_OPTEE as it is a meaningless node
without the optee driver enabled.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
14 months agoarm: dts: imx8mm: move firmware/optee node to common imx8mm-u-boot.dtsi
Tim Harvey [Thu, 24 Aug 2023 19:01:42 +0000 (12:01 -0700)]
arm: dts: imx8mm: move firmware/optee node to common imx8mm-u-boot.dtsi

Move the firmware/optee node to the common imx8mm-u-boot.dtsi and
protect it with an ifdef CONFIG_OPTEE as it is a meaningless node
without the optee driver enabled.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
14 months agoboard: toradex: verdin-imx8mm: enable usb sdp spl recovery support
Marcel Ziswiler [Tue, 22 Aug 2023 22:17:25 +0000 (00:17 +0200)]
board: toradex: verdin-imx8mm: enable usb sdp spl recovery support

Enable USB SDP SPL aka serial downloader recovery mode support.

While at it also enable fastboot support which may be used to
subsequently load further stages like a Toradex Easy Installer FIT
image.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>