From 6cdda4153167bbe5ce03a7ccef66cae4b46f8725 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 8 Jul 2020 01:00:48 +0200
Subject: [PATCH 169/463] arm64: dts: sun50i-a64-pinephone: Add modem power
 manager

Pinephone has a EG25-G modem that needs a special powerup/powerdown
sequence. Add a power manager to manage the modem power.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 .../allwinner/sun50i-a64-pinephone-1.0.dts    | 22 ++++++++++++++++++
 .../allwinner/sun50i-a64-pinephone-1.1.dts    | 23 +++++++++++++++++++
 .../allwinner/sun50i-a64-pinephone-1.2.dts    | 23 +++++++++++++++++++
 3 files changed, 68 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
index 498ae493d176d..ff01e2be26e7b 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
@@ -86,6 +86,28 @@ &reg_drivevbus {
 	status = "okay";
 };
 
+&uart3 {
+	modem {
+		compatible = "quectel,eg25";
+		char-device-name = "modem-power";
+
+		power-supply = <&reg_vbat_bb>; /* PL7 */
+
+		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
+		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
+		pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
+
+		sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+		wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */
+
+		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
+		dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */
+		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
+
+		quectel,qdai = "1,1,0,1,0,0,1,1";
+	};
+};
+
 &usbphy {
 	usb-role-switch;
 
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
index 73275308f484f..93dc8512fe458 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
@@ -114,6 +114,29 @@ &sgm3140 {
 	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
 };
 
+&uart3 {
+	modem {
+		compatible = "quectel,eg25";
+		char-device-name = "modem-power";
+
+		power-supply = <&reg_vbat_bb>; /* PL7 */
+
+		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
+		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
+		status-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
+		status-pwrkey-multiplexed; /* status acts as pwrkey */
+
+		sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+		wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */
+
+		dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */
+		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
+		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
+
+		quectel,qdai = "1,1,0,1,0,0,1,1";
+	};
+};
+
 &usbphy {
 	usb-role-switch;
 
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
index 40127186606f2..5e988230e6e4e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
@@ -103,6 +103,29 @@ &sgm3140 {
 	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
 };
 
+&uart3 {
+	modem {
+		compatible = "quectel,eg25";
+		char-device-name = "modem-power";
+
+		power-supply = <&reg_vbat_bb>; /* PL7 */
+
+		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
+		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
+		status-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
+		pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
+
+		host-ready-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+		wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-RI */
+
+		dtr-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-DTR */
+		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
+		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
+
+		quectel,qdai = "1,1,0,1,0,0,1,1";
+	};
+};
+
 &usbphy {
 	usb-role-switch;
 
-- 
2.46.0

