From f316a34415e6b261d0d95678c2021cdd226c8a1c Mon Sep 17 00:00:00 2001
From: "H. Nikolaus Schaller" <hns@goldelico.com>
Date: Wed, 11 Mar 2020 15:50:58 +0100
Subject: [PATCH] ARM: DTS: add Pyra V5.3 (mass production variant)

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 arch/arm/boot/dts/Makefile                    |  1 +
 .../omap5-letux-cortex15-v5.3+pyra-v5.3.dts   | 25 ++++++
 arch/arm/boot/dts/pyra-mainboard-v5.3.dtsi    | 78 +++++++++++++++++++
 3 files changed, 104 insertions(+)
 create mode 100644 arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.3.dts
 create mode 100644 arch/arm/boot/dts/pyra-mainboard-v5.3.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ac88c09d366b..468030fffde6 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -844,6 +844,7 @@ dtb-$(CONFIG_SOC_OMAP5) += \
 	omap5-letux-cortex15-v5.1.dtb omap5-letux-cortex15-v5.1+pyra-v5.1.dtb omap5-letux-cortex15-v5.1+pyra-v5.1.2.dtb omap5-letux-cortex15-v5.1+pyra-v5.2.dtb \
 	omap5-letux-cortex15-v5.2.dtb omap5-letux-cortex15-v5.2+pyra-v5.1.2.dtb omap5-letux-cortex15-v5.2+pyra-v5.2.dtb \
 	omap5-letux-cortex15-v5.3.dtb omap5-letux-cortex15-v5.3+pyra-v5.1.2.dtb omap5-letux-cortex15-v5.3+pyra-v5.2.dtb \
+	omap5-letux-cortex15-v5.3+pyra-v5.3.dtb \
 	omap5-uevm.dtb
 dtb-$(CONFIG_SOC_DRA7XX) += \
 	am57xx-beagle-x15.dtb \
diff --git a/arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.3.dts b/arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.3.dts
new file mode 100644
index 000000000000..f94d78cc90fc
--- /dev/null
+++ b/arch/arm/boot/dts/omap5-letux-cortex15-v5.3+pyra-v5.3.dts
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2020 OpenPandora - http://www.pyra-handheld.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/* this version is for Pyra V5.3 with Letux Cortex 15 CPU board V5.3 */
+
+#include "omap5-letux-cortex15-v5.3.dts"
+#include "pyra-mainboard-v5.3.dtsi"
+#include "pyra-display.dtsi"
+
+/*
+ * display board shipped with V3 main boards
+ * has a different backlight converter TPS6116x
+ * therefore we need a different PWM frequency
+ * of 8300 Hz
+ */
+
+&backlight {
+	pwms = <&pwm9 0 (1000000000 / 8300) 0>;
+};
+
diff --git a/arch/arm/boot/dts/pyra-mainboard-v5.3.dtsi b/arch/arm/boot/dts/pyra-mainboard-v5.3.dtsi
new file mode 100644
index 000000000000..ac0f9510aca5
--- /dev/null
+++ b/arch/arm/boot/dts/pyra-mainboard-v5.3.dtsi
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2017 OpenPandora - http://www.pyra-handheld.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "pyra-mainboard-common.dtsi"
+
+/ {
+	model = "Pyra-Handheld-V5.3";
+
+	pyra_leds { /* alternate LED driver (parallel to is31fl31) */
+		compatible = "gpio-leds";
+		led@1 {
+			label = "pyra-old:red:left";
+			gpios = <&gpio99 5 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+			linux,default-trigger = "none";
+			default-state = "off";
+		};
+
+		led@4 {
+			label = "pyra-old:red:mid";
+			gpios = <&gpio99 (1+16) (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+			linux,default-trigger = "none";
+			default-state = "off";
+		};
+
+		led@7 {
+			label = "pyra-old:red:right";
+			gpios = <&gpio99 (5+16) (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
+			linux,default-trigger = "none";
+			default-state = "off";
+		};
+	};
+
+	/* this is a power switch that connects otg power from bq2429x to the usb socket */
+	otg_path: otg_path {
+		compatible = "regulator-fixed";
+		regulator-name = "otg_path";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		/* does not handle "gpios" property! */
+		gpio = <&gpio99 (3+2*8) (GPIO_ACTIVE_HIGH)>;	/* P23 of pcal6524 */
+		enable-active-high;
+		vin-supply = <&otg_reg>;	/* request otg booster of bq24297 */
+	};
+};
+
+&gpio99 {
+	/* replace ti,tca6424 in older revisions */
+	compatible = "nxp,pcal6524";
+	interrupt-parent = <&gpio6>;
+	interrupts = <1 IRQ_TYPE_EDGE_FALLING>;	/* gpio6_161 */
+};
+
+&i2c2 {
+	bq24297@6b {
+		/* interrupts now working with pcal6524 */
+		interrupt-parent = <&gpio99>;
+		interrupts = <(1*8+3) IRQ_TYPE_EDGE_FALLING>;	/* P13 */
+	};
+};
+
+&i2c5 {
+	ts3a227@3b {
+		/* interrupts now working with pcal6524 */
+                interrupt-parent = <&gpio99>;
+		interrupts = <14 IRQ_TYPE_EDGE_RISING>;
+	};
+};
+
+&usb3 {
+	/* use otg_path regulator */
+	vbus-supply = <&otg_path>;
+};
-- 
2.23.0

