[PATCH v3 5/5] rockchip: Add support for Radxa ROCK 5C
FUKAUMI Naoki
naoki at radxa.com
Sun Dec 15 02:37:56 CET 2024
Hi Quentin,
Thank you very much for your review!
On 12/13/24 22:11, Quentin Schulz wrote:
> Hi Naoki,
>
> On 12/11/24 4:39 AM, FUKAUMI Naoki wrote:
>> Radxa ROCK 5C[1] is a Rockchip RK3588S2 based single board computer.
>>
>> [1] https://radxa.com/products/rock5/5c
>>
>> Signed-off-by: FUKAUMI Naoki <naoki at radxa.com>
>> ---
>> Changes in v3:
>> - fix compile error
>> Changes in v2:
>> - arch/arm/dts/rk3588s-rock-5-u-boot.dtsi: remove unused node
>> - include/configs/rock-5-rk3588s.h: fix include order
>> ---
>> arch/arm/dts/rk3588s-rock-5-u-boot.dtsi | 16 ++++
>> arch/arm/dts/rk3588s-rock-5c-u-boot.dtsi | 6 ++
>> arch/arm/mach-rockchip/rk3588/Kconfig | 7 ++
>> board/radxa/rock-5-rk3588s/Kconfig | 12 +++
>> board/radxa/rock-5-rk3588s/MAINTAINERS | 8 ++
>> board/radxa/rock-5-rk3588s/Makefile | 3 +
>> board/radxa/rock-5-rk3588s/rock-5-rk3588s.c | 77 +++++++++++++++++
>> configs/rock-5-rk3588s_defconfig | 94 +++++++++++++++++++++
>> doc/board/rockchip/rockchip.rst | 1 +
>> include/configs/rock-5-rk3588s.h | 15 ++++
>> 10 files changed, 239 insertions(+)
>> create mode 100644 arch/arm/dts/rk3588s-rock-5-u-boot.dtsi
>> create mode 100644 arch/arm/dts/rk3588s-rock-5c-u-boot.dtsi
>> create mode 100644 board/radxa/rock-5-rk3588s/Kconfig
>> create mode 100644 board/radxa/rock-5-rk3588s/MAINTAINERS
>> create mode 100644 board/radxa/rock-5-rk3588s/Makefile
>> create mode 100644 board/radxa/rock-5-rk3588s/rock-5-rk3588s.c
>> create mode 100644 configs/rock-5-rk3588s_defconfig
>> create mode 100644 include/configs/rock-5-rk3588s.h
>>
>> diff --git a/arch/arm/dts/rk3588s-rock-5-u-boot.dtsi b/arch/arm/dts/
>> rk3588s-rock-5-u-boot.dtsi
>> new file mode 100644
>> index 000000000000..be1a2f9ae7bb
>> --- /dev/null
>> +++ b/arch/arm/dts/rk3588s-rock-5-u-boot.dtsi
>> @@ -0,0 +1,16 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> +/*
>> + * Copyright (c) 2024 Radxa Computer (Shenzhen) Co., Ltd.
>> + */
>> +
>> +#include "rk3588s-u-boot.dtsi"
>> +
>> +&saradc {
>> + bootph-pre-ram;
>> + vdd-microvolts = <1800000>;
>> +};
>> +
>> +&sdhci {
>> + cap-mmc-highspeed;
>> + mmc-hs200-1_8v;
>> +};
>> diff --git a/arch/arm/dts/rk3588s-rock-5c-u-boot.dtsi b/arch/arm/dts/
>> rk3588s-rock-5c-u-boot.dtsi
>> new file mode 100644
>> index 000000000000..bb1cc9e4a279
>> --- /dev/null
>> +++ b/arch/arm/dts/rk3588s-rock-5c-u-boot.dtsi
>> @@ -0,0 +1,6 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> +/*
>> + * Copyright (c) 2024 Radxa Computer (Shenzhen) Co., Ltd.
>> + */
>> +
>> +#include "rk3588s-rock-5-u-boot.dtsi"
>> diff --git a/arch/arm/mach-rockchip/rk3588/Kconfig b/arch/arm/mach-
>> rockchip/rk3588/Kconfig
>> index b5a0e624a532..e1487ecb0464 100644
>> --- a/arch/arm/mach-rockchip/rk3588/Kconfig
>> +++ b/arch/arm/mach-rockchip/rk3588/Kconfig
>> @@ -260,6 +260,12 @@ config TARGET_ROCK_5_ITX_RK3588
>> Front-panel connectors for audio and case-power, -leds
>> Powered by either 12V, ATX power-supply or PoE
>> +config TARGET_ROCK_5_RK3588S
>
> This should be TARGET_ROCK_5C_RK3588S?
rock-pi-4-rk3399_defconfig uses CONFIG_TARGET_ROCKPI4_RK3399.
I'm doing same thing.
>> + bool "Radxa ROCK 5C RK3588S2 board"
>> + select BOARD_LATE_INIT
>> + help
>> + Radxa ROCK 5C is a Rockchip RK3588S2 based single board computer.
>> +
>> config TARGET_SIGE7_RK3588
>> bool "ArmSoM Sige7 RK3588 board"
>> select BOARD_LATE_INIT
>> @@ -398,6 +404,7 @@ source "board/turing/turing-rk1-rk3588/Kconfig"
>> source "board/radxa/rock5a-rk3588s/Kconfig"
>> source "board/radxa/rock5b-rk3588/Kconfig"
>> source "board/radxa/rock-5-itx-rk3588/Kconfig"
>> +source "board/radxa/rock-5-rk3588s/Kconfig"
>
> Where's the c gone?
There is board/radxa/rockpi4-rk3399/.
>> source "board/rockchip/evb_rk3588/Kconfig"
>> source "board/rockchip/toybrick_rk3588/Kconfig"
>> source "board/theobroma-systems/jaguar_rk3588/Kconfig"
>> diff --git a/board/radxa/rock-5-rk3588s/Kconfig b/board/radxa/rock-5-
>> rk3588s/Kconfig
>> new file mode 100644
>> index 000000000000..86830be1eeca
>> --- /dev/null
>> +++ b/board/radxa/rock-5-rk3588s/Kconfig
>> @@ -0,0 +1,12 @@
>> +if TARGET_ROCK_5_RK3588S
>> +
>> +config SYS_BOARD
>> + default "rock-5-rk3588s"
>> +
>> +config SYS_VENDOR
>> + default "radxa"
>> +
>> +config SYS_CONFIG_NAME
>> + default "rock-5-rk3588s"
>> +
>> +endif
>> diff --git a/board/radxa/rock-5-rk3588s/MAINTAINERS b/board/radxa/
>> rock-5-rk3588s/MAINTAINERS
>> new file mode 100644
>> index 000000000000..ead6356131c1
>> --- /dev/null
>> +++ b/board/radxa/rock-5-rk3588s/MAINTAINERS
>> @@ -0,0 +1,8 @@
>> +ROCK-5-RK3588S
>> +M: FUKAUMI Naoki <naoki at radxa.com>
>> +S: Maintained
>> +F: arch/arm/dts/rk3588s-rock-5-u-boot.dtsi
>> +F: arch/arm/dts/rk3588s-rock-5c-u-boot.dtsi
>> +F: board/radxa/rock-5-rk3588s/
>> +F: configs/rock-5-rk3588s_defconfig
>> +F: include/configs/rock-5-rk3588s.h
>
> Why are all those files missing the c character?
Same reason as above.
>> diff --git a/board/radxa/rock-5-rk3588s/Makefile b/board/radxa/rock-5-
>> rk3588s/Makefile
>> new file mode 100644
>> index 000000000000..d9be0f42e6b9
>> --- /dev/null
>> +++ b/board/radxa/rock-5-rk3588s/Makefile
>> @@ -0,0 +1,3 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +
>> +obj-y += rock-5-rk3588s.o
>> diff --git a/board/radxa/rock-5-rk3588s/rock-5-rk3588s.c b/board/
>> radxa/rock-5-rk3588s/rock-5-rk3588s.c
>> new file mode 100644
>> index 000000000000..a840ca7698d4
>> --- /dev/null
>> +++ b/board/radxa/rock-5-rk3588s/rock-5-rk3588s.c
>> @@ -0,0 +1,77 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +
>> +#include <linux/errno.h>
>> +#include <linux/kernel.h>
>> +#include <adc.h>
>> +#include <env.h>
>> +
>> +#define BOARD_ID 5
>> +
>> +struct board_model {
>> + unsigned int low;
>> + unsigned int high;
>> + const char *board;
>> + const char *board_name;
>> + const char *fdtfile;
>> +};
>> +
>> +static const struct board_model board_models[] = {
>> + {
>> + 0,
>> + 50,
>> + "rock-5a-rk3588s",
>> + "Radxa ROCK 5A",
>> + "rockchip/rk3588s-rock-5a.dtb",
>
> We already have a config and board files for the rock-5a... There should
> probably something to be done to merge them together or remove this part?
I'll drop this part from this patch.
>> + },
>> + {
>> + 2375,
>> + 2425,
>> + "rock-5c-rk3588s",
>> + "Radxa ROCK 5C",
>> + "rockchip/rk3588s-rock-5c.dtb"
>> + },
>> +};
>> +
>> +static const struct board_model *get_board_model(void)
>> +{
>> + unsigned int val;
>> + int i, ret;
>> +
>> + ret = adc_channel_single_shot("adc at fec10000", BOARD_ID, &val);
>> + debug("adc_channel_single_shot ret %d val %u\n", ret, val);
>> + if (ret)
>> + return NULL;
>> +
>> + for (i = 0; i < ARRAY_SIZE(board_models); i++) {
>> + unsigned int min = board_models[i].low;
>> + unsigned int max = board_models[i].high;
>> +
>> + if (min <= val && val <= max)
>> + return &board_models[i];
>> + }
>> +
>> + return NULL;
>> +}
>> +
>> +int rk_board_late_init(void)
>> +{
>> + const struct board_model *model = get_board_model();
>> +
>> + if (model) {
>> + env_set("board", model->board);
>> + env_set("board_name", model->board_name);
>> + env_set("fdtfile", model->fdtfile);
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +int board_fit_config_name_match(const char *name)
>> +{
>> + const struct board_model *model = get_board_model();
>> +
>> + if (model && !strcmp(name, model->fdtfile))
>> + return 0;
>> +
>> + return -ENOENT;
>> +}
>> diff --git a/configs/rock-5-rk3588s_defconfig b/configs/rock-5-
>> rk3588s_defconfig
>> new file mode 100644
>> index 000000000000..54043264de48
>> --- /dev/null
>> +++ b/configs/rock-5-rk3588s_defconfig
>> @@ -0,0 +1,94 @@
>> +CONFIG_ARM=y
>> +CONFIG_SKIP_LOWLEVEL_INIT=y
>> +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
>> +CONFIG_COUNTER_FREQUENCY=24000000
>> +CONFIG_ARCH_ROCKCHIP=y
>> +CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3588s-rock-5a"
>> +CONFIG_ROCKCHIP_RK3588=y
>> +CONFIG_SPL_SERIAL=y
>> +CONFIG_TARGET_ROCK_5_RK3588S=y
>> +CONFIG_SYS_LOAD_ADDR=0xc00800
>> +CONFIG_DEBUG_UART_BASE=0xFEB50000
>> +CONFIG_DEBUG_UART_CLOCK=24000000
>> +CONFIG_PCI=y
>> +CONFIG_DEBUG_UART=y
>> +CONFIG_AHCI=y
>> +CONFIG_FIT=y
>> +CONFIG_FIT_VERBOSE=y
>> +CONFIG_SPL_FIT_SIGNATURE=y
>> +CONFIG_SPL_LOAD_FIT=y
>> +CONFIG_LEGACY_IMAGE_FORMAT=y
>> +CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-rock-5a.dtb"
>
> And now we default to ROCK 5A DTB... This is all very confusing with
> this little explained in the commit log.
Same as rock-pi-4-rk3399_defconfig, but I'll change them.
Best regards,
--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.
> Cheers,
> Quentin
>
More information about the U-Boot
mailing list