From e4b7f55f57e5c895fe5dea8d5712affe95fc5f9f Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Tue, 25 Jan 2022 18:41:47 +0300
Subject: arm64:dts: sun50i-h6-pine-h64 add wifi rtl8723cs

Author: unknown author
---
 .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
index 95aea02bce40..8d5a651f24c0 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
@@ -41,6 +41,14 @@ hdmi_con_in: endpoint {
 		};
 	};
 
+	wifi_pwrseq: pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		clocks = <&rtc 1>;
+		clock-names = "ext_clock";
+		reset-gpios = <&r_pio 1 3 GPIO_ACTIVE_LOW>; /* PM3 */
+		post-power-on-delay-ms = <200>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -142,6 +150,24 @@ &mmc0 {
 	status = "okay";
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins>;
+	vmmc-supply = <&reg_cldo2>;
+	vqmmc-supply = <&reg_bldo2>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+
+	rtl8723cs: sdio_wifi@1 {
+		reg = <1>;
+		interrupt-parent = <&r_pio>;
+		interrupts = <1 0 IRQ_TYPE_LEVEL_LOW>; /* PM0 */
+		interrupt-names = "host-wake";
+	};
+};
+
 &mmc2 {
 	vmmc-supply = <&reg_cldo1>;
 	vqmmc-supply = <&reg_bldo2>;
@@ -235,12 +261,24 @@ reg_cldo1: cldo1 {
 			};
 
 			reg_cldo2: cldo2 {
+				/*
+				 * This regulator is connected with CLDO3.
+				 * Before the kernel can support synchronized
+				 * enable of coupled regulators, keep them
+				 * both always on as a ugly hack.
+				 */
+				regulator-always-on;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-name = "vcc-wifi-1";
 			};
 
 			reg_cldo3: cldo3 {
+				/*
+				 * This regulator is connected with CLDO2.
+				 * See the comments for CLDO2.
+				 */
+				regulator-always-on;
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-name = "vcc-wifi-2";
-- 
2.35.3

