From 2bb4255e57ce1806dafcf5dfa62807f147a6d8f9 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 18 Jul 2024 17:41:45 +0200
Subject: [PATCH 456/463] ARM: dts: rockchip: Add support for Luckfox Pico Pro
 Max

Just like Pico Mini but with onboard ethernet port and more RAM, due
to use of RV1106.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 arch/arm/boot/dts/rockchip/Makefile           |   1 +
 .../rockchip/rv1106g-luckfox-pico-pro-max.dts | 170 ++++++++++++++++++
 2 files changed, 171 insertions(+)
 create mode 100644 arch/arm/boot/dts/rockchip/rv1106g-luckfox-pico-pro-max.dts

diff --git a/arch/arm/boot/dts/rockchip/Makefile b/arch/arm/boot/dts/rockchip/Makefile
index 42441e05e2722..7948798bc433d 100644
--- a/arch/arm/boot/dts/rockchip/Makefile
+++ b/arch/arm/boot/dts/rockchip/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rv1103g-luckfox-pico-mini-b.dtb \
+	rv1106g-luckfox-pico-pro-max.dtb \
 	rv1108-elgin-r1.dtb \
 	rv1108-evb.dtb \
 	rv1109-sonoff-ihost.dtb \
diff --git a/arch/arm/boot/dts/rockchip/rv1106g-luckfox-pico-pro-max.dts b/arch/arm/boot/dts/rockchip/rv1106g-luckfox-pico-pro-max.dts
new file mode 100644
index 0000000000000..d65c456133183
--- /dev/null
+++ b/arch/arm/boot/dts/rockchip/rv1106g-luckfox-pico-pro-max.dts
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+* Copyright (c) 2024 Ondrej Jirman <megi@xff.cz>
+*/
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/dts-v1/;
+
+#include "rv1106.dtsi"
+
+/ {
+	model = "Luckfox Pico Pro Max";
+	compatible = "rockchip,rv1106g-luckfox-pico-pro-max", "rockchip,rv1106";
+
+	chosen {
+		stdout-path = "serial2:115200n8";
+	};
+
+	adc-keys {
+		compatible = "adc-keys";
+		io-channels = <&saradc 0>;
+		io-channel-names = "buttons";
+		poll-interval = <100>;
+		keyup-threshold-microvolt = <1800000>;
+
+		recovery-key {
+			label = "recovery";
+			linux,code = <KEY_SETUP>;
+			press-threshold-microvolt = <20000>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		act {
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_INDICATOR;
+			gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "activity";
+		};
+	};
+
+	memory {
+		reg = <0x00000000 0x10000000>;
+		device_type = "memory";
+	};
+
+	vcc_1v8: regulator-vcc-1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_1v8";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	vcc_3v3: regulator-vcc-3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_3v3";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	vcc_5v0_sys: regulator-vcc-5v0-sys {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_5v0_sys";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+
+	vdd_arm: regulator-vdd-arm {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd_arm";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <900000>;
+		regulator-max-microvolt = <900000>;
+	};
+
+	restart-poweroff {
+		compatible = "restart-poweroff";
+	};
+};
+
+&gmac {
+	status = "okay";
+};
+
+//XXX: enable RTC
+&rtc {
+	status = "okay";
+};
+
+&cpu0 {
+	cpu-supply = <&vdd_arm>;
+};
+
+&rng {
+	status = "okay";
+};
+
+&saradc {
+	status = "okay";
+	vref-supply = <&vcc_1v8>;
+};
+
+//XXX: GPIO0 A1 SDMMC_PWREN (active low, default low)
+&sdmmc {
+	max-frequency = <50000000>;
+	no-sdio;
+	no-mmc;
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	disable-wp;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_bus4>;
+	status = "okay";
+};
+
+&sfc {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&fspi_pins &fspi_cs0>;
+
+	flash@0 {
+		compatible = "spi-nand";
+		reg = <0>;
+		spi-max-frequency = <75000000>;
+		spi-rx-bus-width = <4>;
+		spi-tx-bus-width = <1>;
+	};
+};
+
+&tsadc {
+	status = "okay";
+};
+
+&wdt {
+	status = "okay";
+};
+
+&u2phy {
+	status = "okay";
+};
+
+&u2phy_otg {
+	status = "okay";
+};
+
+&uart2 {
+	status = "okay";
+};
+
+&usbdrd {
+	status = "okay";
+};
+
+&usbdrd_dwc3 {
+	extcon = <&u2phy>;
+	status = "okay";
+	dr_mode = "peripheral";
+};
-- 
2.46.0

