Aw: Re: [PATCH v3] board: rockchip: Add Bananapi R2Pro Board

Jonas Karlman jonas at kwiboo.se
Sun Sep 17 11:26:47 CEST 2023


On 2023-09-17 09:19, Frank Wunderlich wrote:
> Hi,
> 
> thank you for your suggestions
> 
>> Gesendet: Sonntag, 17. September 2023 um 00:51 Uhr
>> Von: "Jonas Karlman" <jonas at kwiboo.se>
>> An: "Frank Wunderlich" <linux at fw-web.de>
>> Cc: "Frank Wunderlich" <frank-w at public-files.de>, "Simon Glass" <sjg at chromium.org>, "Philipp Tomsich" <philipp.tomsich at vrull.eu>, "Kever Yang" <kever.yang at rock-chips.com>, "Marek Vasut" <marex at denx.de>, u-boot at lists.denx.de
>> Betreff: Re: [PATCH v3] board: rockchip: Add Bananapi R2Pro Board
>>
>> Hi Frank,
>>
>> On 2023-08-20 18:00, Frank Wunderlich wrote:
>>> From: Frank Wunderlich <frank-w at public-files.de>
>>>
>>> Add Bananapi R2 Pro board.
>>>
>>> Till now evb dts could be used, but iodomain is different
>>> (evb has 1v8 on vccio2 and vccio4 which are 3v3 on r2pro)
>>> and with iodomain driver this can cause hardware fault.
>>>
>>> Devicetree in mainline-Linux:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts
>>>
>>> Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
>>> ---
>>> v3:
>>> - disable gmac0 as switch-driver is not yet ready to attach to the mac
>>> v2:
>>> - drop switch-node for now as u-boot driver works differently to linux
>>> ---
>>>  arch/arm/dts/Makefile                     |   3 +-
>>>  arch/arm/dts/rk3568-bpi-r2pro-u-boot.dtsi |  23 +
>>>  arch/arm/dts/rk3568-bpi-r2pro.dts         | 549 ++++++++++++++++++++++
>>>  configs/bpi-r2pro-rk3568_defconfig        | 101 ++++
>>>  4 files changed, 675 insertions(+), 1 deletion(-)
>>>  create mode 100644 arch/arm/dts/rk3568-bpi-r2pro-u-boot.dtsi
>>>  create mode 100644 arch/arm/dts/rk3568-bpi-r2pro.dts
>>>  create mode 100644 configs/bpi-r2pro-rk3568_defconfig
>>>
>>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>>> index bd518064f35f..767bf9db39fb 100644
>>> --- a/arch/arm/dts/Makefile
>>> +++ b/arch/arm/dts/Makefile
>>> @@ -182,7 +182,8 @@ dtb-$(CONFIG_ROCKCHIP_RK3568) += \
>>>  	rk3568-nanopi-r5s.dtb \
>>>  	rk3568-odroid-m1.dtb \
>>>  	rk3568-radxa-e25.dtb \
>>> -	rk3568-rock-3a.dtb
>>> +	rk3568-rock-3a.dtb \
>>> +	rk3568-bpi-r2pro.dtb
>>>
>>>  dtb-$(CONFIG_ROCKCHIP_RK3588) += \
>>>  	rk3588-edgeble-neu6a-io.dtb \
>>> diff --git a/arch/arm/dts/rk3568-bpi-r2pro-u-boot.dtsi b/arch/arm/dts/rk3568-bpi-r2pro-u-boot.dtsi
>>> new file mode 100644
>>> index 000000000000..382a52a28b10
>>> --- /dev/null
>>> +++ b/arch/arm/dts/rk3568-bpi-r2pro-u-boot.dtsi
>>> @@ -0,0 +1,23 @@
>>> +// SPDX-License-Identifier: GPL-2.0+
>>> +/*
>>> + * (C) Copyright 2021 Rockchip Electronics Co., Ltd
>>> + */
>>> +
>>> +#include "rk356x-u-boot.dtsi"
>>> +
>>> +/ {
>>> +	chosen {
>>> +		stdout-path = &uart2;
>>> +		u-boot,spl-boot-order = "same-as-spl", &sdmmc0, &sdhci;
>>
>> This is the default order in rk356x-u-boot.dtsi and can be dropped.
>>
>>> +	};
>>> +};
>>> +
>>> +&sdmmc0 {
>>> +	status = "okay";
>>
>> sdmmc0 is already enabled in rk3568-bpi-r2pro.dts
>>
>>> +};
>>> +
>>> +&uart2 {
>>> +	clock-frequency = <24000000>;
>>> +	bootph-pre-ram;
>>> +	status = "okay";
>>> +};
> 
> then i have only the uart here...right? do you remember i missed the -uboot.dtsi in first try and board does not find mmc in spl.
> 
> do i really not need the first 2 nodes here?

The chosen node with stdout-path prop and uart2 node should probably
be the only nodes left.

If you are having issues with mmc in SPL, I would first look at pinctrl,
ensure pinctrl is enabled in SPL and that pinctrl-0 prop is defined for
your sdmmc0 and sdhci node. OF_SPL_REMOVE_PROPS should also not list
pinctrl nodes, look at defconfig for other rk356x boards, e.g.
rock-3a-rk3568_defconfig should be a good candidate and one I test
frequently.

And if that does not help and there is a regulator that is not enable by
default you may need to enable gpio and regulator pinconf nodes and
related Kconfig options for SPL.

See rk3566-quartz64-a-u-boot.dtsi where I had to enable gpio0, vcc3v3_sd
and vcc_sd_h node and related Kconfig options to have working sd-card.

> 
>>> diff --git a/arch/arm/dts/rk3568-bpi-r2pro.dts b/arch/arm/dts/rk3568-bpi-r2pro.dts
>>> new file mode 100644
>>> index 000000000000..e4fcbb8a1174
>>> --- /dev/null
>>> +++ b/arch/arm/dts/rk3568-bpi-r2pro.dts
>>
>> Should be a 1:1 copy from kernel.
> 
> i try to do so, but this will result in many nodes not used in uboot like the switch i remove in the dtsi and graphics.
> thx for pointing to the pcie driver then i can let these nodes in.

This file should be a full 1:1 copy, if you need to modify any node for
U-Boot you should do such override in -u-boot.dtsi file. You can use
/delete-property/ or /delete-node/ if you really need to remove
something that cause issues for U-Boot, else leave the nodes even if
they are not useful for U-Boot itself. Having full DT should make it
possible to EFI boot generic aarch64 distro images, e.g. fedora etc.

> 
>> [...]
>>
>>> diff --git a/configs/bpi-r2pro-rk3568_defconfig b/configs/bpi-r2pro-rk3568_defconfig
>>> new file mode 100644
>>> index 000000000000..e8936261eab3
>>> --- /dev/null
>>> +++ b/configs/bpi-r2pro-rk3568_defconfig
>>> @@ -0,0 +1,101 @@
>>> +CONFIG_ARM=y
>>> +CONFIG_SKIP_LOWLEVEL_INIT=y
>>> +CONFIG_COUNTER_FREQUENCY=24000000
>>> +CONFIG_ARCH_ROCKCHIP=y
>>> +CONFIG_TEXT_BASE=0x00a00000
>>> +CONFIG_SPL_LIBCOMMON_SUPPORT=y
>>> +CONFIG_SPL_LIBGENERIC_SUPPORT=y
>>> +CONFIG_NR_DRAM_BANKS=2
>>> +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
>>> +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc00000
>>> +CONFIG_DEFAULT_DEVICE_TREE="rk3568-bpi-r2pro"
>>> +CONFIG_ROCKCHIP_RK3568=y
>>> +CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
>>> +CONFIG_SPL_SERIAL=y
>>> +CONFIG_SPL_STACK_R_ADDR=0x600000
>>> +CONFIG_SPL_STACK=0x400000
>>> +CONFIG_DEBUG_UART_BASE=0xFE660000
>>> +CONFIG_DEBUG_UART_CLOCK=24000000
>>> +CONFIG_SYS_LOAD_ADDR=0xc00800
>>> +CONFIG_DEBUG_UART=y
>>> +CONFIG_FIT=y
>>> +CONFIG_FIT_VERBOSE=y
>>> +CONFIG_SPL_FIT_SIGNATURE=y
>>> +CONFIG_SPL_LOAD_FIT=y
>>> +CONFIG_LEGACY_IMAGE_FORMAT=y
>>> +#CONFIG_OF_SYSTEM_SETUP=y
>>> +CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-bpi-r2pro"
>>> +# CONFIG_DISPLAY_CPUINFO is not set
>>> +CONFIG_DISPLAY_BOARDINFO_LATE=y
>>> +CONFIG_SPL_MAX_SIZE=0x40000
>>> +CONFIG_SPL_PAD_TO=0x7f8000
>>> +CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
>>> +CONFIG_SPL_BSS_START_ADDR=0x4000000
>>> +CONFIG_SPL_BSS_MAX_SIZE=0x4000
>>> +# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
>>> +# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
>>> +CONFIG_SPL_STACK_R=y
>>> +CONFIG_SPL_ATF=y
>>> +CONFIG_CMD_GPIO=y
>>> +CONFIG_CMD_GPT=y
>>> +CONFIG_CMD_I2C=y
>>> +CONFIG_CMD_MMC=y
>>> +CONFIG_CMD_PMIC=y
>>> +CONFIG_CMD_REGULATOR=y
>>> +# CONFIG_SPL_DOS_PARTITION is not set
>>> +CONFIG_SPL_OF_CONTROL=y
>>> +CONFIG_OF_LIVE=y
>>> +CONFIG_NET=n
>>> +CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
>>> +CONFIG_SPL_REGMAP=y
>>> +CONFIG_SPL_SYSCON=y
>>> +CONFIG_SPL_CLK=y
>>> +CONFIG_ROCKCHIP_GPIO=y
>>> +CONFIG_ROCKCHIP_GPIO_V2=y
>>
>> This Kconfig option does not exits.
>>
>>> +CONFIG_SYS_I2C_ROCKCHIP=y
>>> +CONFIG_MISC=y
>>> +CONFIG_SUPPORT_EMMC_RPMB=y
>>> +CONFIG_MMC_DW=y
>>> +CONFIG_MMC_DW_ROCKCHIP=y
>>> +CONFIG_MMC_SDHCI=y
>>> +CONFIG_MMC_SDHCI_SDMA=y
>>> +CONFIG_MMC_SDHCI_ROCKCHIP=y
>>> +CONFIG_ETH_DESIGNWARE=y
>>> +CONFIG_GMAC_ROCKCHIP=y
>>
>> Please drop CONFIG_ETH_DESIGNWARE and CONFIG_GMAC_ROCKCHIP.
>>
>> The following series that add GMAC support for RK3568 and RK3588 will
>> use DWC_ETH_QOS and DWC_ETH_QOS_ROCKCHIP Kconfig options.
>>
>> rockchip: Add GMAC support for RK3568 and RK3588
>> https://patchwork.ozlabs.org/project/uboot/cover/20230807000817.1701012-1-jonas@kwiboo.se/
>>
>>> +CONFIG_DM_PMIC=y
>>> +CONFIG_PMIC_RK8XX=y
>>> +CONFIG_REGULATOR_RK8XX=y
>>> +CONFIG_REGULATOR_PWM=y
>>> +CONFIG_PWM_ROCKCHIP=y
>>> +CONFIG_SPL_RAM=y
>>> +CONFIG_BAUDRATE=1500000
>>> +CONFIG_DEBUG_UART_SHIFT=2
>>> +CONFIG_SYS_NS16550_MEM32=y
>>> +CONFIG_SYSRESET=y
>>> +CONFIG_SYSRESET_PSCI=y
>>> +CONFIG_ERRNO_STR=y
>>> +CONFIG_SYS_PROMPT="BPI-R2PRO> "
>>> +CONFIG_CMD_SYSBOOT=y
>>> +CONFIG_CMD_BOOTDEV=y
>>> +CONFIG_BOOTSTD_FULL=y
>>> +CONFIG_CMD_EFICONFIG=n
>>> +CONFIG_EFI_LOADER=n
>>> +CONFIG_USB=y
>>> +CONFIG_USB_XHCI_HCD=y
>>> +CONFIG_USB_XHCI_DWC3=y
>>
>> This should not be enabled for rk3568, USB_DWC3_GENERIC provide usb
>> support.
>>
>>> +CONFIG_USB_DWC3_GENERIC=y
>>> +CONFIG_USB_EHCI_HCD=y
>>> +CONFIG_USB_EHCI_GENERIC=y
>>> +CONFIG_USB_OHCI_HCD=y
>>> +CONFIG_USB_OHCI_GENERIC=y
>>> +CONFIG_USB_UHCI_HCD=y
>>> +CONFIG_USB_DWC2=y
>>
>> There should not be any need to enable this driver on rk3568.
>>
>>> +CONFIG_USB_DWC3=y
>>> +CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
>>> +CONFIG_PHY_ROCKCHIP_INNO_USB2=y
>>> +CONFIG_CMD_USB=y
>>> +CONFIG_AHCI=y
>>> +CONFIG_DWC_AHCI=y
>>> +CONFIG_SCSI=y
>>> +CONFIG_DM_SCSI=y
>>> +CONFIG_CMD_SCSI=y
>>
>> Please run moveconfig.py to clean up and re-order the defconfig.
> 
> can you give me an example how i can pass my defconfig with the script?
> 
> ./tools/moveconfig.py configs/bpi-r2pro-rk3568_defconfig
> ./tools/moveconfig.py -d configs/bpi-r2pro-rk3568_defconfig
> 
> do not work here...have not found a way in the --help page...i guess i misunderstand the script

Probably much easier to use make savedefconfig instead of the moveconfig.py script.

Regards,
Jonas

> 
> regards Frank
> 
>> Regards,
>> Jonas



More information about the U-Boot mailing list