]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
20 months agotest: cmd: fdt: Test fdt get name
Marek Vasut [Thu, 2 Mar 2023 03:08:33 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get name

Add 'fdt get name' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get name of / node 0, 1 and /clk-test node 0
- Compare output and validate the node name
- Get name of / node 2 and /clk-test node 1
- Compare output and validate the node is not present
- Get name of / node -1 and /clk-test node -1
- Compare output and validate the node name equals node 0 name
- Check nonexistent node, verify the command errors out

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt resize
Marek Vasut [Thu, 2 Mar 2023 03:08:31 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt resize

Add 'fdt resize' test which works as follows:
- Create simple FDT with extra size 0, map it to sysmem
- 'resize' the FDT by 0x2000 bytes
- Verify the new space has been added to the FDT

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test fdt move
Marek Vasut [Thu, 2 Mar 2023 03:08:30 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt move

Add 'fdt move' test which works as follows:
- Create simple FDT, map it to sysmem
- 'move' the FDT into new zeroed out sysmem location
- Verify newly active FDT is in the new location
- Compare both locations

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test both string and integer arrays in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:29 +0000 (04:08 +0100)]
test: cmd: fdt: Test both string and integer arrays in 'fdt get value'

The 'fdt get value' subcommand now supports extraction of integer value
from integer arrays, add test for it, including a test for special case
unindexed integer array read, which is handled as hash and treated as a
long string instead of integer.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Test alias resolution in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:28 +0000 (04:08 +0100)]
test: cmd: fdt: Test alias resolution in 'fdt get value'

The 'fdt' command help contains the following note:
"
Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.
"
Add test for it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Generate fuller DT internally and switch fdt get value to it
Marek Vasut [Thu, 2 Mar 2023 03:08:27 +0000 (04:08 +0100)]
test: cmd: fdt: Generate fuller DT internally and switch fdt get value to it

Implement function to generate internal test DT fragment and switch
the 'fdt get value' test to this instead of depending on the sandbox
DT. Rename clk-test node to test-node node. This FDT fragment will be
reused by other tests. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()
Marek Vasut [Thu, 2 Mar 2023 03:08:26 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()

The 'fdt get' command has a 'get value' subcommand, rename the fdt_test_get()
to fdt_test_get_value() to avoid confusion about what it is testing. There is
currently no get 'get name', 'get addr', 'get size' subcommand test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()
Marek Vasut [Thu, 2 Mar 2023 03:08:25 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()

The 'fdt' command has a 'resize' subcommand, rename the fdt_test_resize()
to fdt_test_addr_resize() to avoid confusion about what it is testing.
There is currently no resize test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agotest: Add ut_assert_nextline_empty() empty line helper
Marek Vasut [Thu, 2 Mar 2023 03:08:24 +0000 (04:08 +0100)]
test: Add ut_assert_nextline_empty() empty line helper

Add helper macro to test for empty lines, which is an inobvious
wrapper around ut_assert_nextline("%s", "") .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Add support for integer arrays in fdt get value with index
Marek Vasut [Thu, 2 Mar 2023 03:08:23 +0000 (04:08 +0100)]
cmd: fdt: Add support for integer arrays in fdt get value with index

Currently any integer array value is set as long up-to-40 character
hexadecimal string into environment variable when extracted from an
FDT using 'fdt get value path prop index', because the support for
handling integer arrays is not implemented, and fdt_value_env_set()
code falls back into the hash handling behavior instead.

Implement this support simply by checking whether user supplied any
index. If index is set and the property length is multiple of four,
then this is an integer array, and the code would extract value at
specified index.

There is a subtle change where default index is set to -1 instead of 0.
This is OK, since the only place which checks for index to be less or
equal zero is the string array handling code in fdt_value_env_set() and
that code would work perfectly well with index -1 too.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Map address returned from fdt get addr to sysmem
Marek Vasut [Thu, 2 Mar 2023 03:08:22 +0000 (04:08 +0100)]
cmd: fdt: Map address returned from fdt get addr to sysmem

The address returned from 'fdt get addr' command must be mapped
into sysmem, as this is a working FDT. Access to this address
without mapping it would lead to crash e.g. in sandbox.

The following command triggers the crash:
"
./u-boot -Dc 'fdt addr $fdtcontroladdr ; fdt get addr var / compatible ; md $var'
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Handle 64bit pointers in fdt get addr
Marek Vasut [Thu, 2 Mar 2023 03:08:21 +0000 (04:08 +0100)]
cmd: fdt: Handle 64bit pointers in fdt get addr

The command assumed 32bit pointers so far, with 64bit pointer the
command would overwrite a piece of stack. Fix it by extending the
array size to cater for 64bit pointer, and use snprintf() to avoid
writing past the end of the array ever again.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Align checksign parameter names in help text
Marek Vasut [Thu, 2 Mar 2023 03:08:20 +0000 (04:08 +0100)]
cmd: fdt: Align checksign parameter names in help text

The help text references 'addr' as an optional key start address,
but the explanation references the same as 'start', make sure they
both read as 'addr'. Also update the abbreviated 'addr' in the
explanation to 'address'.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Check argc before accessing argv in fdt memory
Marek Vasut [Thu, 2 Mar 2023 03:08:19 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt memory

On case 'fdt memory' is invoked without parameters, argv[2]/argv[3]
is not valid and this command would SEGFAULT in sandbox environment.
Add missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Check argc before accessing argv in fdt bootcpu
Marek Vasut [Thu, 2 Mar 2023 03:08:18 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt bootcpu

On case 'fdt bootcpu' is invoked without parameters, argv[2] is not
valid and this command would SEGFAULT in sandbox environment. Add
missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:17 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space

In case 'fdt rsvmem delete index' is passed a non-existent index, one
which does not exist in 'fdt rsvmem print', then the following command
triggers a print of help message for 'fdt' command instead of erroring
out:
=> fdt rsvmem delete 1234
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest
of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix fdt rm behavior on non-existent property and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:16 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rm behavior on non-existent property and error message space

In case an FDT contains a node '/test-node@1234' , with no property
called 'noprop' in that node, the following command triggers a print
of help message for 'fdt' command instead of erroring out:
=> fdt rm /test-node@1234 noprop
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_delprop() in error message with the rest of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
Marek Vasut [Thu, 2 Mar 2023 03:08:15 +0000 (04:08 +0100)]
cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size

It is perfectly valid to request an address or size of FDT property
without value, the only special case if requesting of the value of
FDT property without value. Invert the test such, that properties
without value still set the variable from 'fdt get addr/size' to
address of the property or size of the property, where the later
is 0.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agocmd: fdt: Import is_printable_string() from DTC to fix u32 misprint
Marek Vasut [Thu, 2 Mar 2023 03:08:14 +0000 (04:08 +0100)]
cmd: fdt: Import is_printable_string() from DTC to fix u32 misprint

Import is_printable_string() implementation from DTC 1.7.0 as of
DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print
of u32 property which so far used to be printed as string by U-Boot
fdt print command.

We might see the case where the parsed property value, in this case
it is a 32-bit integer, identified as a printable string or a null byte
(concatenated strings) because of its last character happens to be:
  0x00 (null character), 0xB (vertical tab character) or
  0x10 (line feed character)
In this situation, if the string is identified as printable string,
it will be displayed as character instead of hex value

When the isprint() condition is true, there are two possibilities:
  1) The character is ASCII character (except the first 32)
  2) The character is extended ASCII character

For example,
NG property in device tree:
    clock-frequency = <16640000>;
by default, would be displayed as
    clock-frequency = "", "ýè";
and with this patch applied, would be displayed as
    clock-frequency = <0x00fde800>;

Full investigation was done by Nam and Hai, patch reworked by Marek
to use common code from DTC.

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 6 Mar 2023 19:56:05 +0000 (14:56 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Use 4K sector for Thecus N2350 SPI flash (Tony)

20 months agoarm: mvebu: Use 4K sector for Thecus N2350 SPI flash
Tony Dinh [Fri, 17 Feb 2023 03:34:31 +0000 (19:34 -0800)]
arm: mvebu: Use 4K sector for Thecus N2350 SPI flash

Since the SPI flash chip mx25l3205d on this board has 4K-sector
capability, enable it for the envs.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
20 months agoMerge tag 'dm-pull-29feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 1 Mar 2023 21:07:24 +0000 (16:07 -0500)]
Merge tag 'dm-pull-29feb23' of https://source.denx.de/u-boot/custodians/u-boot-dm

minor sandbox fixes
a37xx fix
Add camel-case tool, since the conversion will take a while

20 months agotools: binman: minor formatting fix in docs
Ralph Siemsen [Wed, 22 Feb 2023 20:56:59 +0000 (15:56 -0500)]
tools: binman: minor formatting fix in docs

This should fix a rendering oddity when viewing the docs online at
https://u-boot.readthedocs.io/en/latest/develop/package/binman.html

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: fix building with CONFIG_SPL_TIMER=y
Heinrich Schuchardt [Wed, 22 Feb 2023 00:39:18 +0000 (01:39 +0100)]
sandbox: fix building with CONFIG_SPL_TIMER=y

Building sandbox_defconfig with CONFIG_SPL_TIMER=y results in an error

    include/dm/platdata.h:63:33: error: static assertion failed:
    "Cannot use U_BOOT_DRVINFO with of-platdata.
    Please use devicetree instead"

Add a missing condition in the sandbox driver.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoMAINTAINERS: assign sandbox drivers to SANDBOX
Heinrich Schuchardt [Sat, 18 Feb 2023 09:38:11 +0000 (10:38 +0100)]
MAINTAINERS: assign sandbox drivers to SANDBOX

Drivers should have a maintainer.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: allow building sandbox_spl with CONFIG_DEBUG
Heinrich Schuchardt [Sat, 18 Feb 2023 08:33:51 +0000 (09:33 +0100)]
sandbox: allow building sandbox_spl with CONFIG_DEBUG

Building sandbox_spl with CONFIG_DEBUG leads to errors due to missing
symbols:

    /usr/bin/ld: common/spl/spl_fit.o: in function `spl_fit_upload_fpga':
    common/spl/spl_fit.c:595: undefined reference to `fpga_load'
    /usr/bin/ld: test/test-main.o: in function `dm_test_post_run':
    test/test-main.c:124: undefined reference to `crc8'
    /usr/bin/ld: test/test-main.o: in function `dm_test_pre_run':
    test/test-main.c:95: undefined reference to `crc8'
    collect2: error: ld returned 1 exit status

This is due to -Og not eliminating unused functions.

Add FPGA and CRC8 support to the defconfig. Sandbox tests for
SPL_FPGA and CRC8 should be created. So enabling these setting
is advised anyway.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agoarm64: a37xx: pinctrl: probe after binding
Robert Marko [Tue, 17 Jan 2023 14:08:15 +0000 (15:08 +0100)]
arm64: a37xx: pinctrl: probe after binding

Currently, pinctrl drivers are getting probed during post-bind, however
that is being reverted, and on A37XX pinctrl driver is the one that
registers the GPIO driver during the probe.

So, if the pinctrl driver doesn't get probed GPIO-s won't get registered
and thus they cannot be used.

This is a problem on the Methode eDPU as it just uses SB pins as GPIO-s
and without them being registered networking won't work as it only has
one SFP slot and the TX disable GPIO is on the SB controller.

So, lets just add a flag only to A37XX driver to probe after binding
in order for the GPIO driver to always get registered.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Simon Glass <sjg@chromium.org>
20 months agosandbox: Correctly define BITS_PER_LONG
Michal Suchanek [Sat, 22 Oct 2022 21:22:01 +0000 (23:22 +0200)]
sandbox: Correctly define BITS_PER_LONG

SANDBOX_BITS_PER_LONG is the number of bits in long on the sandbox
platform.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
20 months agoRFC: tools: Add a camel-case conversion script
Simon Glass [Sat, 29 Jan 2022 21:14:20 +0000 (14:14 -0700)]
RFC: tools: Add a camel-case conversion script

This is only for posterity, since once the conversion is done, the script
is of no use.

Signed-off-by: Simon Glass <sjg@chromium.org>
20 months agoMerge tag 'u-boot-at91-fixes-2023.04-a' of https://source.denx.de/u-boot/custodians...
Tom Rini [Wed, 1 Mar 2023 14:39:18 +0000 (09:39 -0500)]
Merge tag 'u-boot-at91-fixes-2023.04-a' of https://source.denx.de/u-boot/custodians/u-boot-at91

First set of u-boot-at91 fixes for the 2023.04 cycle:

This fixes set include one clock index fix for sama7g5 and two board
configuration alignments for pm9g45.

20 months agoMerge tag 'u-boot-rockchip-20230228' of https://source.denx.de/u-boot/custodians...
Tom Rini [Wed, 1 Mar 2023 01:24:25 +0000 (20:24 -0500)]
Merge tag 'u-boot-rockchip-20230228' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

Please pull the updates for rockchip platform:
- Add support for rk3588 soc;
- Add rk3588 Edgeble Neu6 board and Radxa ROCK5B board;
- Add rk3308 Radxa ROCK Pi S board;
- Add rk3568 Radxa ROCK 3 board,
- Add rk3566 Radxa Compute Module 3 board;
- Add support for sdram reg info version 3
- Refactor rockchip OTP/eFuse driver and add more soc support;
- Add external TPL support for binman;

binman support for mkimage ignore missing entry is based on [1];

[1] https://patchwork.ozlabs.org/project/uboot/patch/20230219220158.4160763-7-jonas@kwiboo.se/

20 months agoboard: rock5b-rk3588: add memory gaps into kernel's DTB
Eugen Hristev [Wed, 22 Feb 2023 09:05:13 +0000 (11:05 +0200)]
board: rock5b-rk3588: add memory gaps into kernel's DTB

RK3588 has two memory gaps when using 16 GiB DRAM size:
[0x3fc000000 , 0x3fc500000]
and
[0x3fff00000 , 0x3ffffffff]

If the kernel is agnostic to these gaps, accessing the area causes
a SError panic.

Hence, add reserved memory areas in kernel's DTB before booting.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoboard: rockchip: add Radxa ROCK5B Rk3588 board
Eugen Hristev [Wed, 22 Feb 2023 09:05:12 +0000 (11:05 +0200)]
board: rockchip: add Radxa ROCK5B Rk3588 board

ROCK 5B is a Rockchip RK3588 based SBC (Single Board Computer) by Radxa.

There are tree variants depending on the DRAM size : 4G, 8G and 16G.

Specification:

    Rockchip Rk3588 SoC
    4x ARM Cortex-A76, 4x ARM Cortex-A55
    4/8/16GB memory LPDDR4x
    Mali G610MC4 GPU
    MIPI CSI 2 multiple lanes connector
    eMMC module connector
    uSD slot (up to 128GB)
    2x USB 2.0, 2x USB 3.0
    2x HDMI output, 1x HDMI input
    Ethernet port
    40-pin IO header including UART, SPI, I2C and 5V DC power in
    USB PD over USB Type-C
    Size: 85mm x 54mm

Kernel commits:
a1d3281450ab ("arm64: dts: rockchip: Add rock-5b board")
6fb13f888f2a ("arm64: dts: rockchip: Update sdhci alias for rock-5b")

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoclk: rockchip: rk3568: add more supported clk rates for sdmmc and emmc
Vasily Khoruzhick [Thu, 23 Feb 2023 21:03:32 +0000 (13:03 -0800)]
clk: rockchip: rk3568: add more supported clk rates for sdmmc and emmc

SDHCI driver may attempt to set 26MHz clock, but clk_rk3568
will return error in this case. Apparently, SDHCI silently ignores the
error and as a result eMMC initialization fails.

Add 25 MHz and 26 MHz clk rates for sdmmc and emmc on rk3568 to fix that.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3588: Read cpuid from otp
Jonas Karlman [Wed, 22 Feb 2023 22:44:41 +0000 (22:44 +0000)]
rockchip: rk3588: Read cpuid from otp

Read cpuid from otp and set ethaddr for RK3588.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3568: Read cpuid from otp
Jonas Karlman [Wed, 22 Feb 2023 22:44:41 +0000 (22:44 +0000)]
rockchip: rk3568: Read cpuid from otp

The cpuid on RK3568 is located at 0xa instead of 0x7 as all other SoCs.
Add and use a CFG_CPUID_OFFSET to define this offset.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: misc: Set eth1addr mac address
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)]
rockchip: misc: Set eth1addr mac address

Set eth1addr in addition to ethaddr.

Also allow fdt fixup of ethernet mac addresses when CMD_NET is disabled.
Set ethaddr and eth1addr based on HASH and SHA256 options.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: efuse: Add support for RK3036
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)]
rockchip: efuse: Add support for RK3036

Add support for rk3036 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: efuse: Add support for RK3128
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)]
rockchip: efuse: Add support for RK3128

Add support for rk3128 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: efuse: Add support for RK3328
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)]
rockchip: efuse: Add support for RK3328

Add support for rk3328 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: efuse: Add support for RK3288 and more
Jonas Karlman [Wed, 22 Feb 2023 22:44:40 +0000 (22:44 +0000)]
rockchip: efuse: Add support for RK3288 and more

Add support for rk3066a, rk3188, rk322x and rk3288 compatible.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: efuse: Refactor to use driver data and ops
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)]
rockchip: efuse: Refactor to use driver data and ops

Refactor the driver to use driver data and ops to simplify handling
of SoCs that require a unique read op.

Move handling of the aligned bounce buffer to main read op in order to
keep the SoC unique read op simple.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: otp: Add dump_otp debug command
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)]
rockchip: otp: Add dump_otp debug command

Add a simple debug command to dump the content of the otp.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: otp: Add support for RK3588
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)]
rockchip: otp: Add support for RK3588

Add support for rk3588 compatible.

Adjust offset using driver data in main read op.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: otp: Add support for RK3568
Jonas Karlman [Wed, 22 Feb 2023 22:44:39 +0000 (22:44 +0000)]
rockchip: otp: Add support for RK3568

Add support for rk3568 compatible.

Handle allocation of an aligned bounce buffer in main read op in order
to keep the SoC unique read op simple.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: otp: Refactor to use driver data and ops
Jonas Karlman [Wed, 22 Feb 2023 22:44:38 +0000 (22:44 +0000)]
rockchip: otp: Refactor to use driver data and ops

Refactor the driver to use driver data and ops to simplify handling
of SoCs that require a unique read op.

Use readl_poll_sleep_timeout instead of a custom poll loop, and add
validation of input parameter to main read op.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoboard: rockchip: Add Edgeble Neural Compute Module 6
Jagan Teki [Mon, 30 Jan 2023 14:57:49 +0000 (20:27 +0530)]
board: rockchip: Add Edgeble Neural Compute Module 6

Neural Compute Module 6(Neu2) is a 96boards SoM-CB compute module
based on Rockchip RK3588 from Edgeble AI.

General features:
- Rockchip RK3588
- up to 32GB LPDDR4x
- up to 128GB eMMC
- 2x MIPI CSI2 FPC

On module WiFi6/BT5 is available in the following Neu6 variants.

Neural Compute Module 6(Neu6) IO board is an industrial form factor
ready-to-use IO board from Edgeble AI.

IO board offers plenty of peripherals and connectivity options and
this patch enables basic eMMC and UART which is enough to successfully
boot Linux.

Neu6 needs to mount on top of this IO board in order to create a
complete Edgeble Neural Compute Module 6(Neu6) IO platform.

Boot log for the record,

DDR Version V1.08 20220617
LPDDR4X, 2112MHz
channel[0] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[1] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[2] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
channel[3] BW=16 Col=10 Bk=8 CS0 Row=16 CS1 Row=16 CS=2 Die BW=16 Size=2048MB
Manufacturer ID:0x6
CH0 RX Vref:31.7%, TX Vref:21.8%,21.8%
CH1 RX Vref:30.7%, TX Vref:22.8%,23.8%
CH2 RX Vref:30.7%, TX Vref:22.8%,22.8%
CH3 RX Vref:30.7%, TX Vref:21.8%,21.8%
change to F1: 528MHz
change to F2: 1068MHz
change to F3: 1560MHz
change to F0: 2112MHz
out

U-Boot SPL 2023.01-00952-g1d1785a516-dirty (Jan 30 2023 - 19:53:55 +0530)
Trying to boot from MMC1
INFO:    Preloader serial: 2
NOTICE:  BL31: v2.3():v2.3-391-g856309329:derrick.huang
NOTICE:  BL31: Built : 14:15:50, Jul 18 2022
INFO:    ext 32k is not valid
INFO:    GICv3 without legacy support detected.
INFO:    ARM GICv3 driver initialized in EL3
INFO:    system boots from cpu-hwid-0
INFO:    idle_st=0x21fff, pd_st=0x11fff9, repair_st=0xfff70001
INFO:    dfs DDR fsp_params[0].freq_mhz= 2112MHz
INFO:    dfs DDR fsp_params[1].freq_mhz= 528MHz
INFO:    dfs DDR fsp_params[2].freq_mhz= 1068MHz
INFO:    dfs DDR fsp_params[3].freq_mhz= 1560MHz
INFO:    BL31: Initialising Exception Handling Framework
INFO:    BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0xa00000
INFO:    SPSR = 0x3c9

U-Boot 2023.01-00952-g1d1785a516-dirty (Jan 30 2023 - 19:53:55 +0530)

Model: Edgeble Neu6A IO Board
DRAM:  7.5 GiB (effective 3.7 GiB)
Core:  71 devices, 15 uclasses, devicetree: separate
MMC:   mmc@fe2c0000: 0
Loading Environment from nowhere... OK
In:    serial@feb50000
Out:   serial@feb50000
Err:   serial@feb50000
Model: Edgeble Neu6A IO Board
Net:   No ethernet found.
Hit any key to stop autoboot:  0
=>

Add support for Edgeble Neu6 Model A IO Board.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoARM: dts: rockchip: rk3588s-u-boot: Add sdmmc node
Jagan Teki [Mon, 30 Jan 2023 14:57:47 +0000 (20:27 +0530)]
ARM: dts: rockchip: rk3588s-u-boot: Add sdmmc node

Booting from SDMMC is one of the fast and easy booting methods
for initial support of any SoC to upstream more features. 

This patch is trying to add the sdmmc node for rk3588 and added
as u-boot specific node in -u-boot.dtsi as upstream Linux is not
supporting yet.

As soon as Linux supports it, a sync of the Linux device tree
would eventually drop this node. 

Clock properties as added according to the rockchip mmc driver
but the actual definition might add scmi clocks into 0 and 1
indexes. This is due to scmi clock are not supporting in upstream
U-Boot. Properly addition of scmi clock would eventually follow
sdmmc clock definition of Linux once they upstreamed.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
20 months agoARM: dts: rockchip: Add rk3588-u-boot.dtsi
Jagan Teki [Mon, 30 Jan 2023 14:57:46 +0000 (20:27 +0530)]
ARM: dts: rockchip: Add rk3588-u-boot.dtsi

Add u-boot,dm-spl and u-boot,dm-pre-reloc related properties
for Rockchip RK3588 SoC to boot the SPL.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm: rockchip: Add RK3588 arch core support
Jagan Teki [Mon, 30 Jan 2023 14:57:45 +0000 (20:27 +0530)]
arm: rockchip: Add RK3588 arch core support

The Rockchip RK3588 is a ARM-based SoC with quad-core Cortex-A76
and quad-core Cortex-A55 including NEON and GPU, 6TOPS NPU,
Mali-G610 MP4, HDMI Out, HDMI In, DP, eDP, MIPI DSI, MIPI CSI2,
LPDDR4/4X/5, eMMC5.1, SD3.0/MMC4.5, USB OTG 3.0, Type-C, USB 2.0,
PCIe 3.0, SATA 3, Ethernet, SDIO3.0 I2C, UART, SPI, GPIO and PWM.

Add arch core support for it.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: rk3588: Add Edgeble Neu6 Model A IO
Jagan Teki [Mon, 30 Jan 2023 14:57:44 +0000 (20:27 +0530)]
arm64: dts: rockchip: rk3588: Add Edgeble Neu6 Model A IO

Neural Compute Module 6(Neu6) IO board is an industrial form factor
ready-to-use IO board from Edgeble AI.

IO board offers plenty of peripherals and connectivity options and
this patch enables basic eMMC and UART which is enough to successfully
boot Linux.

Neu6 needs to mount on top of this IO board in order to create a
complete Edgeble Neural Compute Module 6(Neu6) IO platform.

commit <a5079a534554> ("arm64: dts: rockchip: rk3588: Add Edgeble Neu6
Model A IO")

Add support for Edgeble Neu6 Model A IO Board.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: rk3588: Add Edgeble Neu6 Model A SoM
Jagan Teki [Mon, 30 Jan 2023 14:57:43 +0000 (20:27 +0530)]
arm64: dts: rockchip: rk3588: Add Edgeble Neu6 Model A SoM

Neural Compute Module 6(Neu2) is a 96boards SoM-CB compute module
based on Rockchip RK3588 from Edgeble AI.

General features:
- Rockchip RK3588
- up to 32GB LPDDR4x
- up to 128GB eMMC
- 2x MIPI CSI2 FPC

On module WiFi6/BT5 is available in the following Neu6 variants.

Neu6 needs to mount on top of associated Edgeble IO boards for
creating complete platform solutions.

Enable eMMC for now to boot Linux successfully.

commit <3d9a2f7e7c5e> ("arm64: dts: rockchip: rk3588: Add Edgeble Neu6
Model A SoM")

Add support for Edgeble Neu6 Model A SoM.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: Add base DT for rk3588 SoC
Jagan Teki [Mon, 30 Jan 2023 14:57:42 +0000 (20:27 +0530)]
arm64: dts: rockchip: Add base DT for rk3588 SoC

This initial version supports CPU, dma, interrupts, timers, UART and
SDHCI (everything necessary to boot Linux on this system on chip) as
well as Ethernet, I2C, PWM and SPI.

The DT is split into rk3588 and rk3588s, which is a reduced version
(i.e. with less peripherals) of the former.

commit <9fb232e9911f> (" arm64: dts: rockchip: Add base DT for rk3588
SoC")
commit <d68a97d501f8> ("arm64: dts: rockchip: Add rk3588 pinctrl data")

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm: rockchip: Add ioc header for rk3588
Jagan Teki [Mon, 30 Jan 2023 14:57:41 +0000 (20:27 +0530)]
arm: rockchip: Add ioc header for rk3588

Add IOC unit header include for rk3588.

Signed-off-by: Steven Liu <steven.liu@rock-chips.com>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agodt-bindings: reset: add rk3588 reset definitions
Jagan Teki [Mon, 30 Jan 2023 14:57:40 +0000 (20:27 +0530)]
dt-bindings: reset: add rk3588 reset definitions

Add reset ID defines for rk3588.

commit <0a8eb7dae617> ("dt-bindings: reset: add rk3588 reset
definitions")

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agodt-bindings: power: Add power-domain header for rk3588
Jagan Teki [Mon, 30 Jan 2023 14:57:39 +0000 (20:27 +0530)]
dt-bindings: power: Add power-domain header for rk3588

Add power-domain header for RK3588 SoC from description in TRM.

commit <67944950c2d0> ("dt-bindings: power: add power-domain header for
rk3588")

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoram: rockchip: Add rk3588 ddr driver support
Jagan Teki [Mon, 30 Jan 2023 14:57:38 +0000 (20:27 +0530)]
ram: rockchip: Add rk3588 ddr driver support

Add ddr driver for rk3588 to get the ram capacity.

Co-developed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoclk: rockchip: pll: Add pll_rk3588 type for rk3588
Jagan Teki [Mon, 30 Jan 2023 14:57:37 +0000 (20:27 +0530)]
clk: rockchip: pll: Add pll_rk3588 type for rk3588

Add RK3588 pll set and get rate clock support.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoclk: rockchip: Add rk3588 clk support
Jagan Teki [Mon, 30 Jan 2023 14:57:36 +0000 (20:27 +0530)]
clk: rockchip: Add rk3588 clk support

Add clock driver support for Rockchip RK3588 SoC.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
20 months agodt-bindings: clk: Add dt-binding header for RK3588
Jagan Teki [Mon, 30 Jan 2023 14:57:35 +0000 (20:27 +0530)]
dt-bindings: clk: Add dt-binding header for RK3588

Add the dt-bindings header for the Rockchip RK3588, that gets
shared between the clock controller and the clock references
in the dts.

commit <f204a60e545c> ("dt-bindings: clock: add rk3588 clock
definitions")

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm: rockchip: Add grf header for rk3588
Jagan Teki [Mon, 30 Jan 2023 14:57:34 +0000 (20:27 +0530)]
arm: rockchip: Add grf header for rk3588

Add GRF header for Rockchip RK3588.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm: rockchip: Add cru header for rk3588
Jagan Teki [Mon, 30 Jan 2023 14:57:33 +0000 (20:27 +0530)]
arm: rockchip: Add cru header for rk3588

Add clock and reset unit header include for rk3588.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: mkimage: Add rk3588 support
Jagan Teki [Mon, 30 Jan 2023 14:57:32 +0000 (20:27 +0530)]
rockchip: mkimage: Add rk3588 support

Add support for rk3588 package header in mkimage tool.

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoevb-rk3568: Update MAINTAINERS and documentation
Chris Morgan [Mon, 13 Feb 2023 22:27:42 +0000 (16:27 -0600)]
evb-rk3568: Update MAINTAINERS and documentation

Update the MAINTAINERS file to include the devicetree for the
rk3568-evb1-v10 board.

Also update Rockchip board docs to include information on building
RK3568 based devices.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: add gpio-ranges property to gpio nodes
Chris Morgan [Mon, 13 Feb 2023 22:27:41 +0000 (16:27 -0600)]
arm64: dts: rockchip: add gpio-ranges property to gpio nodes

Add gpio-ranges property to GPIO nodes so that the bank ID can
be correctly derived for each GPIO bank.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3568: enable automatic power savings
Chris Morgan [Mon, 13 Feb 2023 22:27:39 +0000 (16:27 -0600)]
rockchip: rk3568: enable automatic power savings

It enables automatic clock gating on idle, disables the eDP phy by
default, and sets the core pvtpll ring length. It is reported this
lowers the temperature on at least one SoC by 7C.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3568: add boot device detection
Chris Morgan [Mon, 13 Feb 2023 22:27:38 +0000 (16:27 -0600)]
rockchip: rk3568: add boot device detection

Enable spl to detect which device it was booted from.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: Sync rk356x from Linux main
Chris Morgan [Mon, 13 Feb 2023 22:27:37 +0000 (16:27 -0600)]
arm64: dts: rockchip: Sync rk356x from Linux main

Sync rk3566 and rk3568 from the mainline Linux kernel (6.2-rc2 as of
this writing).

Note that this will rename the rk3568-evb to rk3568-evb1-v10.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agodts: rockchip: px30: add gpio-ranges property to gpio nodes
Chris Morgan [Mon, 13 Feb 2023 22:27:35 +0000 (16:27 -0600)]
dts: rockchip: px30: add gpio-ranges property to gpio nodes

Add the gpio-ranges property to each GPIO node for use in deriving
the correct bank ID. Note that invoking "gpio status -a" no longer
causes the board to hit a "Synchronous Abort".

Fixes: 05d3172b0ce3 ("rockchip: add px30 devicetrees")
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agogpio: gpio-rockchip: parse gpio-ranges for bank id
Chris Morgan [Mon, 13 Feb 2023 22:27:34 +0000 (16:27 -0600)]
gpio: gpio-rockchip: parse gpio-ranges for bank id

Use the new devicetree property of gpio-ranges to determine the GPIO
bank ID. Preserve the "old" way of doing things too, so that boards
can be migrated and tested gradually (I only have a 3566 and 3326 to
test).

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agork3566: radxa-cm3: Enable USB2.0, USB3.0 support
Manoj Sai [Fri, 17 Feb 2023 11:58:45 +0000 (17:28 +0530)]
rk3566: radxa-cm3: Enable USB2.0, USB3.0 support

=> usb start
starting USB...
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
scanning bus usb@fd000000 for devices... cannot reset port 1!?
2 USB Device(s) found
scanning bus usb@fd800000 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  Mass Storage (5 Gb/s, 224mA)
       SanDisk Dual Drive 04019c9b2e1a58f24ee318c3c123aa5

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 100mA)
    |   USB 2.0 Hub
    |
    +-3  Mass Storage (480 Mb/s, 500mA)
    |    JetFlash Mass Storage Device 19M7I4ZQFTSC08SU
    |
    +-4  Human Interface (12 Mb/s, 98mA)
         Logitech USB Receiver

Co-developed-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3568: Select DM_REGULATOR_FIXED
Manoj Sai [Fri, 17 Feb 2023 11:58:44 +0000 (17:28 +0530)]
rockchip: rk3568: Select DM_REGULATOR_FIXED

Select the DM_REGULATOR_FIXED on RK3568 platform.

Co-developed-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Suniel Mahesh <sunil@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: rk3568: add rk3568 pinctrl driver
Jagan Teki [Fri, 17 Feb 2023 11:58:43 +0000 (17:28 +0530)]
rockchip: rk3568: add rk3568 pinctrl driver

Add driver supporting pin multiplexing on rk3568 platform.

Co-developed-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Co-developed-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates
Jagan Teki [Fri, 17 Feb 2023 11:58:42 +0000 (17:28 +0530)]
arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates

combphy1 is failing to probe due to unhandled assigned-clocks and
assigned-clocks-rates.

=> usb start
starting USB...
Bus usb@fd000000: Failed to get PHY1 for usb@fd000000
Port not available.
Bus usb@fd800000: USB EHCI 1.00

There is no real requirement for them in U-Boot to handle, hence
mark them as deleted-properties for the  probe to success

Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agodrivers: phy: add naneng combphy for rk3568
Jagan Teki [Fri, 17 Feb 2023 11:58:41 +0000 (17:28 +0530)]
drivers: phy: add naneng combphy for rk3568

RK3568 has three combo phys, and PCIe/USB3/SATA/QSGMII controllers
share one pipe interface for each combo phy, here is the diagram
of the complex connection.

+----------------+
|                |     +------+
| USB3 OTG CTRL0 |---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY0 |
+----------------+     |      |     |            |
|                |     |      |     +------------+
|   SATA CTRL0   |---->|      |
|                |     +------+
+----------------+

+----------------+
|                |     +------+
| USB3 HOST CTRL1|---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY1 |
+----------------+     |      |     |            |
|                |---->|      |     +------------+
|   SATA CTRL1   |  -->|      |
|                |  |  +------+
+----------------+  |
                    |
+----------------+  |
|                |  |  +------+
|  QSGMII CTRL   |---->|      |
|                |     |      |     +------------+
+----------------+     | PIPE |     |            |
                       | MUX  |---->| Combo PHY2 |
+----------------+     |      |     |            |
|                |---->|      |     +------------+
|   SATA CTRL2   |  -->|      |
|                |  |  +------+
+----------------+  |
                    |
+----------------+  |
|                |  |
|  PCIe2 1-Lane  |---
|                |
+----------------+

Co-developed-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Co-developed-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agophy: rockchip-inno-usb2: Add USB2 PHY for rk3568
Manoj Sai [Fri, 17 Feb 2023 11:58:40 +0000 (17:28 +0530)]
phy: rockchip-inno-usb2: Add USB2 PHY for rk3568

RK3568 has two USB 2.0 PHYs, and each PHY has two ports, the OTG port
of PHY0 support OTG mode with charging detection function, they are
similar to previous Rockchip SoCs.

However, there are three different designs for RK3568 USB 2.0 PHY.
1. RK3568 uses independent USB GRF module for each USB 2.0 PHY.
2. RK3568 accesses the registers of USB 2.0 PHY IP directly by APB.
3. The two ports of USB 2.0 PHY share one interrupt.

This patch only PHY1 with necessary attributes required to function
USBPHY1 on U-Boot.

Co-developed-by: Ren Jianing <jianing.ren@rock-chips.com>
Signed-off-by: Ren Jianing <jianing.ren@rock-chips.com>
Co-developed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agophy: rockchip: inno-usb2: Add support #address_cells = 2
Jagan Teki [Fri, 17 Feb 2023 11:58:39 +0000 (17:28 +0530)]
phy: rockchip: inno-usb2: Add support #address_cells = 2

New Rockchip devices have the usb phy nodes as standalone devices.
These nodes have register nodes with #address_cells = 2, but only
use 32 bit addresses.

Adjust the driver to check if the returned address is "0", and adjust
the index in that case.

Derived and adjusted the similar change from linux-next with below
 commit <9c19c531dc98> ("phy: phy-rockchip-inno-usb2: support
 #address_cells = 2")

Co-developed-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoboard: rockchip: Add Radxa Compute Module 3 IO Board
Jagan Teki [Fri, 17 Feb 2023 11:58:38 +0000 (17:28 +0530)]
board: rockchip: Add Radxa Compute Module 3 IO Board

Radxa Compute Module 3(CM3) IO board an application board from Radxa
and is compatible with Raspberry Pi CM4 IO form factor.

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

Add support for Radxa CM3 IO Board defconfig and -u-boot.dtsi

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
20 months agoarm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO
Jagan Teki [Fri, 17 Feb 2023 11:58:37 +0000 (17:28 +0530)]
arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO

Radxa Compute Module 3(CM3) IO board an application board from Radxa
and is compatible with Raspberry Pi CM4 IO form factor.

Specification:
- 1x HDMI,
- 2x MIPI DSI
- 2x MIPI CSI2
- 1x eDP
- 1x PCIe card
- 2x SATA
- 2x USB 2.0 Host
- 1x USB 3.0
- 1x USB 2.0 OTG
- Phone jack
- microSD slot
- 40-pin GPIO expansion header
- 12V DC

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

linux-next commit for the same,

commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa
CM3")

Add support for Radxa CM3 IO Board.

Co-developed-by: FUKAUMI Naoki <naoki@radxa.com>
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Co-developed-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Manoj Sai <abbaraju.manojsai@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: rk3566: Add Radxa Compute Module 3
Jagan Teki [Fri, 17 Feb 2023 11:58:36 +0000 (17:28 +0530)]
arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3

Radxa Compute Module 3(CM3) is one of the modules from a series
System On Module based on the Radxa ROCK 3 series and is compatible
with Raspberry Pi CM4 pinout and form factor.

Specification:
- Rockchip RK3566
- up to 8GB LPDDR4
- up to 128GB high performance eMMC
- Optional wireless LAN, 2.4GHz and 5.0GHz IEEE 802.11b/g/n/ac wireless,
  BT 5.0, BLE with onboard and external antenna.
- Gigabit Ethernet PHY

Radxa CM3 needs to mount on top of this IO board in order to create
complete Radxa CM3 IO board platform.

Since Radxa CM3 is compatible with Raspberry Pi CM4 pinout so it is
possible to mount Radxa CM3 on top of the Rasberry Pi CM4 IO board.

linux-next commit for the same,

commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa
CM3")

Add support for Radxa CM3.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Co-developed-by: FUKAUMI Naoki <naoki@radxa.com>
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
20 months agodt-bindings: rockchip: Sync rockchip, vop2.h from Linux
Jagan Teki [Fri, 17 Feb 2023 11:58:35 +0000 (17:28 +0530)]
dt-bindings: rockchip: Sync rockchip, vop2.h from Linux

Sync rockchip,vop2.h from linux-next, and the last commit is

commit <604be85547ce> ("drm/rockchip: Add VOP2 driver")

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
20 months agorockchip: rk3568: Move DM_RESET in arch kconfig
Jagan Teki [Fri, 17 Feb 2023 11:58:34 +0000 (17:28 +0530)]
rockchip: rk3568: Move DM_RESET in arch kconfig

Like other rockchip SoCs, DM_RESET is useful across rk3568
platform.

Select it from arch kconfig.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoboard: edgeble: Fix neural-compute-module-2 board name
Jagan Teki [Tue, 24 Jan 2023 19:31:05 +0000 (01:01 +0530)]
board: edgeble: Fix neural-compute-module-2 board name

The board should be RV1126-NEU2 instead RV1126-ECM0.

Fix the wrong name.

Fixes: 0e9d986c709d ("board: rockchip: Add Edgeble Neu2 IO Board")
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoinclude: rk3328: Add default env for compressed kernel images
Christopher Obbard [Fri, 27 Jan 2023 17:03:56 +0000 (17:03 +0000)]
include: rk3328: Add default env for compressed kernel images

Add default memory addresses for kernel_comp_addr_r and kernel_comp_size
to enable booting from a compressed kernel image. This area is temporarily
used to decompress the kernel image on-the-fly.

Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: rk3308: Add Radxa ROCK Pi S support
Akash Gajjar [Tue, 14 Feb 2023 15:31:09 +0000 (21:01 +0530)]
arm64: dts: rockchip: rk3308: Add Radxa ROCK Pi S support

Add Radxa ROCK 3 Model A support. sync rk3308-rock-pi-s.dts from
Linux 6.2.0-rc7.

ROCK Pi S is RK3308 based SBC from radxa.com. ROCK Pi S has a,
- 256MB/512MB DDR3 RAM
- SD, NAND flash (optional on board 1/2/4/8Gb)
- 100MB ethernet, PoE (optional)
- Onboard 802.11 b/g/n wifi + Bluetooth 4.0 Module
- USB2.0 Type-A HOST x1
- USB3.0 Type-C OTG x1
- 26-pin expansion header
- USB Type-C DC 5V Power Supply

Linux commit commit for the same,
<2e04c25b1320> ("arm64: dts: rockchip: add ROCK Pi S DTS support")

Signed-off-by: Akash Gajjar <gajjar04akash@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoarm64: dts: rockchip: rk3568: Add Radxa ROCK 3 Model A board support
Akash Gajjar [Tue, 14 Feb 2023 15:18:40 +0000 (20:48 +0530)]
arm64: dts: rockchip: rk3568: Add Radxa ROCK 3 Model A board support

Add Radxa ROCK 3 Model A support. sync rk3568-rock-3a.dts from Linux 6.2.0-rc7

Board Specifications
- Rockchip RK3568
- 2/4/8GB LPDDR4 3200MT/s
- eMMC socket, SD card slot
- GbE LAN
- PCIe 3.0/2.0
- M.2 Connector
- 3.5mm Audio jack with mic
- HDMI 2.0, MIPI DSI/CSI
- USB 3.0 Host/OTG, USB 2.0 Host
- 40-pin GPIO expansion ports
- USB Type C PD 2.0, 9V/2A, 12V/2A, 15V/2A, 20V/2A

Refer Linux commit <22a442e6586c>
("arm64: dts: rockchip: add basic dts for the radxa rock3 model a")

Signed-off-by: Akash Gajjar <gajjar04akash@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agobinman: Mark mkimage entry missing when its subnodes is missing
Jonas Karlman [Sat, 25 Feb 2023 19:01:35 +0000 (19:01 +0000)]
binman: Mark mkimage entry missing when its subnodes is missing

Using the mkimage entry with the multiple-data-files prop and having a
missing external blob result in an unexpected ValueError exception using
the --allow-missing flag.

  ValueError: Filename 'missing.bin' not found in input path (...)

Fix this by using _pathname that is resolved by ObtainContents for blob
entries, ObtainContents also handles allow missing for external blobs.

Mark mkimage entry as missing and return without running mkimage when
missing entries is reported by CheckMissing.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: mkimage: Update init size limit for RK3568
Jonas Karlman [Sat, 25 Feb 2023 19:01:34 +0000 (19:01 +0000)]
rockchip: mkimage: Update init size limit for RK3568

The current init size limit of 76KiB is too big to fit in the 64KiB SRAM
on RK3568, sync init size limit from vendor u-boot to fix this.

Set init size limit to 60KiB (-16KiB) for RK3568.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: mkimage: Update init size limit for RK3328
Jonas Karlman [Sat, 25 Feb 2023 19:01:34 +0000 (19:01 +0000)]
rockchip: mkimage: Update init size limit for RK3328

Latest vendor TPL for RK3328 has grown past the current init size limit
of 28KiB, sync the init size limit from vendor u-boot to fix this.

Set init size limit to 30KiB (+2KiB) for RK3328.

This makes it possible to use latest vendor TPL on RK3328 without
getting a size limit error running the mkimage command.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoRevert "board: rockchip: Fix binman_init failure on EVB-RK3568"
Jonas Karlman [Sat, 25 Feb 2023 19:01:34 +0000 (19:01 +0000)]
Revert "board: rockchip: Fix binman_init failure on EVB-RK3568"

An external TPL binary is now expected to be provided using ROCKCHIP_TPL
when building RK3568 targets.

This reverts commit 933c8a7173da122f61278fb4ce4e10c90bfd88d8.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: Use an external TPL binary on RK3568
Jonas Karlman [Sat, 25 Feb 2023 19:01:34 +0000 (19:01 +0000)]
rockchip: Use an external TPL binary on RK3568

Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
jumps to U-Boot SPL to continue the normal boot flow.

However, there is no support to initialize DRAM on RK35xx SoCs using
U-Boot TPL and instead an external TPL binary must be used to generate a
bootable u-boot-rockchip.bin image.

Add CONFIG_ROCKCHIP_EXTERNAL_TPL to indicate that an external TPL should
be used. Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
bootable u-boot-rockchip.bin image for RK3568.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Eugen Hristev <eugen.hristev@collabora.com>
20 months agobinman: Add support for a rockchip-tpl entry
Jonas Karlman [Sat, 25 Feb 2023 19:01:33 +0000 (19:01 +0000)]
binman: Add support for a rockchip-tpl entry

The rockchip-tpl entry can be used when an external TPL binary should be
used instead of the normal U-Boot TPL.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Eugen Hristev <eugen.hristev@collabora.com>
20 months agorockchip: dts: rk3328: fix sdram params
Jonas Karlman [Fri, 10 Feb 2023 18:30:05 +0000 (18:30 +0000)]
rockchip: dts: rk3328: fix sdram params

The rk3328 sdram driver read sdram parameters from the devicetree into a
struct rk3328_sdram_params using dev_read_u32_array.

After commit 5c8da345e55c ("ram: rockchip: Update ddr pctl regs for px30")
changed the size of struct ddr_pctl_regs, a member of struct
rk3328_sdram_params, U-Boot TPL can no longer initialize DRAM on RK3328.

Add ten u32 to the sdram parameter array in devicetree to align with
this size change. This fixes DRAM initialization on RK3328.

Fixes: 5c8da345e55c ("ram: rockchip: Update ddr pctl regs for px30")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # roc-rk3328-cc
20 months agorockchip: sdram: add dram bank with usable memory beyond 4GB
Jonas Karlman [Tue, 7 Feb 2023 17:27:11 +0000 (17:27 +0000)]
rockchip: sdram: add dram bank with usable memory beyond 4GB

Add a second dram bank of usable memory beyond the blob of space for
peripheral near 4GB. Any memory that exists beyond the 4GB mark is added
to the second bank.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: sdram: add basic support for sdram reg info version 3
Jonas Karlman [Tue, 7 Feb 2023 17:27:10 +0000 (17:27 +0000)]
rockchip: sdram: add basic support for sdram reg info version 3

Newer DRAM initialization blobs from vendor can encode sdram info in a
new version 3 format. The new format makes use of more bits in sys_reg3
compared to the version 2 format.

Add basic support for detecting the version 3 format and decoding the
high bits used for ddrtype.

This fixes decode of sdram size on my RK3568 boards that have LPDDR4X.

Details on the new format was deciphered from vendor u-boot commit [1].

[1] https://github.com/rockchip-linux/u-boot/commit/c69667e0e2bf4290ab1f408fcde58b8806ac266b

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agorockchip: ringneck: fix SDRAM init fail
Quentin Schulz [Tue, 17 Jan 2023 17:26:54 +0000 (18:26 +0100)]
rockchip: ringneck: fix SDRAM init fail

CONFIG_RAM_PX30_DDR4 got renamed to CONFIG_RAM_ROCKCHIP_DDR4 in commit
5c85614634fd ("ram: rockchip: Add common ddr type configs"). Since both
patchsets were merged unbeknownst to the other, the conflict wasn't
detected while testing each patchset individually and could only be
observed after a merge to master branch.

Fixes: 7b9ac3cb78e7 ("rockchip: add support for PX30 Ringneck SoM on Haikou Devkit")
Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
20 months agommc: rockchip_dw_mmc: fix DDR52 8-bit mode handling
John Keeping [Tue, 17 Jan 2023 17:07:47 +0000 (17:07 +0000)]
mmc: rockchip_dw_mmc: fix DDR52 8-bit mode handling

The RK3288 TRM states that, for 8-bit DDR modes:

The CLKDIV register should always be programmed with a value
higher than zero (0); that is, a clock divider should always be
used for 8-bit DDR mode.

In Linux, the driver applies this logic for all SoCs using the driver
and does not distinguish RK3288, so presumably this requirement is the
same for all other Rockchip SoCs using this IP.

Add the necessary code to double the clock frequency when 8-bit DDR is
selected.  The dw_mmc core already handles setting CLKDIV correctly
given the input clock and desired bus clock.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
20 months agoarm: dts: rockchip: rk3399: nanopi-r4s: Provide smbios sysinfo
Christian Kohlschütter [Mon, 17 Oct 2022 19:02:36 +0000 (19:02 +0000)]
arm: dts: rockchip: rk3399: nanopi-r4s: Provide smbios sysinfo

Provide human-readable manufacturer and product names for the
FriendlyELEC NanoPi R4S.

Enable CONFIG_SYSINFO and CONFIG_SYSINFO_SMBIOS by default.

Signed-off-by: Christian Kohlschütter <christian@kohlschutter.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
20 months agoARM: dts: at91: sama7g5: fix clock id for ebi node
Mihai Sain [Thu, 23 Feb 2023 09:12:58 +0000 (11:12 +0200)]
ARM: dts: at91: sama7g5: fix clock id for ebi node

The PMC_MCK1 clock id for the ebi node is 23.

Fixes: 5c1c69482915 ("ARM: dts: at91: sama7g5/sama7g5ek: align with Linux DT")
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com>
Signed-off-by: Mihai Sain <mihai.sain@microchip.com>
20 months agoconfigs: pm9g45: Modify to use standard ECC layout
Ilko Iliev [Mon, 20 Feb 2023 14:27:20 +0000 (15:27 +0100)]
configs: pm9g45: Modify to use standard ECC layout

This patch removes CONFIG_SYS_NAND_DRIVER_ECC_LAYOUT because the board uses
standard ECC layout.

Signed-off-by: Ilko Iliev <iliev@ronetix.at>