[PATCH 16/16] board: rzg2l: Add RZ/G2L SMARC EVK board

Paul Barker paul.barker.ct at bp.renesas.com
Wed Oct 4 11:36:09 CEST 2023


On 03/10/2023 14:36, Marek Vasut wrote:
> On 9/20/23 14:42, Paul Barker wrote:
>> The Renesas RZ/G2L SMARC Evaluation Board Kit consists of the RZ/G2L
>> System-on-Module (SOM) based on the R9A07G044L2 SoC, and a common SMARC
>> carrier board.
>>
>> The ARM TrustedFirmware code for the Renesas RZ/G2L SoC family passes a
>> devicetree blob to the bootloader as an argument in the same was
>> previous R-Car gen3/gen4 SoCs. This blob contains a compatible string
>> which can be used to identify the particular SoC we are running on and
>> this is used to select the appropriate device tree to load.
>>
>> The configuration renesas_rzg2l_smarc_defconfig is added to support
>> building for this target. In the future this defconfig will be extended
>> to support other SoCs and evaluation boards from the RZ/G2L family.
>>
>> Signed-off-by: Paul Barker <paul.barker.ct at bp.renesas.com>
>> Reviewed-by: Biju Das <biju.das.jz at bp.renesas.com>
>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
>> ---
>>   arch/arm/mach-rmobile/Kconfig.rzg2l   | 14 +++++
>>   board/renesas/rzg2l/Kconfig           | 18 +++++++
>>   board/renesas/rzg2l/MAINTAINERS       |  6 +++
>>   board/renesas/rzg2l/Makefile          |  4 ++
>>   board/renesas/rzg2l/rzg2l.c           | 76 +++++++++++++++++++++++++++
>>   configs/renesas_rzg2l_smarc_defconfig | 52 ++++++++++++++++++
>>   include/configs/rzg2l-smarc.h         | 14 +++++
>>   7 files changed, 184 insertions(+)
>>   create mode 100644 board/renesas/rzg2l/Kconfig
>>   create mode 100644 board/renesas/rzg2l/MAINTAINERS
>>   create mode 100644 board/renesas/rzg2l/Makefile
>>   create mode 100644 board/renesas/rzg2l/rzg2l.c
>>   create mode 100644 configs/renesas_rzg2l_smarc_defconfig
>>   create mode 100644 include/configs/rzg2l-smarc.h
>>
>> diff --git a/arch/arm/mach-rmobile/Kconfig.rzg2l b/arch/arm/mach-rmobile/Kconfig.rzg2l
>> index 7d268e8c366a..1fe49e323300 100644
>> --- a/arch/arm/mach-rmobile/Kconfig.rzg2l
>> +++ b/arch/arm/mach-rmobile/Kconfig.rzg2l
>> @@ -9,6 +9,20 @@ config R9A07G044L
>>   	help
>>   	  Enable support for the R9A07G044L SoC used in the RZ/G2L.
>>   
>> +choice
>> +	prompt "Renesas RZ/G2L Family Board selection"
>> +	default TARGET_RZG2L_SMARC_EVK
>> +
>> +config TARGET_RZG2L_SMARC_EVK
>> +	bool "Renesas RZ/G2L SMARC EVK"
>> +	imply R9A07G044L
>> +	help
>> +	  Enable support for the RZ/G2L SMARC evaluation board.
>> +
>> +source "board/renesas/rzg2l/Kconfig"
>> +
>> +endchoice
>> +
>>   config MULTI_DTB_FIT_UNCOMPRESS_SZ
>>   	default 0x80000 if TARGET_RZG2L_SMARC_EVK
>>   
>> diff --git a/board/renesas/rzg2l/Kconfig b/board/renesas/rzg2l/Kconfig
>> new file mode 100644
>> index 000000000000..1335fc7ae806
>> --- /dev/null
>> +++ b/board/renesas/rzg2l/Kconfig
>> @@ -0,0 +1,18 @@
>> +# Copyright (C) 2023 Renesas Electronics Corporation
>> +# SPDX-License-Identifier: GPL-2.0+
>> +
>> +if TARGET_RZG2L_SMARC_EVK
>> +
>> +config SYS_SOC
>> +	default "rmobile"
>> +
>> +config SYS_BOARD
>> +	default "rzg2l"
>> +
>> +config SYS_VENDOR
>> +	default "renesas"
>> +
>> +config SYS_CONFIG_NAME
>> +	default "rzg2l-smarc"
>> +
>> +endif
>> diff --git a/board/renesas/rzg2l/MAINTAINERS b/board/renesas/rzg2l/MAINTAINERS
>> new file mode 100644
>> index 000000000000..0a51391c1fc9
>> --- /dev/null
>> +++ b/board/renesas/rzg2l/MAINTAINERS
>> @@ -0,0 +1,6 @@
>> +RENESAS RZG2L BOARD FAMILY
>> +M:	Paul Barker <paul.barker.ct at bp.renesas.com>
>> +S:	Supported
>> +F:	arch/arm/dts/rz-smarc-common.dtsi
> 
> I suspect there should be more files here, right ?
> You likely want to be CCed on things like rzg2l clock, scif, and so on.

The `N:` lines after this are regexps. Checking these after applying
this patch gives the expected behaviour, e.g.

./scripts/get_maintainer.pl drivers/clk/renesas/rzg2l-cpg.c
Nobuhiro Iwamatsu <iwamatsu at nigauri.org> (maintainer:ARM RENESAS
RMOBILE/R-CAR)
Marek Vasut <marek.vasut+renesas at mailbox.org> (maintainer:ARM RENESAS
RMOBILE/R-CAR)
Lukasz Majewski <lukma at denx.de> (maintainer:CLOCK)
Sean Anderson <seanga2 at gmail.com> (maintainer:CLOCK)
Paul Barker <paul.barker.ct at bp.renesas.com> (supporter:RENESAS RZG2L
BOARD FAMILY)
u-boot at lists.denx.de (open list)

> 
>> +N:	rzg2l
>> +N:	r9a07g044
>> diff --git a/board/renesas/rzg2l/Makefile b/board/renesas/rzg2l/Makefile
>> new file mode 100644
>> index 000000000000..466935fc8158
>> --- /dev/null
>> +++ b/board/renesas/rzg2l/Makefile
>> @@ -0,0 +1,4 @@
>> +# Copyright (C) 2023 Renesas Electronics Corporation
>> +# SPDX-License-Identifier: GPL-2.0+
>> +
>> +obj-y	:= rzg2l.o
> 
>> diff --git a/board/renesas/rzg2l/rzg2l.c b/board/renesas/rzg2l/rzg2l.c
>> new file mode 100644
>> index 000000000000..2b1bb3546c26
>> --- /dev/null
>> +++ b/board/renesas/rzg2l/rzg2l.c
>> @@ -0,0 +1,76 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * RZ/G2L board support.
>> + * Copyright (C) 2023 Renesas Electronics Corporation
>> + */
>> +
>> +#include <common.h>
>> +#include <fdtdec.h>
>> +#include <linux/libfdt.h>
>> +
>> +#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
>> +/* If the firmware passed a device tree, use it for board identification. */
>> +extern u64 rcar_atf_boot_args[];
>> +
>> +static bool is_rzg2l_board(const char *board_name)
>> +{
>> +	void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
>> +
>> +	return fdt_node_check_compatible(atf_fdt_blob, 0, board_name) == 0;
>> +}
>> +
>> +int board_fit_config_name_match(const char *name)
>> +{
>> +	void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
>> +
>> +	if (fdt_magic(atf_fdt_blob) != FDT_MAGIC)
>> +		return -1;
>> +
>> +	if (is_rzg2l_board("renesas,r9a07g044l2"))
>> +		return strcmp(name, "r9a07g044l2-smarc");
>> +
>> +	return -1;
>> +}
>> +#endif
>> +
>> +static void apply_atf_overlay(void *fdt_blob)
>> +{
>> +	void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
>> +
>> +	if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
>> +		fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0);
>> +}
>> +
>> +int fdtdec_board_setup(const void *fdt_blob)
>> +{
>> +	apply_atf_overlay((void *)fdt_blob);
>> +
>> +	return 0;
>> +}
>> +
>> +int ft_board_setup(void *blob, struct bd_info *bd)
>> +{
>> +	return 0;
> 
> Are all these stub functions really needed or can they be removed 
> (possibly also with removal of unnecessary config options) ?

ft_board_setup() could possibly be dropped - I had a line in here to
call apply_atf_overlay() but dropped it as further work is needed in
TrustedFirmware first.

The empty board_init() function is the same as in
board/renesas/rcar-common/common.c.

> 
>> +}
>> +
>> +int __weak board_init(void)
>> +{
>> +	return 0;
>> +}
>> +
>> +int dram_init(void)
>> +{
>> +	return fdtdec_setup_mem_size_base();
>> +}
>> +
>> +int dram_init_banksize(void)
>> +{
>> +	fdtdec_setup_memory_banksize();
> 
> This and the one function above can likely go into arch/mach-rmobile/

We're not able to test every supported mach-rmobile board so we've
preferred to keep changes to RZ/G2L specific code where possible. I'm
happy to merge this into mach-rmobile (along with the similar code in
board/renesas/rcar-common/common.c), but it will only be tested on the
boards we have in our team.

> 
>> +	return 0;
>> +}
>> +
>> +void __weak reset_cpu(void)
>> +{
> 
> Is this platform missing a way to reset the system ?
> Please fix.

Adding reset support is on my todo list. I'm prioritising Ethernet
support above this right now, but we don't mind too much what order we
do things. Let me know if you'd prefer us to prioritise reset support.

Thanks,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x27F4B3459F002257.asc
Type: application/pgp-keys
Size: 3520 bytes
Desc: OpenPGP public key
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231004/b4a12dc4/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231004/b4a12dc4/attachment.sig>


More information about the U-Boot mailing list