From 0000000000000000000000000000000000000000 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: 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>
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts | 22 +++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts | 23 ++++++++++
 arch/arm64/boot/dts/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 498ae493d176..ff01e2be26e7 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 73275308f484..93dc8512fe45 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 aaa3349ce3d5..9b33186c7e7d 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
@@ -107,6 +107,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;
 
-- 
Armbian

