]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
2 years agospl: Jump to image at end of board_init_r
Jonas Karlman [Wed, 27 Sep 2023 21:44:13 +0000 (21:44 +0000)] 
spl: Jump to image at end of board_init_r

spl_board_prepare_for_boot() is not called before jumping/invoking atf,
optee, opensbi or linux images.

Jump to image at the end of board_init_r() to fix this.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agospl: add __noreturn attribute to spl_invoke_atf function
Chanho Park [Fri, 8 Sep 2023 08:08:56 +0000 (17:08 +0900)] 
spl: add __noreturn attribute to spl_invoke_atf function

spl_invoke_atf function will not be returned to SPL. Thus, we need to
set __noreturn function attribute to the function.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
2 years agotools: iot2050-sign-fw.sh: Make localization of tools dir more robust
Jan Kiszka [Wed, 27 Sep 2023 15:41:09 +0000 (17:41 +0200)] 
tools: iot2050-sign-fw.sh: Make localization of tools dir more robust

When building in-tree, there is no source link.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2 years agoarm: mach-k3: common: fix compile warnings with PHYS_64BIT on 32bit
Matthias Schiffer [Wed, 27 Sep 2023 13:43:14 +0000 (15:43 +0200)] 
arm: mach-k3: common: fix compile warnings with PHYS_64BIT on 32bit

Use uintptr_t instead of phys_addr_t where appropriate, so passing the
addresses to writel() doesn't result in compile warnings when PHYS_64BIT
is set for 32bit builds (which is actually a useful configuration, as
the K3 SoC family boots from an R5 SPL, which may pass bank information
based on gd->bd->bi_dram to fdt_fixup_memory_banks() etc., so PHYS_64BIT
is needed for fixing up the upper bank).

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
2 years agotest/py: sleep: Add a test for the time command
Love Kumar [Wed, 27 Sep 2023 05:03:55 +0000 (10:33 +0530)] 
test/py: sleep: Add a test for the time command

Execute "time <sleep cmd>", and validate that it gives the approximately
the correct amount of command execution time.

Signed-off-by: Love Kumar <love.kumar@amd.com>
2 years agomailbox: k3-sec-proxy: fix error handling for missing scfg in FDT
Matthias Schiffer [Tue, 26 Sep 2023 12:42:54 +0000 (14:42 +0200)] 
mailbox: k3-sec-proxy: fix error handling for missing scfg in FDT

The wrong field was checked.

Fixes: f9aa41023bd9 ("mailbox: Introduce K3 Secure Proxy Driver")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
2 years agotest: lmb: Add test for coalescing and overlap range
Udit Kumar [Tue, 26 Sep 2023 11:24:43 +0000 (16:54 +0530)] 
test: lmb: Add test for coalescing and overlap range

Add test case for an address range which is coalescing with one of
range and overlapping with next range

Cc: Simon Glass <sjg@google.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agolmb: remove overlapping region with next range
Udit Kumar [Tue, 26 Sep 2023 11:24:42 +0000 (16:54 +0530)] 
lmb: remove overlapping region with next range

In case of new memory range to be added is coalesced
with any already added non last lmb region.

And there is possibility that, then region in which new memory
range added is not adjacent to next region. But have some
sections are overlapping.

So along with adjacency check with next lmb region,
check for overlap should be done.

In case overlap  is found, adjust and merge these two lmb
region into one.

Reported-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
2 years agoexynos: Cleanup exynos_init
Tom Rini [Thu, 21 Sep 2023 23:32:48 +0000 (19:32 -0400)] 
exynos: Cleanup exynos_init

- None of the callers perform error checking and based on the non-empty
  versions of this function, there's no checking to be done, so make
  this a void.
- Add a default weak version of the function.
- Remove the empty versions of exynos_init now that we have a weak
  version.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoboard: Remove essentially empty board files and Makefiles
Tom Rini [Thu, 21 Sep 2023 23:32:47 +0000 (19:32 -0400)] 
board: Remove essentially empty board files and Makefiles

As part of reviewing a new platform, Daniel Schwierzeck noted that we
can have an empty Makefile in the board directory and don't need an
empty board.c file as well.  Further with further cleanup in the
Makefile we can now omit the Makefile entirely. Remove a number of now
unnecessary board.c and Makefiles.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMakefile: Allow for board directories to not have a Makefile
Tom Rini [Thu, 21 Sep 2023 23:32:46 +0000 (19:32 -0400)] 
Makefile: Allow for board directories to not have a Makefile

It is entirely possible at this point to have platforms in U-Boot that
do not have board-specific C code (just Kconfig or environment) and so
make it optional to have to descend in to and then build in the board
directory.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoARM: vexpress_ca9x4: Add missing flash width config option
Patryk Biel [Wed, 20 Sep 2023 07:41:20 +0000 (09:41 +0200)] 
ARM: vexpress_ca9x4: Add missing flash width config option

Allow for a proper configuration of CFI flash banks avaialble on the vexpress_ca9x4
board. Without this option, the CFI flash incorrectly detects that the board has two
banks of 32MB flash devices, while in reality, the board provides
two flash banks, each with 64MB size. As a result, it becomes impossible to e.g. to
save u-boot env in flash. According to device tree for this board and
its implementation in QEMU, the CFI width should be set to 32 bits.

After applying this fix, CFI flash will correctly detect both flash
banks each with a size of 64MB. As as result the functionality of e.g. saving u-boot
env will work correctly.

Tested on QEMU 6.2.0.

Cc: Kristian Amlie <kristian.amlie@northern.tech>
Signed-off-by: Patryk Biel <pbiel7@gmail.com>
Reviewed-by: Kristian Amlie <kristian.amlie@northern.tech>
2 years agobootstd: use ARCH_DMA_MINALIGN in memalign() when allocating memory
Tony Dinh [Tue, 19 Sep 2023 21:27:21 +0000 (14:27 -0700)] 
bootstd: use ARCH_DMA_MINALIGN in memalign() when allocating memory

Use ARCH_DMA_MINALIGN in memalign() when allocating memory to read the script from the media.

Ref: https://lore.kernel.org/u-boot/CAJaLiFy05F3Cr4X4G2mVkppXnBEFZrHQ+5CngYN8eJPg8ENWkg@mail.gmail.com/T/#m26daadc2463fe653b814a94e6309e5e6bb6be1d1

Note: this patch depends on the previous patch
https://patchwork.ozlabs.org/project/uboot/patch/20230917230649.30357-1-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Force regeneration of env.txt
Andrew Davis [Fri, 15 Sep 2023 14:43:23 +0000 (09:43 -0500)] 
Makefile: Force regeneration of env.txt

If the source .env file changes to one that is also older than the
generated env.txt file then the .env file is not regenerated. This
means when switching board configs we do not regenerate the env.

This can be tested with:

$ make j721e_evm_a72_defconfig
$ make # this may fail to complete but that is okay for this test
$ make am64x_evm_a53_defconfig
$ make
$ vim include/generated/env.txt

Note this is still the J721e env not the AM64 config as expected.

As ENV_FILE is set based on configuration, regenerate anytime
autoconf.h changes.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoarm64: versal: Add SelectMAP boot mode identification
Polak, Leszek [Sun, 8 Oct 2023 14:34:42 +0000 (14:34 +0000)] 
arm64: versal: Add SelectMAP boot mode identification

The SelectMAP configuration interface provides an 8-bit,
16-bit or 32-bit bidirectional data bus interface to the Versal FPGA
configuration logic that can be used for both configuration and readback.

A connected microcontoller to the SelectMAP interface can load boot
image with bitstream, TF-A (ARM Trusted Firmware) and U-Boot.

This commit adds the missing identification of the SelectMAP mode.

Signed-off-by: Polak, Leszek <LPolak@arri.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Stefan Roese <sr@denx.de>
Link: https://lore.kernel.org/r/DU0PR07MB8419F7765892CDBCE7D559C5C8CFA@DU0PR07MB8419.eurprd07.prod.outlook.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoarm64: xilinx: Do not use '_' in si5335 DT node names
Michal Simek [Wed, 27 Sep 2023 10:05:32 +0000 (12:05 +0200)] 
arm64: xilinx: Do not use '_' in si5335 DT node names

Character '_' not recommended in node name. Use '-' instead.
Pretty much run sed below for node names.
s/si5335_/si5335-/

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ac752b1e27f02efb32608188992bb7ae50e4b1b0.1695809130.git.michal.simek@amd.com
2 years agoRevert "clk: versal: Enable clock driver for Versal NET"
Michal Simek [Wed, 27 Sep 2023 10:02:53 +0000 (12:02 +0200)] 
Revert "clk: versal: Enable clock driver for Versal NET"

This partially reverts commit ff33227819f579ffb963e0dac6bc6a6566b89563.

Versal NET clock node should use "xlnx,versal-net-clk", "xlnx,versal-clk"
compatible string that's why it is not necessary to define Versal NET
specific compatible string if there is no any other change needed. It can
be get back if there is a need to differentiate clock support between
Versal and Versal NET.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c09276022db5f1b150679cc7a9f9583363ace2fb.1695808971.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Do not use '_' in DT node names
Michal Simek [Wed, 27 Sep 2023 09:57:48 +0000 (11:57 +0200)] 
arm64: zynqmp: Do not use '_' in DT node names

Using '_' is not recommended for node names. Use '-' instead.
Pretty much run seds below for node names.
s/heartbeat_led/heartbeat-led/
s/gtr_sel/gtr-sel/
s/zynqmp_ipi/zynqmp-ipi/
s/nvmem_firmware/nvmem-firmware/
s/soc_revision/soc-revision/

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/dd33d6cb0595ffedab117d477f4a3c9d9eb11715.1695808665.git.michal.simek@amd.com
2 years agoarm: dts: xilinx: Remove undocumented is-dual property
Michal Simek [Wed, 27 Sep 2023 09:56:06 +0000 (11:56 +0200)] 
arm: dts: xilinx: Remove undocumented is-dual property

Xilinx was using in past is-dual property for QSPIs to reflect their
configurations. But handling for them never reached upstream code that's
why better to remove them.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/15980560b98672959a889ff9970cbe9540b4ed69.1695808563.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for zcu670-revB
Michal Simek [Wed, 27 Sep 2023 09:53:37 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for zcu670-revB

RevB has different SD level shifter compare to revA. There are couple of
changes between revisions but none of them requires SW alignment.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/0f2bb29f88615ce75f887c006060543b4aeafd48.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for zcu670-revA
Michal Simek [Wed, 27 Sep 2023 09:53:36 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for zcu670-revA

The board is sharing a lot of components with zcu208 but it contains
differet silicon and also several components are done differently.
The board has 4GB memory connected to PS and additional 4GB connected to
PL. Compare to zcu208 sata support has been dropped and only USB3.0 is
using GTR (lane2). Others GTRs are routed to connectors.

MIO configuration is also shared with zcu111.

The board is using si5381 chip compare to si5341 which is normally used.
And as of now there is no Linux driver for this chip. PS reference clock is
generated out of si570 chip which is also new approach compare to zcu208.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/3b296ef0f52bd94e32bdeb6d1beee29ac85f00a2.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for VPXA2785
Michal Simek [Wed, 27 Sep 2023 09:53:35 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for VPXA2785

VPXA2785(vp-x-a2785-00) is evaluation board which contains two PCIe-Edge
fingers, one for PCIe-B(gen5x8) and one for CPM(dual gen5x8, gen5x16).
Each of the ports can operate in endpoint or root port mode. This allows
the single card to be used for both root port, endpoint, and switch modes.

The board is designed in the similar manner as others Versal boards. It
means board also have ZynqMP Zu4 System Controller which is described in a
separate file.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/59d3b1f7e785bc65518b465e5122fd2787616a93.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Describe i2c structures for SCs
Michal Simek [Wed, 27 Sep 2023 09:53:34 +0000 (11:53 +0200)] 
arm64: zynqmp: Describe i2c structures for SCs

Generic system controller (SC) covers connection defined by specification
but different boards have different i2c devices. That's why describe i2c
devices available on multiple boards.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ca1826b8b58981111229a94527818cc5a191ca9a.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for SC revC
Michal Simek [Wed, 27 Sep 2023 09:53:33 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for SC revC

System controller revC is using ADI ethernet phy instead of TI because of
supply chain issues.
Describe reset assert and de-assert times to 10us and 5ms respectively
according to the datasheet. Also setup RGMII RX and TX delay values to
2400ps as per board bring up observations.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2790f6cede7485556d581ab8270dda477fa21522.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Create description for generic SC (vpk120-revB)
Michal Simek [Wed, 27 Sep 2023 09:53:32 +0000 (11:53 +0200)] 
arm64: zynqmp: Create description for generic SC (vpk120-revB)

System controllers are pretty much the same on the all boards that's why
use autodetection based on i2c eeprom. This should end up with having only
one BSP for all SCs with only DT overlays to cover different i2c
structures.

All MIOs are fixed by the spec that's why not a problem to description
pinctrl setting.

Apart from eth phy reset, it also set proper phy delays.
The TI DP83867 PHY datasheet says:
T1: Post RESET stabilization time == 195us
T3: Hardware configuration pins transition to output drivers == 64us
T4: RESET pulse width == 1us
So with a little overhead set 'reset-assert-us' to 100us (T4) and
'reset-deassert-us' to 280us (T1+T3).

NOTE: The tuning of TI DP83867 phy reset delay is derived from linux
upstream commit: 5dbadc848259(arm64: dts: fsl: add support for Kontron
pitx-imx8m board).

i2c structure on Xilinx Versal evaluation platforms contain a lot of
devices but also connection to connectors like SFP. Because of this
complicated structure with also all level shifters, i2c muxes, etc. not all
devices are able to reliably work on 400kHz even if they are compatible
with this speed. That's why set i2c frequency to 100KHz to increase
reliability of the i2c bus.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c8092340f92144f0cc9096194198f227015bc013.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for vpk120-revA
Michal Simek [Wed, 27 Sep 2023 09:53:31 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for vpk120-revA

Board contains two systems. The primary is Versal VP1202 ACAP device and
the secondary is ZynqMP zu4 which acts as system controller. The patch is
describing only ZynqMP system controller part.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/bd8b79d7c6693e90e12bce422f8ed00f2f43c9ae.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add x-prc-01/02/03/04/05 revA support from SC
Michal Simek [Wed, 27 Sep 2023 09:53:30 +0000 (11:53 +0200)] 
arm64: zynqmp: Add x-prc-01/02/03/04/05 revA support from SC

Add i2c accessible devices with description.
There is versal specific eeprom and i2c-gpio controller.

SE3 has also clock chip present.

Also remove x-prc description from SC dts.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/4f71ec6a63240fd4aaa3453824138281c50d71c3.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for vck190 revB system controller
Michal Simek [Wed, 27 Sep 2023 09:53:29 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for vck190 revB system controller

There are some changes between revA and revB boards. u39 8T49N240 was
removed and also three ina226 at 42/43/44 addresses (u178/u180/u182).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/461cfe5b2b882365413f90d19efd8abcd6be56ed.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Remove xlnx,fclk nodes
Michal Simek [Wed, 27 Sep 2023 09:53:28 +0000 (11:53 +0200)] 
arm64: zynqmp: Remove xlnx,fclk nodes

xlnx,fclk nodes are not described in dtschema that's why remove them.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/b25dedd066f587321751d7d20c1f65bb96c53b89.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Add support for KD240 Kria SOM CC
Michal Simek [Wed, 27 Sep 2023 09:53:27 +0000 (11:53 +0200)] 
arm64: zynqmp: Add support for KD240 Kria SOM CC

Add support for KD240 Kria SOM CC. It is pretty much subset of KR260 board
from PS perspective.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/835f1d1b8982d46b902db69daad64e8445c051e9.1695808407.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Aligned QSPI configuration with latest spec
Michal Simek [Fri, 22 Sep 2023 10:35:43 +0000 (12:35 +0200)] 
arm64: zynqmp: Aligned QSPI configuration with latest spec

Official DT binding description for dual stacked/paralllel configurations
have been merged that's why switch to it.

Link: https://lore.kernel.org/r/20220126112608.955728-3-miquel.raynal@bootlin.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2912091c231f5e945ee44601c285fe16263448da.1695378830.git.michal.simek@amd.com
2 years agoARM: zynq: Describe nand device in DT
Michal Simek [Fri, 22 Sep 2023 10:35:42 +0000 (12:35 +0200)] 
ARM: zynq: Describe nand device in DT

Linux requires to describe nand structure under nand controller.
If it is not described nand device is not detected by Linux.

Error shown by Linux kernel:
pl35x-nand-controller e1000000.nand-controller: Incorrect number of NAND chips (0)
pl35x-nand-controller: probe of e1000000.nand-controller failed with error -22

When wired:
nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda
nand: Micron MT29F2G08ABAEAWP
nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/3fcd68ccdfed5e6c079681e3b29e06583ec8a375.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Sync licenses with Linux kernel
Michal Simek [Fri, 22 Sep 2023 10:35:41 +0000 (12:35 +0200)] 
arm64: zynqmp: Sync licenses with Linux kernel

There is difference between licenses in the Linux kernel and there
shouldn't be any diff because all changes are coming from the same source
at the same time. The difference is really in a time when they were
upstreamed. That's why sync it up.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/813b29378083153b67c60772f28cd2613519f338.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Convert kv260-revA overlay to ASCII text
Michal Simek [Fri, 22 Sep 2023 10:35:40 +0000 (12:35 +0200)] 
arm64: zynqmp: Convert kv260-revA overlay to ASCII text

File was in UTF-8 format but there is no reason for it. Convert it to
ASCII/plain text.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/e4d52b898b461b86bb82009f37635f351279c753.1695378830.git.michal.simek@amd.com
2 years agoarm64: dts: zynqmp: Add ports for the DisplayPort subsystem
Laurent Pinchart [Fri, 22 Sep 2023 10:35:39 +0000 (12:35 +0200)] 
arm64: dts: zynqmp: Add ports for the DisplayPort subsystem

The DPSUB DT bindings now specify ports to model the connections with
the programmable logic and the DisplayPort output. Add them to the
device tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/1c91420e90bc823d7529834c33438216857c7161.1695378830.git.michal.simek@amd.com
2 years agoarm64: dts: zynqmp: zcu106a: Describe DisplayPort connector
Laurent Pinchart [Fri, 22 Sep 2023 10:35:38 +0000 (12:35 +0200)] 
arm64: dts: zynqmp: zcu106a: Describe DisplayPort connector

Add a device tree node to describe the DisplayPort connector, and
connect it to the DPSUB output.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/fe037c93ed41bc5ca97887964037520d449ca98c.1695378830.git.michal.simek@amd.com
2 years agoarm64: xilinx: Remove address/size-cells from gem nodes
Michal Simek [Fri, 22 Sep 2023 10:35:37 +0000 (12:35 +0200)] 
arm64: xilinx: Remove address/size-cells from gem nodes

Some boards are using one mdio bus which holds multiple phys and also
boards are using mdio node for bus description. That's why there are cases
where address/size-cells are unnecessary which is also reported by make W=1
dtbs. That's why remove them from zynqmp.dtsi and let board DTSes to handle
it based on used description.

Error log:
/axi/ethernet@ff0e0000: unnecessary #address-cells/#size-cells without
"ranges" or child "reg" property

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/02f308c774d4f2a798a9a8c066824114a19841a7.1695378830.git.michal.simek@amd.com
2 years agoarm64: xilinx: Put ethernet phys to mdio node
Michal Simek [Fri, 22 Sep 2023 10:35:36 +0000 (12:35 +0200)] 
arm64: xilinx: Put ethernet phys to mdio node

All zynqmp boards have been already described via mdio node that's why also
convert the rest of the boards. With using mdio node there is an option to
add reset property for the whole mdio bus which is reflected by
's/phy-reset-gpios/reset-gpios/g' for some boards.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/ff165281a70a38e2b76fee91e6255ce95ce8021b.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Fix Siva's email address format
Michal Simek [Fri, 22 Sep 2023 10:35:35 +0000 (12:35 +0200)] 
arm64: zynqmp: Fix Siva's email address format

Some patches didn't have his full name and also there was one more ">" at
the end of email address. That's why correct both of these issues.

Fixes: 174d728471d5 ("arm64: zynqmp: Switch to amd.com emails")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/e970cc0dfabe293c2baf6b231d34f3af0386f1eb.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Describe bus-width for SD card on KV260
Michal Simek [Fri, 22 Sep 2023 10:35:34 +0000 (12:35 +0200)] 
arm64: zynqmp: Describe bus-width for SD card on KV260

SD card is connected with 4 data lines which should be described properly.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/065cb9f1c6706eb4d70066e25cfc30d17b9f875d.1695378830.git.michal.simek@amd.com
2 years agoarm64: xilinx: Use lower case for partition address
Michal Simek [Fri, 22 Sep 2023 10:35:33 +0000 (12:35 +0200)] 
arm64: xilinx: Use lower case for partition address

Lower case should be used for register address.
Issue is reported as:
flash@0: partitions: Unevaluated properties are not allowed
('partition@22A0000' was unexpected)

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/66b3361df883ecab4f36ce3b4196fb606c802598.1695378830.git.michal.simek@amd.com
2 years agoarm64: xilinx: Remove address/size-cells from flash node
Michal Simek [Fri, 22 Sep 2023 10:35:32 +0000 (12:35 +0200)] 
arm64: xilinx: Remove address/size-cells from flash node

Partitions are described via fixed-partitions that's why there is no need
to have address/size-cells in flash node.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c704be9d9f3d09c1cc55b092efeb9c73fcda6451.1695378830.git.michal.simek@amd.com
2 years agoarm64: dts: xilinx: zynqmp: Add RPU subsystem device node
Tanmay Shah [Fri, 22 Sep 2023 10:35:31 +0000 (12:35 +0200)] 
arm64: dts: xilinx: zynqmp: Add RPU subsystem device node

RPU subsystem can be configured in cluster-mode or split mode.
Also each r5 core has separate power domains.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/dde364939b4fbe3f7be7b6f5dff42e7d8b2f5c46.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Describe interrupts by using macros
Michal Simek [Fri, 22 Sep 2023 10:35:30 +0000 (12:35 +0200)] 
arm64: zynqmp: Describe interrupts by using macros

Use arm-gic.h and irq.h for interrupt description. It helps to improve
readability of device tree file.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/e0db567e1eb4e4e90e59270f41708919682dacf4.1695378830.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Remove resetin/out from K24 psu_init
Michal Simek [Mon, 18 Sep 2023 14:11:23 +0000 (16:11 +0200)] 
arm64: zynqmp: Remove resetin/out from K24 psu_init

The code is not called that's why remove it.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/7b207e90f68028ab36fcc22df4127492f174793d.1695046281.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Rename dt overlay file names from dts to dtso
Michal Simek [Mon, 18 Sep 2023 14:09:18 +0000 (16:09 +0200)] 
arm64: zynqmp: Rename dt overlay file names from dts to dtso

Use dtso suffix instead of dts. Build option was introduced by
commit a0f9a77912b2 ("kbuild: Allow DTB overlays to built from .dtso named
source files").

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/1dce37e72428c14a3ccbb5dc674b90dfe56b75ac.1695046155.git.michal.simek@amd.com
2 years agoarm64: zynqmp: Describe assigned-clocks for uarts
Michal Simek [Mon, 18 Sep 2023 11:22:04 +0000 (13:22 +0200)] 
arm64: zynqmp: Describe assigned-clocks for uarts

Describe assigned-clocks for both uarts. SOM is using this functionality.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/bddbb81209a4567b0939c5d2d0ecb42fdfcd71ea.1695036114.git.michal.simek@amd.com
2 years agopinctrl: zynqmp: Display the tristate configuration for all pins
Venkatesh Yadav Abbarapu [Thu, 14 Sep 2023 10:06:20 +0000 (15:36 +0530)] 
pinctrl: zynqmp: Display the tristate configuration for all pins

Read the tristate config for all the pins and display it.

ZynqMP> pinmux status MIO1
MIO1: slew:fast bias:enabled pull:up input:cmos drive:12mA
      volt:1.8 tri_state:enabled

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230914100620.26346-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agopinctrl: Increase size of pinmux status buffer
Venkatesh Yadav Abbarapu [Wed, 20 Sep 2023 03:00:06 +0000 (08:30 +0530)] 
pinctrl: Increase size of pinmux status buffer

For Xilinx ZynqMP SOC new parameter was added and now it can
set 7 parameters for its pins. Pinmux status command will
print the status of these parameters for each pin. But
current print buffer length is only 80 characters long, increase it
to 90 to print all the parameters without truncation.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230920030006.6488-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agonet: zynq_gem: Update the MDC clock divisor in the probe function
Venkatesh Yadav Abbarapu [Fri, 22 Sep 2023 04:50:10 +0000 (10:20 +0530)] 
net: zynq_gem: Update the MDC clock divisor in the probe function

MDC clock change needs to be done when the driver probe function
is called as mdio is enabled at probe and not when the ethernet starts.
Setup the MDC clock at the probe itself.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20230922045010.22852-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoMerge tag 'u-boot-rockchip-20231007' of https://source.denx.de/u-boot/custodians...
Tom Rini [Sun, 8 Oct 2023 13:58:55 +0000 (09:58 -0400)] 
Merge tag 'u-boot-rockchip-20231007' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Add Board: rk3568 Bananapi R2Pro;
- Update pcie bifurcation support;
- dwc_eth_qos controller support for rk3568 and rk3588;
- Compressed binary support for U-Boot on rockchip platform;
- dts and config updates for different board and soc;

[ trini: Fix conflict on include/spl.h ]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agorockchip: rk356x-u-boot: Add bootph-all to i2c0_xfer pinctrl node
Jonas Karlman [Thu, 3 Aug 2023 21:11:54 +0000 (21:11 +0000)] 
rockchip: rk356x-u-boot: Add bootph-all to i2c0_xfer pinctrl node

A RK8XX PMIC is typically using i2c0 on RK356x devices. Add bootph-all
to required pinctrl nodes to simplify use of the prevent booting on
power plug-in option in SPL.

With the following Kconfig options and nodes in u-boot.dtsi the prevent
booting on power plug-in option can work in SPL.

  CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON=y
  CONFIG_SPL_I2C=y
  CONFIG_SPL_POWER=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_SPL_PMIC_RK8XX=y

  &i2c0 {
   bootph-pre-ram;
  };

  &rk817 {
   bootph-pre-ram;

   regulators {
   bootph-pre-ram;
   };
  };

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agopower: pmic: rk8xx: Fix power-on source check in SPL
Jonas Karlman [Thu, 3 Aug 2023 21:02:42 +0000 (21:02 +0000)] 
power: pmic: rk8xx: Fix power-on source check in SPL

The commit 30975fb73d51 ("rockchip: Add option to prevent booting on
power plug-in") introduce an option to prevent booting a device when the
device was powered on due to power plug-in instead of pressing a power
button.

This feature works by checking the power-on source during PMIC probe
and powers off the device if power-on source was power plug-in.
This check currently runs very late at PMIC probe in U-Boot proper.

Fix so that the power-on source check can work at probe time in SPL.
Also enable probe after bind and remove the PMIC banner in SPL.

With this we can use ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON and
SPL_PMIC_RK8XX to power off the device very quickly after TPL instead
of after TF-A and U-Boot proper has been loaded and run.

  DDR V1.18 f366f69a7d typ 23/07/17-15:48:58
  ln
  LP4/4x derate en, other dram:1x trefi
  ddrconfig:7
  LPDDR4X, 324MHz
  BW=32 Col=10 Bk=8 CS0 Row=17 CS1 Row=17 CS=2 Die BW=16 Size=8192MB

  change to: 324MHz
  clk skew:0x64

  change to: 528MHz
  clk skew:0x58

  change to: 780MHz
  clk skew:0x58

  change to: 1056MHz(final freq)
  clk skew:0x40
  out
  Power Off due to plug-in event

Fixes: 30975fb73d51 ("rockchip: Add option to prevent booting on power plug-in")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2 years agorockchip: rk356x: Enable poweroff command
Jonas Karlman [Thu, 17 Aug 2023 05:45:04 +0000 (05:45 +0000)] 
rockchip: rk356x: Enable poweroff command

With PMIC_RK8XX, SYSRESET and CMD_POWEROFF options enabled it is
possible to power down a board using the poweroff command and turn the
board back on using a power button.

Enable the poweroff command on RK356x boards that have a button wired
to PMIC pwron.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agopower: pmic: rk8xx: Use sysreset implementation of the poweroff command
Jonas Karlman [Thu, 17 Aug 2023 05:45:02 +0000 (05:45 +0000)] 
power: pmic: rk8xx: Use sysreset implementation of the poweroff command

Select SYSRESET_CMD_POWEROFF to use the sysreset implementation of the
poweroff command when PMIC_RK8XX is enabled.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoconfigs: rockchip: rk3308: enable CONFIG_OF_LIBFDT_OVERLAY
FUKAUMI Naoki [Mon, 11 Sep 2023 10:01:21 +0000 (19:01 +0900)] 
configs: rockchip: rk3308: enable CONFIG_OF_LIBFDT_OVERLAY

enable CONFIG_OF_LIBFDT_OVERLAY and use it on Radxa ROCK Pi S.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
2 years agoconfigs: rockchip: rk3308: use CONFIG_DEFAULT_FDT_FILE
FUKAUMI Naoki [Mon, 11 Sep 2023 10:01:20 +0000 (19:01 +0900)] 
configs: rockchip: rk3308: use CONFIG_DEFAULT_FDT_FILE

all rk3308 boards should use their own dtb file.

also, change fdt_addr_r to avoid following error:
 "ERROR: Did not find a cmdline Flattened Device Tree"
it happens on Radxa ROCK Pi S (256MB/512MB) with kernel built from
Radxa BSP.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
2 years agoarm: dts: rockchip: rock-5b: add support for PCIe3 and NVMe
FUKAUMI Naoki [Tue, 5 Sep 2023 11:47:36 +0000 (20:47 +0900)] 
arm: dts: rockchip: rock-5b: add support for PCIe3 and NVMe

this patch adds support for PCIe3 (M.2 M key) and enables NVMe.

 => pci
 BusDevFun  VendorId   DeviceId   Device Class       Sub-Class
 _____________________________________________________________
 00.00.00   0x1d87     0x3588     Bridge device           0x04
 01.00.00   0x10ec     0x8125     Network controller      0x00
 02.00.00   0x1d87     0x3588     Bridge device           0x04
 03.00.00   0x1179     0x011a     Mass storage controller 0x08
 => nvme scan
 => nvme info
 Device 0: Vendor: 0x1179 Rev: AGHA4101 Prod: 79CA20WPKRYN
             Type: Hard Disk
             Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: sync DT for RK3588 series with Linux
FUKAUMI Naoki [Tue, 5 Sep 2023 11:47:35 +0000 (20:47 +0900)] 
arm: dts: rockchip: sync DT for RK3588 series with Linux

Sync the device tree for RK3588 series with Linux 6.6-rc1.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoconfigs: rockchip: rock-pi-s: use default bootdelay (2s)
FUKAUMI Naoki [Mon, 11 Sep 2023 10:05:08 +0000 (19:05 +0900)] 
configs: rockchip: rock-pi-s: use default bootdelay (2s)

align with other boards.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoconfigs: rockchip: add DOS_PARTITION to RK3308 boards defconfig
Massimo Pegorer [Sun, 1 Oct 2023 14:15:29 +0000 (16:15 +0200)] 
configs: rockchip: add DOS_PARTITION to RK3308 boards defconfig

Without DOS_PARTITION support U-Boot is not able to boot an OS stored
into an SD card with MBR partitions table. This is still a quite common
case so add DOS_PARTITION (only for U-Boot proper build) to Rockchip
RK3308 EVB, Radxa ROCK Pi S and Firefly roc-rk3308-cc boards: they are
the only RK boards missing of DOS_PARTITION.

Reported-by: Jayantajit Gogoi <jayanta.gogoi525@gmail.com>
Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoboard: rockchip: Add Bananapi R2Pro Board
Frank Wunderlich [Wed, 4 Oct 2023 19:04:34 +0000 (21:04 +0200)] 
board: rockchip: Add Bananapi R2Pro Board

Add Bananapi R2 Pro board.

tested:
- sdcard
- both front usb-ports
- sata
- wan-port

lan-ports are connected to mt7531 switch where driver needs to be
separated from mtk ethernet-driver.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
2 years agoconfigs: rockchip: Enable ethernet driver on RK3588 boards
Jonas Karlman [Sun, 1 Oct 2023 19:17:22 +0000 (19:17 +0000)] 
configs: rockchip: Enable ethernet driver on RK3588 boards

Enable DWC_ETH_QOS_ROCKCHIP and related PHY driver on RK3588 boards that
have an enabled gmac node and drop ETH_DESIGNWARE and GMAC_ROCKCHIP for
remaining RK3588 boards.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoconfigs: rockchip: Enable ethernet driver on RK356x boards
Jonas Karlman [Sun, 1 Oct 2023 19:17:21 +0000 (19:17 +0000)] 
configs: rockchip: Enable ethernet driver on RK356x boards

Enable DWC_ETH_QOS_ROCKCHIP and related PHY driver on RK356x boards that
have an enabled gmac node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agonet: dwc_eth_qos_rockchip: Add support for RK3588
Jonas Karlman [Sun, 1 Oct 2023 19:17:20 +0000 (19:17 +0000)] 
net: dwc_eth_qos_rockchip: Add support for RK3588

Add rk_gmac_ops and other special handling that is needed for GMAC to
work on RK3588.

rk_gmac_ops was ported from linux commits:
2f2b60a0ec28 ("net: ethernet: stmmac: dwmac-rk: Add gmac support for rk3588")
88619e77b33d ("net: stmmac: rk3588: Allow multiple gmac controller")

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc_eth_qos: Add glue driver for GMAC on Rockchip RK3568
Jonas Karlman [Sun, 1 Oct 2023 19:17:19 +0000 (19:17 +0000)] 
net: dwc_eth_qos: Add glue driver for GMAC on Rockchip RK3568

Add a new glue driver for Rockchip SoCs, i.e RK3568, with a GMAC based
on Synopsys DWC Ethernet QoS IP.

rk_gmac_ops was ported from linux commit:
3bb3d6b1c195 ("net: stmmac: Add RK3566/RK3568 SoC support")

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc_eth_qos: Stop spam of RX packet not available message
Jonas Karlman [Sun, 1 Oct 2023 19:17:18 +0000 (19:17 +0000)] 
net: dwc_eth_qos: Stop spam of RX packet not available message

Remove spam of RX packet not available debug messages when waiting to
receive a packet.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc_eth_qos: Return error code when start fails
Jonas Karlman [Sun, 1 Oct 2023 19:17:17 +0000 (19:17 +0000)] 
net: dwc_eth_qos: Return error code when start fails

Return error code when phy_connect fails or no link can be established.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dwc_eth_qos: Drop unused rx_pkt from eqos_priv
Jonas Karlman [Sun, 1 Oct 2023 19:17:16 +0000 (19:17 +0000)] 
net: dwc_eth_qos: Drop unused rx_pkt from eqos_priv

rx_pkt is allocated and not used for anything, remove it.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agorockchip: Add support to generate LZMA compressed U-boot binary
Manoj Sai [Sun, 17 Sep 2023 19:26:28 +0000 (00:56 +0530)] 
rockchip: Add support to generate LZMA compressed U-boot binary

Add support for generating a LZMA-compressed U-boot binary with the
help of binman, if CONFIG_SPL_LZMA is selected.

Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: Add support to generate GZIP compressed U-boot binary
Manoj Sai [Sun, 17 Sep 2023 19:26:27 +0000 (00:56 +0530)] 
rockchip: Add support to generate GZIP compressed U-boot binary

Add support for generating a GZIP-compressed U-boot binary with the
help of binman, if CONFIG_SPL_GZIP is selected.

Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agospl: fit: support for booting a LZMA-compressed U-boot binary
Manoj Sai [Sun, 17 Sep 2023 19:26:26 +0000 (00:56 +0530)] 
spl: fit: support for booting a LZMA-compressed U-boot binary

If LZMA Compression support is enabled, LZMA compressed U-Boot
binary will be placed at a specified RAM location which is
defined at CONFIG_SYS_LOAD_ADDR and will be assigned  as the
source address.

image_decomp() function, will decompress the LZMA compressed
U-Boot binary which is placed at source address(CONFIG_SYS_LOAD_ADDR)
to the default CONFIG_SYS_TEXT_BASE location.

spl_load_fit_image function will load the decompressed U-Boot
binary, which is placed at the CONFIG_SYS_TEXT_BASE location.

Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agospl: fit: support for booting a GZIP-compressed U-boot binary
Manoj Sai [Sun, 17 Sep 2023 19:26:25 +0000 (00:56 +0530)] 
spl: fit: support for booting a GZIP-compressed U-boot binary

If GZIP Compression support is enabled, GZIP compressed U-Boot binary
will be at a specified RAM location which is defined at
CONFIG_SYS_LOAD_ADDR and will be assign it as the source address.

gunzip function in spl_load_fit_image ,will decompress the GZIP
compressed U-Boot binary which is placed at
source address(CONFIG_SYS_LOAD_ADDR)  to the default
CONFIG_SYS_TEXT_BASE location.

spl_load_fit_image function will load the decompressed U-Boot
binary, which is placed at the CONFIG_SYS_TEXT_BASE location.

Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agodoc: rockchip: Update and improve info on rk3308, TPL and TF-A
Massimo Pegorer [Sat, 9 Sep 2023 09:33:33 +0000 (11:33 +0200)] 
doc: rockchip: Update and improve info on rk3308, TPL and TF-A

Update and improve documentation about build steps for SoCs that
require using TF-A and TPL binaries provided by Rockchip, such as
rk3308. Add rk3308 boards case to rST document. Add ROCK Pi S in
the list of supported boards. Minor page format improvements.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: Kconfig: Enable external TPL binary for rk3308
Massimo Pegorer [Sat, 9 Sep 2023 09:33:24 +0000 (11:33 +0200)] 
rockchip: Kconfig: Enable external TPL binary for rk3308

There is no support to initialize DRAM on rk3308 SoC using U-Boot
TPL or SPL, and therefore an external TPL binary must be used to
package a bootable u-boot-rockchip.bin image.

Default ROCKCHIP_EXTERNAL_TPL to yes if ROCKCHIP_RK3308.
Remove useless TPL_SERIAL.

Signed-off-by: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Tested-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: board: Add minimal generic RK3566/RK3568 board
Jonas Karlman [Mon, 21 Aug 2023 22:30:29 +0000 (22:30 +0000)] 
rockchip: board: Add minimal generic RK3566/RK3568 board

Add a minimal generic RK3566/RK3568 board that only have eMMC and SDMMC
enabled. This defconfig can be used to boot from eMMC or SD-card on most
RK3566/RK3568 boards that follow reference board design.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: Port IO-domain driver for RK3568 from linux
Jonas Karlman [Mon, 21 Aug 2023 22:30:28 +0000 (22:30 +0000)] 
rockchip: Port IO-domain driver for RK3568 from linux

Port the Rockchip IO-domain driver for RK3568 from linux.

The driver auto probe after bind to configure IO-domain based on the
regulator voltage. Compared to the linux driver this driver is not
notified about regulator voltage changes and only configure IO-domain
based on the initial voltage autoset by the regulator.

It is not recommended to enable MMC_IO_VOLTAGE or the mmc signal voltage
and IO-domain may end up out of sync.

Based on the linux commit 28b05a64e47c ("soc: rockchip: io-domain: add
rk3568 support").

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoregulator: rk8xx: Return correct voltage for switchout converters
shengfei Xu [Mon, 21 Aug 2023 22:30:26 +0000 (22:30 +0000)] 
regulator: rk8xx: Return correct voltage for switchout converters

The voltage value for switchout converters is always reported as 0 uV.
When the switch is enabled, it's voltage is same as input supply.

Fix this by implementing get_value for switchout converters.

Fixes: ee30068fa574 ("power: pmic: rk809: support rk809 pmic")
Signed-off-by: shengfei Xu <xsf@rock-chips.com>
[jonas@kwiboo.se: fix checkpatch error, update commit message]
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoregulator: rk8xx: Return correct voltage for buck converters
Joseph Chen [Mon, 21 Aug 2023 22:30:25 +0000 (22:30 +0000)] 
regulator: rk8xx: Return correct voltage for buck converters

Information from the first range group is always used to calculate the
voltage returned for buck converters. This may result in wrong voltage
reported back to the regulator_get_value caller.

Traverse all the possible BUCK ranges to fix this issue.

Fixes: addd062beacc ("power: pmic: rk816: support rk816 pmic")
Fixes: b62280745e55 ("power: pmic: rk805: support rk805 pmic")
Fixes: b4a35574b38d ("power: pmic: rk817: support rk817 pmic")
Fixes: ee30068fa574 ("power: pmic: rk809: support rk809 pmic")
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
[jonas@kwiboo.se: fix checkpatch error, simplify buck get_value, update commit message]
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agopower: regulator: Only run autoset once for each regulator
Jonas Karlman [Mon, 21 Aug 2023 22:30:24 +0000 (22:30 +0000)] 
power: regulator: Only run autoset once for each regulator

With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter"), keeping regulator enablement in balance become more important.
Calling regulator_autoset multiple times on a fixed regulator increase
the enable count for each call, resulting in an unbalanced enable count.

Introduce a AUTOSET_DONE flag and use it to mark that autoset has run
for the regulator. Return -EALREADY on any subsequent call to autoset.

This fixes so that the enable count is only ever increased by one per
regulator for autoset.

Fixes: 4fcba5d556b4 ("regulator: implement basic reference counter")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3568-nanopi-r5: Enable PCIe on NanoPi R5C and R5S
Jonas Karlman [Wed, 2 Aug 2023 19:59:33 +0000 (19:59 +0000)] 
rockchip: rk3568-nanopi-r5: Enable PCIe on NanoPi R5C and R5S

Enable missing PCIe Kconfig options now that PCIe bifurcation is fixed
to make use of the two on-board RTL8125B and the M.2 slot on NanoPi R5C
and NanoPi R5S.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3568-nanopi-r5: Update defconfig for NanoPi R5C and R5S
Jonas Karlman [Wed, 2 Aug 2023 19:49:46 +0000 (19:49 +0000)] 
rockchip: rk3568-nanopi-r5: Update defconfig for NanoPi R5C and R5S

Update and sync Kconfig options for NanoPi R5C and NanoPi R5S with other
RK3568 boards.

SPL_FIT_SIGNATURE is enabled to add a checksum validation of the FIT
payload, also add LEGACY_IMAGE_FORMAT to keep boot scripts working.

OF_SPL_REMOVE_PROPS, SPL_DM_SEQ_ALIAS and SPL_PINCTRL change ensure
pinctrl for eMMC, SD-card and UART2 is applied in SPL.

MMC_HS200_SUPPORT and SPL counterpart is enabled to speed up eMMC load
times from on-board eMMC 5.1 modules.

Drop remaining unused or unsupported options to sync with other RK3568
boards.

Also sync device tree from linux v6.4 and drop u-boot,spl-boot-order and
use the default from rk356x-u-boot.dtsi.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophy: rockchip: naneng-combphy: Use signal from comb PHY on RK3588
Jonas Karlman [Wed, 2 Aug 2023 19:41:22 +0000 (19:41 +0000)] 
phy: rockchip: naneng-combphy: Use signal from comb PHY on RK3588

Route signal from comb PHY instead of PCIe3 PHY to PCIe1l0 and PCIe1l1.

Fixes use of pcie2x1l0 on ROCK 5B.

Code imported from mainline linux driver.

Fixes: c5b4a012bca8 ("phy: rockchip: naneng-combphy: Support rk3588")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophy: rockchip: snps-pcie3: Add support for RK3588
Jonas Karlman [Wed, 2 Aug 2023 19:04:32 +0000 (19:04 +0000)] 
phy: rockchip: snps-pcie3: Add support for RK3588

Add support for the RK3588 variant to the driver.

Code imported almost 1:1 from mainline linux driver.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophy: rockchip: snps-pcie3: Add bifurcation support for RK3568
Jonas Karlman [Wed, 2 Aug 2023 19:28:33 +0000 (19:28 +0000)] 
phy: rockchip: snps-pcie3: Add bifurcation support for RK3568

Configure aggregation or bifurcation mode on RK3568 based on the value
of data-lanes property.

Code imported almost 1:1 from mainline linux driver.

Fixes: 6ec62b6ca698 ("phy: rockchip: Add Rockchip Synopsys PCIe 3.0 PHY")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophy: rockchip: snps-pcie3: Refactor to use a phy_init ops
Jonas Karlman [Wed, 2 Aug 2023 19:04:30 +0000 (19:04 +0000)] 
phy: rockchip: snps-pcie3: Refactor to use a phy_init ops

Add a phy_init ops in preparation for upcoming support of a RK3588
variant in the driver.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agophy: rockchip: snps-pcie3: Refactor to use clk_bulk API
Jonas Karlman [Wed, 2 Aug 2023 19:04:29 +0000 (19:04 +0000)] 
phy: rockchip: snps-pcie3: Refactor to use clk_bulk API

Change to use clk_bulk API and syscon_regmap_lookup_by_phandle to
simplify in preparation for upcoming support of a RK3588 variant.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agopci: pcie_dw_rockchip: Configure number of lanes and link width speed
Jonas Karlman [Wed, 2 Aug 2023 19:25:51 +0000 (19:25 +0000)] 
pci: pcie_dw_rockchip: Configure number of lanes and link width speed

Set number of lanes and link width speed control register based on the
num-lanes property.

Code imported almost 1:1 from dw_pcie_setup in mainline linux.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoMerge branch '2023-10-06-spl-prepare-for-universal-payload'
Tom Rini [Fri, 6 Oct 2023 21:23:47 +0000 (17:23 -0400)] 
Merge branch '2023-10-06-spl-prepare-for-universal-payload'

To quote the author:
This series tidies up SPL a little and adds some core ofnode functions
needed to support Universal Payload. It also includes a few minor
fix-ups for sandbox.

For SPL the changes include CONFIG naming, removing various #ifdefs and
tidying up the FIT code.

One notable piece of the ofnode improvements is support for flattening a
livetree. This should be useful in future as we move FDT fixups to use
the ofnode API.

2 years agopci: serial: Support reading PCI-register size with base
Simon Glass [Tue, 26 Sep 2023 14:14:58 +0000 (08:14 -0600)] 
pci: serial: Support reading PCI-register size with base

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Tweak device_is_on_pci_bus() for code size
Simon Glass [Tue, 26 Sep 2023 14:14:57 +0000 (08:14 -0600)] 
dm: core: Tweak device_is_on_pci_bus() for code size

This function cannot return true if PCI is not enabled, since no PCI
devices will have been bound. Add a check for this to reduce code size
where it is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoserial: Drop ns16550 serial_getinfo() in SPL
Simon Glass [Tue, 26 Sep 2023 14:14:56 +0000 (08:14 -0600)] 
serial: Drop ns16550 serial_getinfo() in SPL

This is typically not needed in SPL/TPL and increases the code size.
Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agospl: Add C-based runtime detection of SPL
Simon Glass [Tue, 26 Sep 2023 14:14:55 +0000 (08:14 -0600)] 
spl: Add C-based runtime detection of SPL

The spl_phase() function indicates whether U-Boot is in SPL and before
or after relocation. But sometimes it is useful to check for SPL with
zero code-size impact. Since spl_phase() checks the global_data flags,
it does add a few bytes.

Add a new spl_in_proper() function to check if U-Boot proper is
running, regardless of the relocation status.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agocommand: Include a required header in command.h
Simon Glass [Wed, 27 Sep 2023 14:22:37 +0000 (08:22 -0600)] 
command: Include a required header in command.h

This uses ARRAY_SIZE() but does not include the header file which declares
it. Fix this, so that command.h can be included without common.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2 years agobloblist: Add missing name
Simon Glass [Tue, 26 Sep 2023 14:14:52 +0000 (08:14 -0600)] 
bloblist: Add missing name

Add a missing bloblist name.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agobloblist: Support initing from multiple places
Simon Glass [Tue, 26 Sep 2023 14:14:51 +0000 (08:14 -0600)] 
bloblist: Support initing from multiple places

Typically the bloblist is set up after the devicetree is present. This
makes sense because bloblist may use malloc() to allocate the space it
needs.

However sometimes the devicetree itself may be present in the bloblist.
In that case it is at a known location in memory so we can init the
bloblist very early, before devicetree.

Add a flag to indicate whether the bloblist has been inited. Add a
function to init it only if needed. Use that in the init sequence.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Move the bloblist down a little in memory
Simon Glass [Tue, 26 Sep 2023 14:14:50 +0000 (08:14 -0600)] 
sandbox: Move the bloblist down a little in memory

Move this down by 4KB so that it is large enough to hold the devicetree.

Also fix up the devicetree address in the documetation while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Only read the state if we have a state file
Simon Glass [Tue, 26 Sep 2023 14:14:49 +0000 (08:14 -0600)] 
sandbox: Only read the state if we have a state file

We should not read this unless requested. Make it conditional on the
option being provided.

Add some debugging to show the state being written.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Init the EC properly even if no state file is available
Simon Glass [Tue, 26 Sep 2023 14:14:48 +0000 (08:14 -0600)] 
sandbox: Init the EC properly even if no state file is available

This currently relies on sandbox attempting to read a state file. At
present it always does, even when there is no state file, in which case it
fails, but still inits the EC.

That is a bug, so update this driver to set the current image always, even
if no state is read.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Move reading the RAM buffer into a better place
Simon Glass [Tue, 26 Sep 2023 14:14:47 +0000 (08:14 -0600)] 
sandbox: Move reading the RAM buffer into a better place

This should not happen in the argument-parsing function. Move it to the
main program.

Add some debugging for reading/writing.

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