Re: [PATCH v3] board: rockchip: add Radxa ROCK5A Rk3588 board

2023-07-04 Thread Jonas Karlman
On 2023-07-04 10:50, Eugen Hristev wrote:
> ROCK 5A is a Rockchip RK3588S based SBC (Single Board Computer) by Radxa.
> 
> There are tree variants depending on the DRAM size : 4G, 8G and 16G.
> 
> Specifications:
> 
>  Rockchip Rk3588S SoC
>  4x ARM Cortex-A76, 4x ARM Cortex-A55
>  4/8/16GB memory LPDDR4x
>  Mali G610MC4 GPU
>  MIPI CSI 2 multiple lanes connector
>  4-lane MIPI DSI connector
>  Audio – 3.5mm earphone jack
>  eMMC module connector
>  uSD slot (up to 128GB)
>  2x USB 2.0, 2x USB 3.0
>  2x micro HDMI 2.1 ports, one up to 8Kp60, the other up to 4Kp60
>  Gigabit Ethernet RJ45 with optional PoE support
>  40-pin IO header including UART, SPI, I2C and 5V DC power in
>  USB PD over USB Type-C
>  Size: 85mm x 56mm (Raspberry Pi 4 form factor)
> 
> Kernel commits:
> d1824cf95799 ("arm64: dts: rockchip: Add rock-5a board")
> 991f136c9f8d ("arm64: dts: rockchip: Update sdhci alias for rock-5a")
> 304c8a759953 ("arm64: dts: rockchip: Remove empty line from rock-5a")
> cda0c2ea65a0 ("arm64: dts: rockchip: Fix RX delay for ethernet phy on 
> rk3588s-rock5a")
> 
> Signed-off-by: Eugen Hristev 
> ---
> Changes in v3:
> - forgot to add defconfig and include file, added now, sorry
> Changes in v2:
> -fixed wrong Kconfig text (rk3588s instead of rk3588)
> -changed doc name (rk3588s instead of rk3588)
> 
> 
>  arch/arm/dts/Makefile   |  1 +
>  arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi| 90 +
>  arch/arm/dts/rk3588s-rock-5a.dts| 73 +
>  arch/arm/mach-rockchip/rk3588/Kconfig   | 28 +++
>  board/radxa/rock5a-rk3588s/Kconfig  | 15 
>  board/radxa/rock5a-rk3588s/MAINTAINERS  |  6 ++
>  board/radxa/rock5a-rk3588s/Makefile |  6 ++
>  board/radxa/rock5a-rk3588s/rock5a-rk3588s.c | 39 +
>  configs/rock5a-rk3588s_defconfig| 71 
>  doc/board/rockchip/rockchip.rst |  1 +
>  include/configs/rock5a-rk3588s.h| 15 
>  11 files changed, 345 insertions(+)
>  create mode 100644 arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3588s-rock-5a.dts
>  create mode 100644 board/radxa/rock5a-rk3588s/Kconfig
>  create mode 100644 board/radxa/rock5a-rk3588s/MAINTAINERS
>  create mode 100644 board/radxa/rock5a-rk3588s/Makefile
>  create mode 100644 board/radxa/rock5a-rk3588s/rock5a-rk3588s.c
>  create mode 100644 configs/rock5a-rk3588s_defconfig
>  create mode 100644 include/configs/rock5a-rk3588s.h
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 480269fa6065..cd9b96c5ba7c 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -174,6 +174,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3568) += \
>  dtb-$(CONFIG_ROCKCHIP_RK3588) += \
>   rk3588-edgeble-neu6a-io.dtb \
>   rk3588-evb1-v10.dtb \
> + rk3588s-rock-5a.dtb \
>   rk3588-rock-5b.dtb
>  
>  dtb-$(CONFIG_ROCKCHIP_RV1108) += \
> diff --git a/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi 
> b/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
> new file mode 100644
> index ..a546f9e4dcc2
> --- /dev/null
> +++ b/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
> @@ -0,0 +1,90 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2023 Collabora Ltd.
> + */
> +
> +#include "rk3588s-u-boot.dtsi"
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/ {
> + aliases {
> + mmc1 = &sdmmc;
> + };
> +
> + chosen {
> + u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
> + };
> +};
> +
> +&emmc_bus8 {
> + bootph-all;
> +};
> +
> +&emmc_clk {
> + bootph-all;
> +};
> +
> +&emmc_cmd {
> + bootph-all;
> +};
> +
> +&emmc_data_strobe {
> + bootph-all;
> +};
> +
> +&emmc_rstnout {
> + bootph-all;
> +};
> +
> +&pinctrl {
> + bootph-all;
> +};

This and other common pinctrl nodes could be moved to rk3588s-u-boot.dtsi.

I did something like that for rk3568, instead of having to repeat these
for multiple boards.

See 
https://patchwork.ozlabs.org/project/uboot/patch/20230702173433.3818521-4-jo...@kwiboo.se/

> +
> +&pcfg_pull_none {
> + bootph-all;
> +};
> +
> +&pcfg_pull_up_drv_level_2 {
> + bootph-all;
> +};
> +
> +&pcfg_pull_up {
> + bootph-all;
> +};
> +
> +&sdmmc {
> + bus-width = <4>;
> + status = "okay";
> +};
> +
> +&sdmmc_bus4 {
> + bootph-all;
> +};
> +
> +&sdmmc_clk {
> + bootph-all;
> +};
> +
> +&sdmmc_cmd {
> + bootph-all;
> +};
> +
> +&sdmmc_det {
> + bootph-all;
> +};
> +
> +&sdhci {
> + cap-mmc-highspeed;
> + mmc-ddr-1_8v;
> + mmc-hs200-1_8v;
> + pinctrl-names = "default";
> + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_data_strobe 
> &emmc_rstnout>;
> +};
> +
> +&uart2m0_xfer {
> + bootph-all;
> +};
> +
> diff --git a/arch/arm/dts/rk3588s-rock-5a.dts 
> b/arch/arm/dts/rk3588s-rock-5a.dts
> new file mode 100644
> index ..901825514f9d
> --- /dev

[PATCH v3] board: rockchip: add Radxa ROCK5A Rk3588 board

2023-07-04 Thread Eugen Hristev
ROCK 5A is a Rockchip RK3588S based SBC (Single Board Computer) by Radxa.

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

Specifications:

 Rockchip Rk3588S SoC
 4x ARM Cortex-A76, 4x ARM Cortex-A55
 4/8/16GB memory LPDDR4x
 Mali G610MC4 GPU
 MIPI CSI 2 multiple lanes connector
 4-lane MIPI DSI connector
 Audio – 3.5mm earphone jack
 eMMC module connector
 uSD slot (up to 128GB)
 2x USB 2.0, 2x USB 3.0
 2x micro HDMI 2.1 ports, one up to 8Kp60, the other up to 4Kp60
 Gigabit Ethernet RJ45 with optional PoE support
 40-pin IO header including UART, SPI, I2C and 5V DC power in
 USB PD over USB Type-C
 Size: 85mm x 56mm (Raspberry Pi 4 form factor)

Kernel commits:
d1824cf95799 ("arm64: dts: rockchip: Add rock-5a board")
991f136c9f8d ("arm64: dts: rockchip: Update sdhci alias for rock-5a")
304c8a759953 ("arm64: dts: rockchip: Remove empty line from rock-5a")
cda0c2ea65a0 ("arm64: dts: rockchip: Fix RX delay for ethernet phy on 
rk3588s-rock5a")

Signed-off-by: Eugen Hristev 
---
Changes in v3:
- forgot to add defconfig and include file, added now, sorry
Changes in v2:
-fixed wrong Kconfig text (rk3588s instead of rk3588)
-changed doc name (rk3588s instead of rk3588)


 arch/arm/dts/Makefile   |  1 +
 arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi| 90 +
 arch/arm/dts/rk3588s-rock-5a.dts| 73 +
 arch/arm/mach-rockchip/rk3588/Kconfig   | 28 +++
 board/radxa/rock5a-rk3588s/Kconfig  | 15 
 board/radxa/rock5a-rk3588s/MAINTAINERS  |  6 ++
 board/radxa/rock5a-rk3588s/Makefile |  6 ++
 board/radxa/rock5a-rk3588s/rock5a-rk3588s.c | 39 +
 configs/rock5a-rk3588s_defconfig| 71 
 doc/board/rockchip/rockchip.rst |  1 +
 include/configs/rock5a-rk3588s.h| 15 
 11 files changed, 345 insertions(+)
 create mode 100644 arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3588s-rock-5a.dts
 create mode 100644 board/radxa/rock5a-rk3588s/Kconfig
 create mode 100644 board/radxa/rock5a-rk3588s/MAINTAINERS
 create mode 100644 board/radxa/rock5a-rk3588s/Makefile
 create mode 100644 board/radxa/rock5a-rk3588s/rock5a-rk3588s.c
 create mode 100644 configs/rock5a-rk3588s_defconfig
 create mode 100644 include/configs/rock5a-rk3588s.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 480269fa6065..cd9b96c5ba7c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -174,6 +174,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3568) += \
 dtb-$(CONFIG_ROCKCHIP_RK3588) += \
rk3588-edgeble-neu6a-io.dtb \
rk3588-evb1-v10.dtb \
+   rk3588s-rock-5a.dtb \
rk3588-rock-5b.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RV1108) += \
diff --git a/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi 
b/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
new file mode 100644
index ..a546f9e4dcc2
--- /dev/null
+++ b/arch/arm/dts/rk3588s-rock-5a-u-boot.dtsi
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Collabora Ltd.
+ */
+
+#include "rk3588s-u-boot.dtsi"
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   aliases {
+   mmc1 = &sdmmc;
+   };
+
+   chosen {
+   u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
+   };
+};
+
+&emmc_bus8 {
+   bootph-all;
+};
+
+&emmc_clk {
+   bootph-all;
+};
+
+&emmc_cmd {
+   bootph-all;
+};
+
+&emmc_data_strobe {
+   bootph-all;
+};
+
+&emmc_rstnout {
+   bootph-all;
+};
+
+&pinctrl {
+   bootph-all;
+};
+
+&pcfg_pull_none {
+   bootph-all;
+};
+
+&pcfg_pull_up_drv_level_2 {
+   bootph-all;
+};
+
+&pcfg_pull_up {
+   bootph-all;
+};
+
+&sdmmc {
+   bus-width = <4>;
+   status = "okay";
+};
+
+&sdmmc_bus4 {
+   bootph-all;
+};
+
+&sdmmc_clk {
+   bootph-all;
+};
+
+&sdmmc_cmd {
+   bootph-all;
+};
+
+&sdmmc_det {
+   bootph-all;
+};
+
+&sdhci {
+   cap-mmc-highspeed;
+   mmc-ddr-1_8v;
+   mmc-hs200-1_8v;
+   pinctrl-names = "default";
+   pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_data_strobe 
&emmc_rstnout>;
+};
+
+&uart2m0_xfer {
+   bootph-all;
+};
+
diff --git a/arch/arm/dts/rk3588s-rock-5a.dts b/arch/arm/dts/rk3588s-rock-5a.dts
new file mode 100644
index ..901825514f9d
--- /dev/null
+++ b/arch/arm/dts/rk3588s-rock-5a.dts
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+/dts-v1/;
+
+#include 
+#include 
+#include "rk3588s.dtsi"
+
+/ {
+   model = "Radxa ROCK 5 Model A";
+   compatible = "radxa,rock-5a", "rockchip,rk3588s";
+
+   aliases {
+   mmc0 = &sdhci;
+   serial2 = &uart2;
+   };
+
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+};
+
+&gmac1 {
+   clock_in_out = "output";
+   phy-handle = <&rgmii_phy1>;
+   phy-mode = "rgmii";
+   pinctrl-0 = <&gmac1_mii