Re: [PATCH v3] board: rockchip: add Rockchip Toybrick TB-RK3588X board

2024-03-05 Thread Dan Carpenter
On Tue, Mar 05, 2024 at 09:29:22AM +0800, zhangzj wrote:
> +
> +#ifdef CONFIG_OF_BOARD_SETUP
> +static int rk3588_add_reserved_memory_fdt_nodes(void *new_blob)
> +{
> + struct fdt_memory gap1 = {
> + .start = 0x3fc00,
> + .end = 0x3fc4f,
> + };
> + struct fdt_memory gap2 = {
> + .start = 0x3fff0,
> + .end = 0x3,
> + };
> + unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP;
> + unsigned int ret;

"ret" should be int.  This doesn't affect runtime at all though.
#nitpicking

regards,
dan carpenter

> +
> + /*
> +  * Inject the reserved-memory nodes into the DTS
> +  */
> + ret = fdtdec_add_reserved_memory(new_blob, "gap1", ,  NULL, 0,
> +  NULL, flags);
> + if (ret)
> + return ret;
> +
> + return fdtdec_add_reserved_memory(new_blob, "gap2", ,  NULL, 0,
> +   NULL, flags);
> +}



[PATCH v3] board: rockchip: add Rockchip Toybrick TB-RK3588X board

2024-03-04 Thread zhangzj
From: Elon Zhang 

TB-RK3588X board is a Rockchip Toybrick RK3588 based development board.

Specification:
Rockchip Rk3588 SoC
4x ARM Cortex-A76, 4x ARM Cortex-A55
8/16GB Memory LPDDR4x
Mali G610MC4 GPU
2× MIPI-CSI0 Connector
1x 2Lanes PCIe3.0 Connector
1x SATA3.0 Connector
32GB eMMC Module
2x USB 2.0, 2x USB 3.0
1x HDMI Output, 1x HDMI Input
2x Ethernet Port

Functions work normally:
[1] USB2.0 Host
[2] Ethernet0 with PHY RTL8211F

More information can be obtained from the following websites:
[1] https://t.rock-chips.com/en/wiki/EN/tb-rk3588x_en/index.html
[2] http://t.rock-chips.com/

Kernel commits:
8ffe365f8dc7 ("arm64: dts: rockchip: Add devicetree support for 
TB-RK3588X board")
7140387ff49d ("dt-bindings: arm: rockchip: Add Toybrick TB-RK3588X")

Reviewed-by: Weizhao Ouyang 
Signed-off-by: Elon Zhang 
---
Changes since v2:
  - Sync dts file from upstream linux kernel

Changes since v1:
  - Remove BOARD_SPECIFIC_OPTIONS in board Kconfig
---
 arch/arm/dts/rk3588-toybrick-x0-u-boot.dtsi   |  12 +
 arch/arm/dts/rk3588-toybrick-x0.dts   | 688 ++
 arch/arm/mach-rockchip/rk3588/Kconfig |  25 +
 board/rockchip/toybrick_rk3588/Kconfig|  12 +
 board/rockchip/toybrick_rk3588/MAINTAINERS|   8 +
 board/rockchip/toybrick_rk3588/Makefile   |   6 +
 .../toybrick_rk3588/toybrick-rk3588.c |  39 +
 configs/toybrick-rk3588_defconfig |  82 +++
 doc/board/rockchip/rockchip.rst   |   1 +
 include/configs/toybrick_rk3588.h |  15 +
 10 files changed, 888 insertions(+)
 create mode 100644 arch/arm/dts/rk3588-toybrick-x0-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3588-toybrick-x0.dts
 create mode 100644 board/rockchip/toybrick_rk3588/Kconfig
 create mode 100644 board/rockchip/toybrick_rk3588/MAINTAINERS
 create mode 100644 board/rockchip/toybrick_rk3588/Makefile
 create mode 100644 board/rockchip/toybrick_rk3588/toybrick-rk3588.c
 create mode 100644 configs/toybrick-rk3588_defconfig
 create mode 100644 include/configs/toybrick_rk3588.h

diff --git a/arch/arm/dts/rk3588-toybrick-x0-u-boot.dtsi 
b/arch/arm/dts/rk3588-toybrick-x0-u-boot.dtsi
new file mode 100644
index 00..1aeb5410e4
--- /dev/null
+++ b/arch/arm/dts/rk3588-toybrick-x0-u-boot.dtsi
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Rockchip Electronics Co., Ltd.
+ */
+
+#include "rk3588-u-boot.dtsi"
+
+/ {
+   chosen {
+   u-boot,spl-boot-order = "same-as-spl", 
+   };
+};
diff --git a/arch/arm/dts/rk3588-toybrick-x0.dts 
b/arch/arm/dts/rk3588-toybrick-x0.dts
new file mode 100644
index 00..9090c5c99f
--- /dev/null
+++ b/arch/arm/dts/rk3588-toybrick-x0.dts
@@ -0,0 +1,688 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Rockchip Electronics Co., Ltd.
+ *
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include 
+#include "rk3588.dtsi"
+
+/ {
+   model = "Rockchip Toybrick TB-RK3588X Board";
+   compatible = "rockchip,rk3588-toybrick-x0", "rockchip,rk3588";
+
+   aliases {
+   mmc0 = 
+   };
+
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   adc-keys {
+   compatible = "adc-keys";
+   io-channels = < 1>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <180>;
+   poll-interval = <100>;
+
+   button-vol-up {
+   label = "Volume Up";
+   linux,code = ;
+   press-threshold-microvolt = <17000>;
+   };
+
+   button-vol-down {
+   label = "Volume Down";
+   linux,code = ;
+   press-threshold-microvolt = <417000>;
+   };
+
+   button-menu {
+   label = "Menu";
+   linux,code = ;
+   press-threshold-microvolt = <89>;
+   };
+
+   button-escape {
+   label = "Escape";
+   linux,code = ;
+   press-threshold-microvolt = <1235000>;
+   };
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   power-supply = <_dcin>;
+   pwms = < 0 25000 0>;
+   };
+
+   pcie20_avdd0v85: pcie20-avdd0v85-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "pcie20_avdd0v85";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <85>;
+   regulator-max-microvolt = <85>;
+   vin-supply = <_0v85_s0>;
+   };
+
+   pcie20_avdd1v8: pcie20-avdd1v8-regulator {
+   compatible =