]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 months agoi2c: pca954x: Remove pointer to GD
Michal Simek [Thu, 1 Aug 2024 07:41:25 +0000 (09:41 +0200)]
i2c: pca954x: Remove pointer to GD

There is no reason to have any pointer to GD that's why remove it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 months agoMerge tag 'u-boot-nand-20240808' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Thu, 8 Aug 2024 13:59:47 +0000 (07:59 -0600)]
Merge tag 'u-boot-nand-20240808' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash

This series adds support for the UBI block device, which allows to read/write
data block by block. The series was tested by Alexey Romanov on SPI NAND.

The patches pass the pipeline CI:
https://source.denx.de/u-boot/custodians/u-boot-nand-flash/-/pipelines/21933

4 months agospinand: bind UBI block
Alexey Romanov [Thu, 18 Jul 2024 05:45:28 +0000 (08:45 +0300)]
spinand: bind UBI block

UBI block is virtual block device, which is an abstraction
over MTD layer. Therefore it is logical to use it in combination
with MTD drivers.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agodisk: support UBI partitions
Alexey Romanov [Thu, 18 Jul 2024 05:45:27 +0000 (08:45 +0300)]
disk: support UBI partitions

UBI partition is abstraction over UBI volumes.
Can be used by UBI block device.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agodisk: don't try search for partition type if already set
Alexey Romanov [Thu, 18 Jul 2024 05:45:26 +0000 (08:45 +0300)]
disk: don't try search for partition type if already set

Block devices can already set partition type at initialization
stage, so, in this case is no point in searching for partition type.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agodrivers: introduce UBI block abstraction
Alexey Romanov [Thu, 18 Jul 2024 05:45:25 +0000 (08:45 +0300)]
drivers: introduce UBI block abstraction

UBI block is an virtual device, that runs on top
of the MTD layer. The blocks are UBI volumes.
Intended to be used in combination with other MTD
drivers.

Despite the fact that it, like mtdblock abstraction,
it used with UCLASS_MTD, they can be used together
on the system without conflicting. For example,
using bcb command:

  # Trying to load bcb via mtdblock:
  $ bcb load mtd 0 mtd_partition_name

  # Trying to load bcb via UBI block:
  $ bcb load ubi 1 ubi_volume_name

User always must attach UBI layer (for example, using
ubi_part()) before using UBI block device.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agoubi: allow to write to volume with offset
Alexey Romanov [Thu, 18 Jul 2024 05:45:24 +0000 (08:45 +0300)]
ubi: allow to write to volume with offset

Introduce ubi_volume_offset_write() helper, which
allow to write to ubi volume with specified offset.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agoubi: allow to read from volume with offset
Alexey Romanov [Thu, 18 Jul 2024 05:45:23 +0000 (08:45 +0300)]
ubi: allow to read from volume with offset

Now user can pass an additional parameter 'offset'
to ubi_volume_read() function.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agospinand: bind mtdblock
Alexey Romanov [Thu, 18 Jul 2024 05:46:06 +0000 (08:46 +0300)]
spinand: bind mtdblock

Bind SPI-NAND driver to MTD block driver.

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agodrivers: introduce mtdblock abstraction
Alexey Romanov [Thu, 18 Jul 2024 05:46:05 +0000 (08:46 +0300)]
drivers: introduce mtdblock abstraction

MTD block - abstraction over MTD subsystem, allowing
to read and write in blocks using BLK UCLASS.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agodisk: support MTD partitions
Alexey Romanov [Thu, 18 Jul 2024 05:46:04 +0000 (08:46 +0300)]
disk: support MTD partitions

Add new MTD partition driver, which can be useful with
mtdblock driver combination.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Tue, 6 Aug 2024 15:36:46 +0000 (09:36 -0600)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

This updates the "old style" DTs to that of Linux v6.10, matching what
OF_UPSTREAM is at now. Hopefully we won't need to do this (manually)
anymore. Since this brings in the DT for a new board (Tanix TX1), also
add the defconfig for that, which has just been waiting for that sync.
There are three more fixes: two for the SPI clock setup, which avoids
too high frequencies in some cases, and one fix to avoid a build warning
with GCC 14 for the sunxi TOC0 part of the mkimage tool.

The gitlab CI passed, and I tested the SPI flash on the OrangePi Zero 3
and also booted that into Linux.

4 months agoMerge tag 'xilinx-for-v2024.10-rc2' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 6 Aug 2024 13:17:11 +0000 (07:17 -0600)]
Merge tag 'xilinx-for-v2024.10-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

AMD/Xilinx changes for v2024.10-rc2

amd/xilinx:
- Enable CONFIG_MMC_SPEED_MODE_SET

env:
- support overriding spi dev from board code

clk:
- Add set_rate support for display clocks

spi:
- Describe is25lp01gg flash

zynq:
- Add support for 7z010_lr and 7z020_lr

zynqmp:
- Add support for zu1eg_lr
- Enable NFS for Kria
- DT changes
- Cleanup firmware handling in board_init()

versal-net:
- Setup spi seq number based on boot device
- dt-schema update for mini configurations

versal2:
- Disable uartlite driver
- Add support for mini configurations
- Enable NFS

4 months agospi: sunxi: fix clock divider calculation for max frequency setting
Michael Walle [Thu, 18 Jul 2024 20:42:53 +0000 (22:42 +0200)]
spi: sunxi: fix clock divider calculation for max frequency setting

If the maximum frequency is requested, we still fall into the CDR2
handling. But there the minimal divider is 2. For the sun6i and sun8i we
can do better with the CDR1 setting where the minimal divider is 1:
  SPI_CLK = MOD_CLK / 2 ^ cdr with cdr = 0

Thus, handle the div = 1 case specially.

While at it, correct the comment above the calculation.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
4 months agospi: sunxi: fix CDR2 calculation
Michael Walle [Thu, 18 Jul 2024 20:42:52 +0000 (22:42 +0200)]
spi: sunxi: fix CDR2 calculation

The CDR2 divider calculation always yield a frequency greater than the
requested one. Use DIV_ROUND_UP() to keep the frequency equal or below
the requested one. This way, we can also drop the "if div > 0" check
because we know for a fact that div cannot be zero.

FWIW, this aligns the CDR2 calculation with the linux driver.

Suggested-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
4 months agosunxi: h616: add Tanix TX1 support
Andre Przywara [Mon, 25 Mar 2024 21:58:39 +0000 (21:58 +0000)]
sunxi: h616: add Tanix TX1 support

The Tanix TX1 is a tiny TV box, featuring the Allwinner H313 SoC with up
to 2GB of DRAM and 16GB of eMMC. There is no SD card or Ethernet port on
this small device, but it can be booted via the USB debug "FEL" mode.
The bootloader could then be written to the eMMC.

Add the defconfig for that board, and add the devicetree file to the
Makefile, for it to be built.
The DRAM parameters were taken from the vendor firmware on the eMMC.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 months agoPrepare v2024.10-rc2
Tom Rini [Tue, 6 Aug 2024 00:13:42 +0000 (18:13 -0600)]
Prepare v2024.10-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
4 months agosunxi: dts: arm/arm64: update devicetree files from Linux-v6.10
Andre Przywara [Fri, 19 Apr 2024 16:59:52 +0000 (17:59 +0100)]
sunxi: dts: arm/arm64: update devicetree files from Linux-v6.10

Sync the devicetree files from the official Linux kernel tree, v6.10.
This is covering Allwinner SoCs with 32-bit and 64-bit ARM cores.

Besides mostly cosmectic changes, this adds cpufreq support to H616
boards, Nothing that U-Boot needs for itself, but helpful to pass on
to kernels. We also get the .dts files for the Tanix TX1 TV box and
three Anbernic handheld gaming devices.

As before, this omits the non-backwards compatible changes to the R_INTC
controller, to remain compatible with older kernels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 months agotools: imagetool: Remove unnecessary check from toc0_verify_cert_item()
Seung-Woo Kim [Thu, 1 Aug 2024 01:01:00 +0000 (10:01 +0900)]
tools: imagetool: Remove unnecessary check from toc0_verify_cert_item()

C99 introduced the possibility to mark function parameters declared as
arrays with an extra keyword "static":
void foo(uint8_t digest[static SHA256_DIGEST_LENGTH]);
This requires the respective function argument to be at least as large
as specified. Passing in random pointers (like NULL) then becomes
undefined behaviour, and compilers warn about this.
Newer GCC compilers (starting with GCC 14) will also automatically mark
those parameters as "nonnull", and thus warn if a (redundant) NULL check
is done inside the function:
tools/sunxi_toc0.o tools/sunxi_toc0.c
tools/sunxi_toc0.c: In function 'toc0_verify_cert_item':
tools/sunxi_toc0.c:447:12: warning: 'nonnull' argument 'digest' compared to NULL [-Wnonnull-compare]
  447 |         if (digest && memcmp(&extension->digest, digest, SHA256_DIGEST_LENGTH)) {
      |            ^

Remove the unnecessary NULL check from toc0_verify_cert_item(), to avoid
the warning.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
[Andre: extend commit message]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
4 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 5 Aug 2024 18:21:23 +0000 (12:21 -0600)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 months agoMerge patch series "Bug-fixes for a few boards"
Tom Rini [Mon, 5 Aug 2024 18:15:44 +0000 (12:15 -0600)]
Merge patch series "Bug-fixes for a few boards"

Simon Glass <sjg@chromium.org> says:

This series includes fixes to get some rockchip and nvidia boards
working again. It also drops the broken Beaglebone Black config and
provides a devicetree fix for coral (x86).

4 months agorockchip: Avoid #ifdefs in RK3399 SPL
Simon Glass [Thu, 1 Aug 2024 12:47:23 +0000 (06:47 -0600)]
rockchip: Avoid #ifdefs in RK3399 SPL

The code here is confusing due to large blocks which are #ifdefed out.
Add a function phase_sdram_init() which returns whether SDRAM init
should happen in the current phase, using that as needed to control the
code flow.

This increases code size by about 500 bytes in SPL when the cache is on,
since it must call the rather large rockchip_sdram_size() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agorockchip: Ensure memory size is available in RK3399 SPL
Simon Glass [Thu, 1 Aug 2024 12:47:22 +0000 (06:47 -0600)]
rockchip: Ensure memory size is available in RK3399 SPL

At present gd->ram_size is 0 in SPL, meaning that it is not possible to
enable the cache. Correct this by always populating the RAM size
correctly.

This increases code size by about 500 bytes in SPL, since it must call
the rather large rockchip_sdram_size() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
4 months agofdt: Correct condition for bloblist existing
Simon Glass [Wed, 31 Jul 2024 14:49:05 +0000 (08:49 -0600)]
fdt: Correct condition for bloblist existing

On some boards, the bloblist is created in SPL once SDRAM is ready. It
cannot be accessed until that point, so is not available early in SPL.

Add a condition to avoid a hang in this case.

This fixes a hang in chromebook_coral

Fixes: 70fe2385943 ("fdt: Allow the devicetree to come from a bloblist")
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Raymond Mao <raymond.mao@linaro.org>
4 months agobinman: Keep the efi_capsule input file
Simon Glass [Wed, 31 Jul 2024 14:49:04 +0000 (08:49 -0600)]
binman: Keep the efi_capsule input file

There is no need to remove input files. It makes it harder to diagnose
failures. Keep the payload file.

There is no test for this condition, but one could be added.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
4 months agobinman: Return failure when a usage() message is generated
Simon Glass [Wed, 31 Jul 2024 14:49:03 +0000 (08:49 -0600)]
binman: Return failure when a usage() message is generated

The tool must return an error code when invalid arguments are provided,
otherwise binman has no way of knowing that anything went wrong.

Correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: fab430be2f4 ("tools: add mkeficapsule command for UEFI...")
4 months agobinman: Deal with mkeficapsule being missing
Simon Glass [Wed, 31 Jul 2024 14:49:02 +0000 (08:49 -0600)]
binman: Deal with mkeficapsule being missing

Tools cannot be assumed to be present. Add a check for this with the
mkeficpasule tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: b617611b27a ("binman: capsule: Add support for generating...")
4 months agobinman: Collect the version number for mkeficapsule
Simon Glass [Wed, 31 Jul 2024 14:49:01 +0000 (08:49 -0600)]
binman: Collect the version number for mkeficapsule

Now that this tool has a version number, collect it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agomkeficapsule: Add a --version argument
Simon Glass [Wed, 31 Jul 2024 14:49:00 +0000 (08:49 -0600)]
mkeficapsule: Add a --version argument

Tools should have an option to obtain the version, so add this to the
mkeficapsule tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 months agosoc: zynqmp: Add support for zu1eg_lr device
Michal Simek [Tue, 30 Jul 2024 14:53:23 +0000 (16:53 +0200)]
soc: zynqmp: Add support for zu1eg_lr device

There is new chip coming which is using new _lr suffix that's why record it
in the list to enable bitstream in bit format loading.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/12a939e2c88e82a9828852a8f7f33dfa14a6a4b8.1722351201.git.michal.simek@amd.com
4 months agoARM: zynq: Add support for 7z010_lr and 7z020_lr
Michal Simek [Tue, 30 Jul 2024 13:50:17 +0000 (15:50 +0200)]
ARM: zynq: Add support for 7z010_lr and 7z020_lr

Add support for *_lr SOCs. Without this change chips are not going to be
properly identified and bitstream programming won't work.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/14d8905a89d1b31fbb2318512cf57eb0256c11be.1722347416.git.michal.simek@amd.com
4 months agoarm64: zynqmp: Remove PM firmware checking
Michal Simek [Tue, 30 Jul 2024 10:42:43 +0000 (12:42 +0200)]
arm64: zynqmp: Remove PM firmware checking

Having zynqmp firmware is actually only one valid configuration. In QEMU
case for example there is no PMU that's why this checking can't end up in
panic that's why code remove this code completely.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/05b8bbf0686c72f86ea7f8bfe0da250ddba9e211.1722336162.git.michal.simek@amd.com
4 months agoarm64: zynqmp: Fix pwm-fan polarity
Vishal Patel [Mon, 29 Jul 2024 08:18:18 +0000 (10:18 +0200)]
arm64: zynqmp: Fix pwm-fan polarity

The correct operating mode for the fan is inversed (1). The
previous pwm driver implementation had a bug and the polarity
information was propagated incorrectly to the kernel. The normal (0)
polarity specified in the device tree was incorrectly clearing the
polarity bit in the counter control register. After the bug fix,
setting the polarity to inversed (1) in the device tree will clear
the polarity bit.

Signed-off-by: Vishal Patel <vishal.patel@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/4658ae8576882f5d28ad57ca74a7b798a546ec37.1722241096.git.michal.simek@amd.com
4 months agoarm64: zynqmp: dts: Add rts delay property for rs485 mode on KD240
Manikanta Guntupalli [Thu, 18 Jul 2024 10:15:23 +0000 (12:15 +0200)]
arm64: zynqmp: dts: Add rts delay property for rs485 mode on KD240

Add "rs485-rts-delay" property to uartps node with delay_rts_before_send
and delay_rts_after_send values as 10ms for rs485 mode on KD240.

10ms rts delay values have been chosen based on testing with rs485
temperature sensor (which is part of the kit) as safe minimum value
for reliable operation at a baud rate of 9600.

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/0e0c4c067236e11f661c1d067017e1ca975c9ddb.1721297721.git.michal.simek@amd.com
4 months agoarm64: xilinx: Describe TPM reset for Kria CCs
Michal Simek [Tue, 16 Jul 2024 13:29:09 +0000 (15:29 +0200)]
arm64: xilinx: Describe TPM reset for Kria CCs

Describe carrier card TPM reset behavior and show message about it on boot
console to let users know what to expect from it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2c0cb3a2b27a3bf0ede75c5ccded2d086d9c62b0.1721136547.git.michal.simek@amd.com
4 months agoarm64: versal: Remove undocumented cadence,qspi compatible
Michal Simek [Mon, 15 Jul 2024 14:39:11 +0000 (16:39 +0200)]
arm64: versal: Remove undocumented cadence,qspi compatible

Compatible string is not the part of dt-schema and also not used by U-Boot
or Linux that's why remove it completely.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/13ccfe6b447c426aad06edbf0b8e52fd1eb97ee3.1721054349.git.michal.simek@amd.com
4 months agoarm64: versal-net: Align node names with dt-schema
Michal Simek [Mon, 15 Jul 2024 14:38:30 +0000 (16:38 +0200)]
arm64: versal-net: Align node names with dt-schema

dt-schema is forcing some rules for node names that's why align them with
it. Labels are not changing that's why this change is not breaking any
other board specific DTSes.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/102d9499e9bab12f89dbf9ceaa49a11d685146b3.1721054306.git.michal.simek@amd.com
4 months agoarm64: zynqmp: Add resets property for UART nodes
Manikanta Guntupalli [Mon, 15 Jul 2024 14:23:43 +0000 (16:23 +0200)]
arm64: zynqmp: Add resets property for UART nodes

Add resets property for UART0 and UART1 nodes

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/81c602417a5d28dfbce122b2e5a63ff7ddb74594.1721053421.git.michal.simek@amd.com
4 months agoamd: Enable the NFS command for Versal Gen 2
Prasad Kummari [Thu, 11 Jul 2024 16:57:35 +0000 (22:27 +0530)]
amd: Enable the NFS command for Versal Gen 2

Enabled the default utilization of the NFS command on Versal Gen 2
platform to facilitate booting images through the network using
the NFS protocol

Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
Link: https://lore.kernel.org/r/20240711165734.1561933-1-prasad.kummari@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoxilinx: Enable the NFS command for zynqmp_kria
Prasad Kummari [Tue, 9 Jul 2024 04:22:33 +0000 (09:52 +0530)]
xilinx: Enable the NFS command for zynqmp_kria

Enabled the default utilization of the NFS command on ZynqMP Kria
platforms to facilitate booting images through the network using
the NFS protocol.

Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
Link: https://lore.kernel.org/r/20240709042232.860395-1-prasad.kummari@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoarm64: config: Add versal2 mini emmc defconfig
Venkatesh Yadav Abbarapu [Wed, 19 Jun 2024 07:17:33 +0000 (12:47 +0530)]
arm64: config: Add versal2 mini emmc defconfig

Add versal2 mini emmc configuration.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240619071733.10256-5-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoarm64: Add versal2 mini ospi support
Venkatesh Yadav Abbarapu [Wed, 19 Jun 2024 07:17:32 +0000 (12:47 +0530)]
arm64: Add versal2 mini ospi support

Add versal2 mini ospi configuration.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240619071733.10256-4-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoarm64: Add versal2 mini qspi support
Venkatesh Yadav Abbarapu [Wed, 19 Jun 2024 07:17:31 +0000 (12:47 +0530)]
arm64: Add versal2 mini qspi support

Add versal2 mini qspi configuration.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240619071733.10256-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoarm64: versal2: Add support for mini configuration
Venkatesh Yadav Abbarapu [Wed, 19 Jun 2024 07:17:30 +0000 (12:47 +0530)]
arm64: versal2: Add support for mini configuration

Versal2 mini configuration is designed for running memory test.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240619071733.10256-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoxilinx: versal-net: Handle spi seq number based on boot device
Venkatesh Yadav Abbarapu [Fri, 14 Jun 2024 12:48:11 +0000 (18:18 +0530)]
xilinx: versal-net: Handle spi seq number based on boot device

Versal NET boards has QSPI and OSPI and default bus set to 0
is not working when system is booting out of OSPI which is
controller 1, as fixed aliases are set for all the boards
i.e., QSPI to 0 and OSPI to 1. Add controller autodetection
via spi_get_env_dev().

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240614124811.22945-3-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoenv_spi: support overriding spi dev from board code
Venkatesh Yadav Abbarapu [Fri, 14 Jun 2024 12:48:10 +0000 (18:18 +0530)]
env_spi: support overriding spi dev from board code

This enables boards to choose where to/from the environment
should be saved/loaded. They can then for example support using
the same device (dynamically) from which the bootloader was
launched to load and save env data and do not have to
define CONFIG_ENV_SPI_BUS statically.

In my use case, the environment needs to be on the same device I
booted from. It can be the QSPI or OSPI device.
I therefore would override spi_get_env_dev in the board code,
read the bootmode registers to determine where we booted from
and return the corresponding device index.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240614124811.22945-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com> # Move spi_get_env_dev to sf.c
4 months agomtd: spi-nor: ids: Add IS25LP01GG flash support
Prasad Kummari [Mon, 17 Jun 2024 04:18:42 +0000 (09:48 +0530)]
mtd: spi-nor: ids: Add IS25LP01GG flash support

Add support for ISSI 128MB flash IS25LP01GG. This part
supports 4byte opcodes. It also supports dual and quad
read.

Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20240617041841.1336632-1-prasad.kummari@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoarm64: versal2: Remove UARTLITE from defconfig
Michal Simek [Tue, 18 Jun 2024 13:20:35 +0000 (15:20 +0200)]
arm64: versal2: Remove UARTLITE from defconfig

UARTLITE can be used as console but none is testing it that's why removing
it not to pop up there.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c9b66495bbdef3fe94467ae43c50a74adaaeacae.1718716833.git.michal.simek@amd.com
4 months agoconfig: Enable the config CONFIG_MMC_SPEED_MODE_SET
Venkatesh Yadav Abbarapu [Mon, 8 Jul 2024 09:17:55 +0000 (14:47 +0530)]
config: Enable the config CONFIG_MMC_SPEED_MODE_SET

Enable setting speed mode using mmc dev commands.
The speed mode is provided as the last argument in these commands
(ex: mmc dev 0 0 10) and is indicated using the index from enum
bus_mode in include/mmc.h. A speed mode can be set if it is enabled
from device tree or from capabilities register

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240708091755.5021-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoclk: zynqmp: Add set_rate support for display clocks
Venkatesh Yadav Abbarapu [Thu, 11 Jul 2024 08:29:39 +0000 (13:59 +0530)]
clk: zynqmp: Add set_rate support for display clocks

If "assigned-clock-rates" property is included in the
device tree, display driver probe is getting failed, as dp_video_ref
till dp_stc_ref clocks are missing from set rate function, adding
them to fix the probe failure.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240711082939.29260-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
4 months agoMerge tag 'u-boot-imx-master-20240802' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 2 Aug 2024 20:40:59 +0000 (14:40 -0600)]
Merge tag 'u-boot-imx-master-20240802' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

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

- Convert warp7 to OF_UPSTREAM.
- Add 'cpu' command to imx8m and imx93.
- Enable CMD_ERASEENV for imx8mm/mp Phytec boards.

4 months agoconfig: Adjust Phytec imx8mm module config to support NVME disk
Lukasz Majewski [Fri, 2 Aug 2024 18:12:00 +0000 (15:12 -0300)]
config: Adjust Phytec imx8mm module config to support NVME disk

This change adds support for PCIe connected nvme disk - phyBOARD-Polis
base board.

One needs to call following commands in u-boot:
> pci enum
> nvme scan
> nvme info

And then ones to access proper file system (like fat[ls|load|write],
ext4[ls|load|write]).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
4 months agoconfigs: imx93: enable the 'cpu' command
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:59 +0000 (11:59 +0800)]
configs: imx93: enable the 'cpu' command

Enable the 'cpu' command to display the CPU info and release CPU core to
run baremetal or RTOS applications.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agoconfigs: imx8m: enable the 'cpu' command
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:58 +0000 (11:59 +0800)]
configs: imx8m: enable the 'cpu' command

Enable the 'cpu' command and the depended imx CPU driver to
display the CPU info and release CPU core to run baremetal
or RTOS applications.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agoMAINTAINERS: add entry for cpu command
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:57 +0000 (11:59 +0800)]
MAINTAINERS: add entry for cpu command

Added the original author Simon and myself.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agodoc: cmd: add documentation for cpu command
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:56 +0000 (11:59 +0800)]
doc: cmd: add documentation for cpu command

Add documentation for the 'cpu' command, taking NXP i.MX 8M Plus
as a example.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agocmd: cpu: add release subcommand
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:55 +0000 (11:59 +0800)]
cmd: cpu: add release subcommand

Add a new subcommand 'release' to bring up a core to run baremetal
and RTOS applications.

For example on i.MX8M Plus EVK, release the LAST core to run a RTOS
application, passing the sequence number of the CPU core to release,
here it is 3:
    u-boot=> cpu list
      0: cpu@0      NXP i.MX8MP Rev1.1 A53 at 1200 MHz at 31C
      1: cpu@1      NXP i.MX8MP Rev1.1 A53 at 1200 MHz at 30C
      2: cpu@2      NXP i.MX8MP Rev1.1 A53 at 1200 MHz at 31C
      3: cpu@3      NXP i.MX8MP Rev1.1 A53 at 1200 MHz at 31C

    u-boot=> load mmc 1:2 c0000000 /hello_world.bin
    66008 bytes read in 5 ms (12.6 MiB/s)
    u-boot=> dcache flush; icache flush
    u-boot=> cpu release 3 c0000000
    Released CPU core (mpidr: 0x3) to address 0xc0000000

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agocpu: imx: implement release_core callback
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:54 +0000 (11:59 +0800)]
cpu: imx: implement release_core callback

Release the secondary cores through the PSCI request.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agocpu: imx: Add i.MX 8M series SoCs
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:53 +0000 (11:59 +0800)]
cpu: imx: Add i.MX 8M series SoCs

Add i.MX 8M Mini, Nano and Plus SoCs support.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agocpu: imx: removed the tail '\n' of the CPU description
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:52 +0000 (11:59 +0800)]
cpu: imx: removed the tail '\n' of the CPU description

Return CPU description string without newline character in the end.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agocpu: imx: fix the CPU type field width
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:51 +0000 (11:59 +0800)]
cpu: imx: fix the CPU type field width

Increase one more bit to cover all CPU types. Otherwise it shows
wrong CPU info on some platforms, such as i.MX8M Plus:

    U-Boot 2024.04+g674440bc73e+p0 (Jun 06 2024 - 10:05:34 +0000)

    CPU:   NXP i.MX8MM Rev1.1 A53 at 4154504685 MHz at 30C

    Model: NXP i.MX8MPlus LPDDR4 EVK board

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agocpu: imx: fix the CPU frequency in cpu_imx_get_info()
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:50 +0000 (11:59 +0800)]
cpu: imx: fix the CPU frequency in cpu_imx_get_info()

The cpu_freq stores the current CPU frequency in Hz.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agotest: cpu: add test for release CPU core.
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:49 +0000 (11:59 +0800)]
test: cpu: add test for release CPU core.

Add test for API cpu_release_core().

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agocpu: sandbox: implement release_core callback
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:48 +0000 (11:59 +0800)]
cpu: sandbox: implement release_core callback

Add empty release CPU core function for testing.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agocpu: add release_core callback
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:47 +0000 (11:59 +0800)]
cpu: add release_core callback

Add a new callback release_core to the cpu_ops, which is used to
release a CPU core to run baremetal or RTOS application on a SoC
with multiple CPU cores.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 months agoclk: imx8m: register ARM A53 core clock
Hou Zhiqiang [Thu, 1 Aug 2024 03:59:46 +0000 (11:59 +0800)]
clk: imx8m: register ARM A53 core clock

Register ARM A53 core clock for i.MX 8M Mini, Nano and Plus, preparing
for enabling the 'cpu' command, which depends on this to print CPU core
frequency.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
4 months agoconfigs: phycore-imx8mp_defconfig: enable CMD_ERASEENV
Yannic Moog [Wed, 31 Jul 2024 12:53:03 +0000 (09:53 -0300)]
configs: phycore-imx8mp_defconfig: enable CMD_ERASEENV

Enable erasing environment with eraseenv command.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
4 months agoconfigs: phycore-imx8mm_defconfig: enable CMD_ERASEENV
Yannic Moog [Wed, 31 Jul 2024 07:23:00 +0000 (09:23 +0200)]
configs: phycore-imx8mm_defconfig: enable CMD_ERASEENV

Enable erasing environment with eraseenv command.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
4 months agoconfigs: imx8mm-phygate-tauri-l_defconfig: enable CMD_ERASEENV
Yannic Moog [Wed, 31 Jul 2024 07:22:59 +0000 (09:22 +0200)]
configs: imx8mm-phygate-tauri-l_defconfig: enable CMD_ERASEENV

Enable erasing environment with eraseenv command.

Signed-off-by: Yannic Moog <y.moog@phytec.de>
4 months agowarp7: Convert to OF_UPSTREAM
Fabio Estevam [Mon, 22 Jul 2024 17:59:35 +0000 (14:59 -0300)]
warp7: Convert to OF_UPSTREAM

Instead of using the local imx7s-warp devicetree copies from U-Boot,
convert the imx7s-warp board to OF_UPSTREAM so that the upstream
kernel devicetree can be used instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 months agoclk: clk-uclass: Print clk name in clk_enable/clk_disable
Michael Trimarchi [Tue, 9 Jul 2024 06:28:13 +0000 (08:28 +0200)]
clk: clk-uclass: Print clk name in clk_enable/clk_disable

Print clk name in clk_enable and clk_disable. Make sense to know
what clock get disabled/enabled before a system crash or system
hang.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
4 months agoclk: Revise help text for clk_get_parent_rate()
Alexander Dahl [Fri, 3 May 2024 07:20:09 +0000 (09:20 +0200)]
clk: Revise help text for clk_get_parent_rate()

The function returns the rate of the parent clock, the previous text
made no sense at all.

Fixes: 4aa78300a025 ("dm: clk: Define clk_get_parent_rate() for clk operations")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
4 months agoclk: Fix error message in clk_get_bulk
Jan Kiszka [Sat, 9 Mar 2024 12:27:09 +0000 (13:27 +0100)]
clk: Fix error message in clk_get_bulk

Fix a logical inversion of the printed text.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
4 months agoMerge patch series "clk: mediatek: add OPs to support OF_UPSTREAM"
Tom Rini [Thu, 1 Aug 2024 21:32:54 +0000 (15:32 -0600)]
Merge patch series "clk: mediatek: add OPs to support OF_UPSTREAM"

Christian Marangi <ansuelsmth@gmail.com> says:

This series doesn't currently change anything and it does add all the
additional OPs to make support of OF_UPSTREAM.

While converting the mt7681/7686/7688/7623/7622 it was notice lots of
discrepancy between the downstream dtsi and the upstream one and the
clock ID between downstream clock ID and upstream clock ID.

Upstream reference clock by names and clock are handled by the
CCF (Common Clock Framework). The same can't be used here as we would
quickly reach the max space allocated before relocation.

The current mediatek clock driver reference all the parents and clocks
with offset from the clk ID related to the different tables.

Discrepancy between clock ID and the order in the clocks table cause
one clock referenced for another or even crash for trying to access
a clock at an offset that doesn't exist.

To handle this and permit use of OF_UPSTREAM, various measure and
changes are done to the mediatek clock driver to support it.

This series have all the generic clock changes. Once this is merged,
series for each SoC will came that will just change files in their
dedicated clock driver. This is to prevent massive patch and to
permit to split series, one for each SoC.

As said at the start, these changes doesn't cause regression and are
just expansion to the current API. Current behaviour is saved in every
possible way (aside from the first 2 patch that fixes latent bugs)

4 months agoclk: mediatek: add support for APMIXED parent in infra MUX
Christian Marangi [Fri, 28 Jun 2024 17:40:57 +0000 (19:40 +0200)]
clk: mediatek: add support for APMIXED parent in infra MUX

Add support for APMIXED parent in infra MUX. This is the case for mt7622
that reference APMIXED parents for the MUX1_SEL clock.

We assume the second level parent is always APMIXED.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for GATEs for APMIXED OPs
Christian Marangi [Fri, 28 Jun 2024 17:40:56 +0000 (19:40 +0200)]
clk: mediatek: add support for GATEs for APMIXED OPs

Add support for GATEs for APMIXED OPs. It's possible that some APMIXED
have also gates on top of PLL. This is the case for mt7622. Add support
for this.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: implement MUX_FLAGS and MUX_MIXED_FLAGS macro
Christian Marangi [Fri, 28 Jun 2024 17:40:55 +0000 (19:40 +0200)]
clk: mediatek: implement MUX_FLAGS and MUX_MIXED_FLAGS macro

Some simple MUX might require flags to specify the parent source.
Implement MUX_FLAGS as a variant of the MUX macro that takes custom
flags as last arg.
Also implement MUX_MIXED_FLAGS for PARENT_MIXED implementation and
MUX_MIXED with no additional flags.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for remapping clock ID
Christian Marangi [Fri, 28 Jun 2024 17:40:54 +0000 (19:40 +0200)]
clk: mediatek: add support for remapping clock ID

Upstream kernel linux might have a different clock ID order in their
<soc>-clk.h header. This is the case of some clock ID for mt7623 that
upstream use the shared header clk-mt7601.h

This header doesn't have a well distincted order and have factor or mux
in the middle of the CLK ID list. This is problematic with the mtk clock
driver that expect everything well organized in block and apply offset
to reference the clk in the different array.

To solve this problem, implement in the mtk_clk_tree an additional
option .id_offs_map, an array where each CLK ID can be remapped to what
the driver expect permitting to reorganize the clock following the
expected logic of fixed, factor, mux and gates.

Each clock function is updated to tranparently handle this by first
converting the clk ID to the remapped one.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: provide common clk init function for infrasys
Christian Marangi [Fri, 28 Jun 2024 17:40:53 +0000 (19:40 +0200)]
clk: mediatek: provide common clk init function for infrasys

Provide common clk init function for infrasys that defaults to topckgen
driver if clock-parent is not defined. This is the case for upstream
DTSI that doesn't provide this entry.

This is needed for infracfg driver that will make use of the unified
gates + muxes implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for gate clock to reference topckgen clock
Christian Marangi [Fri, 28 Jun 2024 17:40:52 +0000 (19:40 +0200)]
clk: mediatek: add support for gate clock to reference topckgen clock

Add support for gate clock get_rate to reference topckgen clock for
infracfg-ao implementation.

In infracfg-ao implementation topckgen is on second level of parent with
infracfg in the middle.
To correctly detect this, check the driver of the dev parent and use the
second level parent if it's not mtk_clk_topckgen.

Due to all the dependency, parent tree must be filled before a gate is
used, hence is safe to assume it will be there.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for parent mux from different source for topckgen
Christian Marangi [Fri, 28 Jun 2024 17:40:51 +0000 (19:40 +0200)]
clk: mediatek: add support for parent mux from different source for topckgen

As done for infracfg, also add support for parent mux from different
source for topckgen. This is needed as upstream linux doesn't use 1/1
factor and use directly the APMIXED clocks.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for parent mux from different source
Christian Marangi [Fri, 28 Jun 2024 17:40:50 +0000 (19:40 +0200)]
clk: mediatek: add support for parent mux from different source

There is a current limitation where parents for a mux can be all declared
as they are from a common source. This is not true as there are some MUX
that can have parent from both infracfg or from topckgen.

To handle this, implement a new flag for the mux, CLK_PARENT_MIXED, and
a new entry for the mux parent_flags.

To use this, CLK_PARENT_MIXED must be used and parent_flags will be used
instead of the parent variable.

Entry in parent_flags are just a struct of ID and flags where it will be
defined where that parent comes from with the usage of
CLK_PARENT_INFRASYS or CLK_PARENT_TOPCKGEN.

This permits to have MUX with parents from infracfg or topckgen.

Notice that with CLK_PARENT_MIXED applied the CLK_BYPASS_XTAL is
ignored.
With CLK_PARENT_MIXED declare CLK_PARENT_XTAL for the relevant parent
instead.

Also alias for the CLK_PARENT macro are provided to better clear their
usage. CLK_PARENT_MIXED require these alias that describe the clk type
to be defined in the clk_tree flags to prevent clk ID clash from
different subsystem that may have equal clk ID.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for gate ID at offset
Christian Marangi [Fri, 28 Jun 2024 17:40:49 +0000 (19:40 +0200)]
clk: mediatek: add support for gate ID at offset

Add support to clk_gate ops to reference the clk ID at an offset by
using the just introduced gates_offs value from the unified muxes +
gates implementation.

Gate clock that doesn't have gates_offs set won't be affected as the
offset will simply be 0 and won't be offset of any value.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: add support for gates in clk_tree for infrasys
Christian Marangi [Fri, 28 Jun 2024 17:40:48 +0000 (19:40 +0200)]
clk: mediatek: add support for gates in clk_tree for infrasys

Add support for gates in clk_tree for infrasys ops.

Infracfg clks can have a sum of gates and muxes, and current solution
handle this by duplicating the driver and split clks for mux and clks
for gates. Upstream linux kernel handle this differently and doesn't
have this distinction.

To be closer to the upstream kernel clock definition, implement
additional logic to have gates defined in the clk_tree and implement
variant for the infrasys ops to handle gates defined in the tree.

Similar to how it's done with factor and mux, we introduce gates_offs.
Upstream kernel follow the similar logic with all the ID defined as
FDIVS, MUXES and finally GATES.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: return XTAL rate for infrasys get_mux_rate
Christian Marangi [Fri, 28 Jun 2024 17:40:47 +0000 (19:40 +0200)]
clk: mediatek: return XTAL rate for infrasys get_mux_rate

We currently return 0 if XTAL rate is requested in get_mux_rate. This
deviates from what is done in get_factor_rate and is totally wrong as it
can cause unwanted results (division by 0 crash)

For infrasys that makes use of CLK_XTAL, assume xtal_rate to be defined
in clk_tree and return the rate when BYPASS_XTAL is not enabled with
clk ID 0 index parents.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agoclk: mediatek: return XTAL rate directly for gates with XTAL parent
Christian Marangi [Fri, 28 Jun 2024 17:40:46 +0000 (19:40 +0200)]
clk: mediatek: return XTAL rate directly for gates with XTAL parent

There is currently a massive bug that makes any gate clk that have
CLK_XTAL as parent to return the wrong clock.

Following the code, with CLK_XTAL defined as TOPCKGEN parent, the
topckgen get_rate is called. The clk ID (0) is parsed and only in some
corner case (scenario where fixed clock are not defined) the correct
XTAL rate will be returned as get_factor or get_mux is called (that have
correct handling for CLK_XTAL). With fixed clock defined, the rate that
will be returned will always be the FIRST ELEMENT of the fixed clock
table instead of the hardcoded XTAL rate.

To handle this, add additional logic and if the flag is set to
PARENT_XTAL for the gate, return the XTAL rate directly.

We assume the clk_tree to have xtal_rate defined with clk gates that
have XTAL as parents.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
4 months agonet: dwc_eth_qos: mdio: Implement clause 45
Philip Oberfichtner [Tue, 7 May 2024 09:42:37 +0000 (11:42 +0200)]
net: dwc_eth_qos: mdio: Implement clause 45

Bevor this commit, only clause 22 access was possible. After this commit,
clause 45 direct access will available as well.

Note that there is a slight change of behavior: Before this commit, the
C45E bit was set to whatever value was left in the register from the
previous access. After this commit, we adopt the common practice of
discerning C45 from C22 using the devad argument.

Signed-off-by: Philip Oberfichtner <pro@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
4 months agonet/tftp: make tftpput working with servers that do not use OACK
Mikhail Kshevetskiy [Fri, 12 Jul 2024 09:47:54 +0000 (13:47 +0400)]
net/tftp: make tftpput working with servers that do not use OACK

Option Acknowledgment (OACK) is an extension of TFTP protocol (see rfc2347).
Not all tftp servers implements it. For example it does not supported by
tftpd server from debian-11 (https://packages.debian.org/bullseye/tftpd).

Starting the "tftpput $loadaddr $size out_file" command with such server
will results in the following packets flow:

192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
...

so, no data transfer happening.

Here is a packets flow for tftp-server with OACK support
(tftpd-hpa: https://packages.debian.org/stable/tftpd-hpa)

192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Option Acknowledgement, ...
192.168.27.3   192.168.27.1   TFTP   Data Packet, Block: 1
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 1
192.168.27.3   192.168.27.1   TFTP   Data Packet, Block: 2
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 2

and this time data transfer starts normally.

As we can see there is no OACK packet in the first case. Investigating
an issue we'll find out:

1) tftp_start() sets

      tftp_state = STATE_SEND_WRQ;

2) on OACK tftp_handler() sets

      tftp_state = STATE_DATA;

   and send a first DATA packet.

3) on ACK tftp_handler() will call a tftp_send() function.
   tftp_send() will

   * tftpd with OACK support:

       Current state is STATE_DATA, so transmittion of data packet will
       happen.

   * tftpd without OACK support

      Current state is STATE_SEND_WRQ, so retransmission of WRQ packet
      will happen. Thus tftpd-server will retransmit an ACK.

      This will repeats until timeout happens.

      According to RFC1350 this is wrong. We should start data transfer
      instead of WRQ retransmission.

This patch fix an issue, so tftpput works fine with both types of servers.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
4 months agonet: remove duplicate eth_env_set_enetaddr_by_index() declaration
Alexander Sverdlin [Mon, 8 Jul 2024 09:09:58 +0000 (11:09 +0200)]
net: remove duplicate eth_env_set_enetaddr_by_index() declaration

eth_env_set_enetaddr_by_index() declaration is duplicated in eth_internal.h
and net.h, but all units including eth_internal.h already include net.h.
Remove the superfluous declaration.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
4 months agoMerge tag 'video-20240731' of https://source.denx.de/u-boot/custodians/u-boot-video
Tom Rini [Wed, 31 Jul 2024 19:39:14 +0000 (13:39 -0600)]
Merge tag 'video-20240731' of https://source.denx.de/u-boot/custodians/u-boot-video

 - improve video sync performance with background syncing (cyclic)
 - fix dropping characters when pasting commands over the UART
 - enable background syncing by default for boards using VIDEO
 - make sandbox video more responsive

4 months agousb: bootm: Drop old USB-device-removal code
Simon Glass [Fri, 26 Jul 2024 12:36:09 +0000 (06:36 -0600)]
usb: bootm: Drop old USB-device-removal code

USB is stopped using driver model now, in dm_remove_devices_flags() in
announce_and_cleanup() at the top of this file.

The usb_stop() call actually unbinds devices.

When a USB device is unbound, it causes any bootflows attached to it to
be removed, via a call to bootdev_clear_bootflows() from
bootdev_pre_unbind(). This obviously makes it impossible to boot the
bootflow.

However, when booting a bootflow that relies on USB, usb_stop() is
called, which unbinds the device. At that point any information
attached to the bootflow is dropped.

This is quite risky since the contents of freed memory are not
guaranteed to remain unchanged. Depending on what other options are
done before boot, a hard-to-find bug may crop up.

Drop the call to this old function.

Leave the netconsole call there, since this needs conversion to
driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Shantur Rathore <i@shantur.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
4 months agotools: Add script to update git subtree projects
Raymond Mao [Thu, 25 Jul 2024 13:57:51 +0000 (06:57 -0700)]
tools: Add script to update git subtree projects

Recently we are introducing multiple git subtree projects and
it is the right time to have a universal script to update
various subtrees and replace the dts/update-dts-subtree.sh.

update-subtree.sh is a wrapper of git subtree commands.

Usage: From U-Boot top directory,
run
$ ./tools/update-subtree.sh pull <subtree-name> <release-tag>
for pulling a tag from the upstream.
Or run
$ ./tools/update-subtree.sh pick <subtree-name> <commit-id>
for cherry-pick a commit from the upstream.

Currently <subtree-name> supports dts, mbedtls and lwip.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
4 months agoenv: mmc: Fix env loading with CONFIG_SYS_MMC_ENV_PART
Mattijs Korpershoek [Fri, 19 Jul 2024 15:38:54 +0000 (17:38 +0200)]
env: mmc: Fix env loading with CONFIG_SYS_MMC_ENV_PART

When CONFIG_SYS_MMC_ENV_PART=2, the environment is loaded from
the USER partition (hwpart=0) instead of from the
BOOT1 partition (hwpart=2).

IS_ENABLED() cannot be used for non-boolean KConfig options.
Its documentation states:

> * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y',
> * 0 otherwise.

So in our case, IS_ENABLED(CONFIG_SYS_MMC_ENV_PART) evaluates to 0.

Because of this, the hwpart variable is never assigned and mmc_offset()
ends up switching back to the USER hwpart (0) instead of BOOT1 (2).

Fix it by using #define instead.

Tested with:

  # have CONFIG_SYS_MMC_ENV_PART=2 in defconfig
  # 1. Erase mmc0boot1
  => mmc dev 0 2
  => mmc erase 0 400
  => mmc read ${loadaddr} 0 400
  => md ${loadaddr} 4
  8200000000000000 00000000 00000000 00000000  ................

  # 2. Restore default environment and save to MMC
  => env default -a -f
  => saveenv

  # 3. Read back mmc0boot1 and confirm the env is present
  => mmc read ${loadaddr} 0 400
  => md ${loadaddr} 4
  8200000013e0632e 72646461 7469665f 3978303d  .c..addr_fit=0x9

Fixes: 5b4acb0ff79d ("env: mmc: Apply GPT only on eMMC user HW partition")
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 months agoMerge patch series "Endian Kconfig improvements"
Tom Rini [Wed, 31 Jul 2024 17:18:43 +0000 (11:18 -0600)]
Merge patch series "Endian Kconfig improvements"

Jiaxun Yang <jiaxun.yang@flygoat.com> says:

This is a subset of my previous arm64_be work.

I wish this could be merged first so it would be easier to work
against xtensa and arm64 be support.

4 months agoconfig: Use CONFIG_SYS_BIG_ENDIAN in code whenever possible
Jiaxun Yang [Wed, 17 Jul 2024 08:07:03 +0000 (16:07 +0800)]
config: Use CONFIG_SYS_BIG_ENDIAN in code whenever possible

So CONFIG_SYS_BIG_ENDIAN is our cross architecture option for
selecting machine endian, while the old CONFIG_CPU_BIG_ENDIAN
is defined by Arc only.

Use it whenever possible to ensure big endian code path is enabled
for all possible big endian machines.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
4 months agoKconfig: Unify endian support option
Jiaxun Yang [Wed, 17 Jul 2024 08:07:02 +0000 (16:07 +0800)]
Kconfig: Unify endian support option

Move SUPPORT_BIG_ENDIAN, SUPPORT_LITTLE_ENDIAN to top-level
arch Kconfig and let architectures select them as necessary.

Remove if guard for Endianness selection choice so we can
have one of SYS_BIG_ENDIAN, SYS_LITTLE_ENDIAN config symbol
defined even on single endian system.

Default endian to SYS_BIG_ENDIAN for MIPS || MICROBLAZE
and LITTLE_ENDIAN for the rest to retain old config
behaviour.

Note: PPC, SH, Xtensa are technically bi-endian, but I
checked compiled u-boot image with readelf, U-Boot currently
only support little endian for SH and Xtensa, Big Endian for
PPC.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
4 months agosandbox: Drop video-sync in serial driver
Simon Glass [Wed, 31 Jul 2024 14:44:12 +0000 (08:44 -0600)]
sandbox: Drop video-sync in serial driver

With sandbox, when U-Boot is waiting for input it syncs the video
display, since presumably the user has finished typing.

Now that cyclic is used for video syncing, we can drop this. Cyclic
will automatically call the video_idle() function when idle.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agosandbox: Increase cyclic CPU-time limit
Simon Glass [Wed, 31 Jul 2024 14:44:11 +0000 (08:44 -0600)]
sandbox: Increase cyclic CPU-time limit

Now that sandbox is using cyclic for video, it trips the 1us time
limit. Updating the sandbox display often takes 20ms or more.

Increase the limit to 100ms to avoid a warning.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agovideo: Use cyclic to handle video sync
Simon Glass [Wed, 31 Jul 2024 14:44:10 +0000 (08:44 -0600)]
video: Use cyclic to handle video sync

At present U-Boot flushes the cache after every character written to
the display. This makes the command-line slower, to the point that
pasting in long strings can fail.

Add a cyclic function to sync the display every 10ms. Enable this by
default.

Allow much longer times for sandbox, since the SDL display is quite
slow.

Avoid size growth if the feature is disabled by making the new init and
destroy functions dependent on CYCLIC being enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 months agovideo: Move last_sync to private data
Simon Glass [Wed, 31 Jul 2024 14:44:09 +0000 (08:44 -0600)]
video: Move last_sync to private data

Rather than using a static variable, use the video device's private
data to remember when the last video sync was completed. This allows
each display to have its own sync and avoids using static data in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>