Re: [PATCH 2/2] rockchip: add support for Theobroma Systems SOM-RK3588-Q7 Tiger module

2024-04-23 Thread Quentin Schulz

Hi Jonas,

On 4/22/24 19:54, Jonas Karlman wrote:

Hi Quentin,

On 2024-04-22 18:41, Quentin Schulz wrote:

From: Quentin Schulz 

[...]

diff --git a/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
new file mode 100644
index 000..4259399193a
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi

[...]


Following should be added to possible fix uart2 pinctrl in SPL:

   _xfer {
bootph-all;
   };



Would only be useful once we get rid of DDR bin, but will do it now 
because I have a feeling I would forget otherwise :)


Thanks for catching this though.

[...]


[snip]


diff --git a/configs/tiger-rk3588_defconfig b/configs/tiger-rk3588_defconfig
new file mode 100644
index 000..6545445bba1
--- /dev/null
+++ b/configs/tiger-rk3588_defconfig

[...]

+CONFIG_USB_XHCI_DWC3=y


Please use USB_DWC3_GENERIC instead of USB_XHCI_DWC3.



Dang, I thought I was using "the correct one".

It's very difficult to know which one to pick right now, would it be 
possible to update the help message to guide the users a bit more in 
their choice? I don't really have a clue why one is "better" than the 
other so wouldn't be able to suggest something.


Cheers,
Quentin


Re: [PATCH 2/2] rockchip: add support for Theobroma Systems SOM-RK3588-Q7 Tiger module

2024-04-22 Thread Jonas Karlman
Hi Quentin,

On 2024-04-22 18:41, Quentin Schulz wrote:
> From: Quentin Schulz 
> 
> The RK3588-Q7 SoM is a Qseven-compatible (70mm x 70mm, MXM-230
> connector) system-on-module from Theobroma Systems, featuring the
> Rockchip RK3588.
> 
> It provides the following feature set:
>  * up to 16GB LPDDR4x
>  * on-module eMMC
>  * SD card (on a baseboard) via edge connector
>  * Gigabit Ethernet with on-module GbE PHY
>  * HDMI/eDP
>  * MIPI-DSI
>  * 4x MIPI-CSI (3x on FPC connectors, 1x over Q7)
>  * HDMI input over FPC connector
>  * CAN
>  * USB
>- 1x USB 3.0 dual-role (direct connection)
>- 2x USB 3.0 host + 1x USB 2.0 host
>  * PCIe
>- 1x PCIe 2.1 Gen3, 4 lanes
>- 2xSATA / 2x PCIe 2.1 Gen1, 2 lanes
>  * on-module ATtiny816 companion controller, implementing:
>- low-power RTC functionality (ISL1208 emulation)
>- fan controller (AMC6821 emulation)
>   * on-module Secure Element with Global Platform 2.2.1 compliant
> JavaCard environment
> 
> The support is added for Tiger on Haikou devkit, similarly to RK3399
> Puma and PX30 Ringneck.
> 
> The DTS and DTSI are taken from upstream Linux kernel v6.9-rc4.
> 
> Cc: Quentin Schulz 
> Signed-off-by: Quentin Schulz 
> ---
>  arch/arm/dts/Makefile  |   1 +
>  arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi   |  54 ++
>  arch/arm/dts/rk3588-tiger-haikou.dts   | 266 
>  arch/arm/dts/rk3588-tiger.dtsi | 690 
> +
>  arch/arm/mach-rockchip/rk3588/Kconfig  |  31 +
>  board/theobroma-systems/tiger_rk3588/Kconfig   |  16 +
>  board/theobroma-systems/tiger_rk3588/MAINTAINERS   |  13 +
>  board/theobroma-systems/tiger_rk3588/Makefile  |  10 +
>  .../theobroma-systems/tiger_rk3588/tiger_rk3588.c  |  53 ++
>  configs/tiger-rk3588_defconfig | 114 
>  doc/board/rockchip/rockchip.rst|   1 +
>  doc/board/theobroma-systems/index.rst  |   1 +
>  doc/board/theobroma-systems/tiger_rk3588.rst   | 102 +++
>  include/configs/tiger_rk3588.h |  15 +
>  14 files changed, 1367 insertions(+)
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index b1c9c6222e5..ef901642a0a 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -180,6 +180,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3588) += \
>   rk3588-quartzpro64.dtb \
>   rk3588s-rock-5a.dtb \
>   rk3588-rock-5b.dtb \
> + rk3588-tiger-haikou.dtb \
>   rk3588-turing-rk1.dtb
>  
>  dtb-$(CONFIG_ROCKCHIP_RV1108) += \
> diff --git a/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi 
> b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
> new file mode 100644
> index 000..4259399193a
> --- /dev/null
> +++ b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
> @@ -0,0 +1,54 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2024 Theobroma Systems Design und Consulting GmbH
> + */
> +
> +#include "rk3588-u-boot.dtsi"
> +
> +/ {
> + chosen {
> + u-boot,spl-boot-order = "same-as-spl", , 
> + };
> +};
> +
> +_pwrseq {
> + bootph-pre-ram;
> + bootph-some-ram;
> +};
> +
> +_reset {
> + bootph-pre-ram;
> + bootph-some-ram;
> +};
> +
> + {
> + bootph-pre-ram;
> + bootph-some-ram;
> +};
> +
> + {
> + /* U-Boot currently cannot handle anything below HS200 for eMMC on 
> RK3588 */
> + /delete-property/ mmc-ddr-1_8v;
> + /delete-property/ cap-mmc-highspeed;
> +};
> +
> +/* Q7 USB P0 */
> + {
> + status = "okay";
> +};
> +
> +_otg {
> + status = "okay";
> +};
> +
> +_phy1 {
> + status = "okay";
> +};
> +
> +_phy1_u3 {
> + status = "okay";
> +};
> +
> +_host1_xhci {
> + status = "okay";
> +};

Following should be added to possible fix uart2 pinctrl in SPL:

  _xfer {
bootph-all;
  };

[snip]

> diff --git a/configs/tiger-rk3588_defconfig b/configs/tiger-rk3588_defconfig
> new file mode 100644
> index 000..6545445bba1
> --- /dev/null
> +++ b/configs/tiger-rk3588_defconfig
> @@ -0,0 +1,114 @@
> +CONFIG_ARM=y
> +CONFIG_SKIP_LOWLEVEL_INIT=y
> +CONFIG_COUNTER_FREQUENCY=2400
> +CONFIG_ARCH_ROCKCHIP=y
> +CONFIG_SPL_GPIO=y
> +CONFIG_SF_DEFAULT_SPEED=2400
> +CONFIG_SF_DEFAULT_MODE=0x2000
> +CONFIG_ENV_SIZE=0x1f000
> +CONFIG_DEFAULT_DEVICE_TREE="rk3588-tiger-haikou"
> +CONFIG_ROCKCHIP_RK3588=y
> +CONFIG_ROCKCHIP_BOOT_MODE_REG=0x0
> +CONFIG_SPL_SERIAL=y
> +CONFIG_DEBUG_UART_CHANNEL=2
> +CONFIG_TARGET_TIGER_RK3588=y
> +CONFIG_DEBUG_UART_BASE=0xfeb5
> +CONFIG_DEBUG_UART_CLOCK=2400
> +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_BOOTMETH_VBE is not set
> +CONFIG_LEGACY_IMAGE_FORMAT=y
> +CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-tiger-haikou.dtb"
> +# CONFIG_DISPLAY_CPUINFO is not set
> +CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_CYCLIC=y
> +CONFIG_SPL_MAX_SIZE=0x4
> 

[PATCH 2/2] rockchip: add support for Theobroma Systems SOM-RK3588-Q7 Tiger module

2024-04-22 Thread Quentin Schulz
From: Quentin Schulz 

The RK3588-Q7 SoM is a Qseven-compatible (70mm x 70mm, MXM-230
connector) system-on-module from Theobroma Systems, featuring the
Rockchip RK3588.

It provides the following feature set:
 * up to 16GB LPDDR4x
 * on-module eMMC
 * SD card (on a baseboard) via edge connector
 * Gigabit Ethernet with on-module GbE PHY
 * HDMI/eDP
 * MIPI-DSI
 * 4x MIPI-CSI (3x on FPC connectors, 1x over Q7)
 * HDMI input over FPC connector
 * CAN
 * USB
   - 1x USB 3.0 dual-role (direct connection)
   - 2x USB 3.0 host + 1x USB 2.0 host
 * PCIe
   - 1x PCIe 2.1 Gen3, 4 lanes
   - 2xSATA / 2x PCIe 2.1 Gen1, 2 lanes
 * on-module ATtiny816 companion controller, implementing:
   - low-power RTC functionality (ISL1208 emulation)
   - fan controller (AMC6821 emulation)
  * on-module Secure Element with Global Platform 2.2.1 compliant
JavaCard environment

The support is added for Tiger on Haikou devkit, similarly to RK3399
Puma and PX30 Ringneck.

The DTS and DTSI are taken from upstream Linux kernel v6.9-rc4.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi   |  54 ++
 arch/arm/dts/rk3588-tiger-haikou.dts   | 266 
 arch/arm/dts/rk3588-tiger.dtsi | 690 +
 arch/arm/mach-rockchip/rk3588/Kconfig  |  31 +
 board/theobroma-systems/tiger_rk3588/Kconfig   |  16 +
 board/theobroma-systems/tiger_rk3588/MAINTAINERS   |  13 +
 board/theobroma-systems/tiger_rk3588/Makefile  |  10 +
 .../theobroma-systems/tiger_rk3588/tiger_rk3588.c  |  53 ++
 configs/tiger-rk3588_defconfig | 114 
 doc/board/rockchip/rockchip.rst|   1 +
 doc/board/theobroma-systems/index.rst  |   1 +
 doc/board/theobroma-systems/tiger_rk3588.rst   | 102 +++
 include/configs/tiger_rk3588.h |  15 +
 14 files changed, 1367 insertions(+)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b1c9c6222e5..ef901642a0a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -180,6 +180,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3588) += \
rk3588-quartzpro64.dtb \
rk3588s-rock-5a.dtb \
rk3588-rock-5b.dtb \
+   rk3588-tiger-haikou.dtb \
rk3588-turing-rk1.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RV1108) += \
diff --git a/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
new file mode 100644
index 000..4259399193a
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include "rk3588-u-boot.dtsi"
+
+/ {
+   chosen {
+   u-boot,spl-boot-order = "same-as-spl", , 
+   };
+};
+
+_pwrseq {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+_reset {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+ {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+ {
+   /* U-Boot currently cannot handle anything below HS200 for eMMC on 
RK3588 */
+   /delete-property/ mmc-ddr-1_8v;
+   /delete-property/ cap-mmc-highspeed;
+};
+
+/* Q7 USB P0 */
+ {
+   status = "okay";
+};
+
+_otg {
+   status = "okay";
+};
+
+_phy1 {
+   status = "okay";
+};
+
+_phy1_u3 {
+   status = "okay";
+};
+
+_host1_xhci {
+   status = "okay";
+};
diff --git a/arch/arm/dts/rk3588-tiger-haikou.dts 
b/arch/arm/dts/rk3588-tiger-haikou.dts
new file mode 100644
index 000..d672198c6b6
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou.dts
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Theobroma Systems Design und Consulting GmbH
+ */
+
+/dts-v1/;
+#include 
+#include "rk3588-tiger.dtsi"
+
+/ {
+   model = "Theobroma Systems RK3588-Q7 SoM on Haikou devkit";
+   compatible = "tsd,rk3588-tiger-haikou", "tsd,rk3588-tiger", 
"rockchip,rk3588";
+
+   aliases {
+   ethernet0 = 
+   mmc1 = 
+   };
+
+   chosen {
+   stdout-path = "serial2:115200n8";
+   };
+
+   dc_12v: dc-12v-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "dc_12v";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <1200>;
+   regulator-max-microvolt = <1200>;
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_keys_pin>;
+
+   button-batlow-n {
+   label = "BATLOW#";
+   linux,code = ;
+   gpios = < RK_PB5 GPIO_ACTIVE_LOW>;
+   };
+
+   button-slp-btn-n {
+   label = "SLP_BTN#";
+   linux,code = ;
+