From caafc6c497db9fba3007c537e92cf3b184f8c1e3 Mon Sep 17 00:00:00 2001
From: Max Krummenacher <max.krummenacher@toradex.com>
Date: Wed, 28 Oct 2020 11:58:11 +0200
Subject: [PATCH] ARM: dts: imx8mm-verdin: follow changed pmic

The used PMIC has been changed from RHOM BD71837 to NXP PCA9450A.
Adjust the device tree accordingly.
Remove the old ADC node as the ADC has been changed and has no longer
a separate power rail.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
---
 arch/arm/dts/imx8mm-verdin-u-boot.dtsi |   5 +-
 arch/arm/dts/imx8mm-verdin.dts         | 154 +++++++++++++------------
 2 files changed, 80 insertions(+), 79 deletions(-)

diff --git a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
index fe6bb9bf03..249b0f8f66 100644
--- a/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-verdin-u-boot.dtsi
@@ -2,7 +2,6 @@
 /*
  * Copyright 2020 Toradex
  */
-
 / {
 	wdt-reboot {
 		compatible = "wdt-reboot";
@@ -90,11 +89,11 @@
 	u-boot,dm-spl;
 };
 
-&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} {
+&{/soc@0/bus@30800000/i2c@30a20000/pmic} {
 	u-boot,dm-spl;
 };
 
-&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b/regulators} {
+&{/soc@0/bus@30800000/i2c@30a20000/pmic/regulators} {
 	u-boot,dm-spl;
 };
 
diff --git a/arch/arm/dts/imx8mm-verdin.dts b/arch/arm/dts/imx8mm-verdin.dts
index 1c67c08c88..fb0756d6e1 100644
--- a/arch/arm/dts/imx8mm-verdin.dts
+++ b/arch/arm/dts/imx8mm-verdin.dts
@@ -203,115 +203,123 @@
 	pinctrl-0 = <&pinctrl_i2c1>;
 	status = "okay";
 
-	pmic@4b {
-		compatible = "rohm,bd71840", "rohm,bd71837";
-		bd71837,pmic-buck2-uses-i2c-dvs;
-		bd71837,pmic-buck2-dvs-voltage = <1000000>, <900000>, <0>; /* VDD_ARM: Run-Idle */
-		gpio_intr = <&gpio1 3 GPIO_ACTIVE_LOW>;
-		/* PMIC BD71837 PMIC_nINT GPIO1_IO3 */
+	/* Assembled on V1.1 HW and later */
+	pmic {
+		reg = <0x25>;
+		u-boot,dm-spl;
+		compatible = "nxp,pca9450a";
+		/* PMIC PCA9450 PMIC_nINT GPIO1_IO3 */
 		pinctrl-0 = <&pinctrl_pmic>;
-		reg = <0x4b>;
-
-		gpo {
-			rohm,drv = <0x0C>;	/* 0b0000_1100 all gpos with cmos output mode */
-		};
+		gpio_intr = <&gpio1 3 GPIO_ACTIVE_LOW>;
 
 		regulators {
-			buck1_reg: BUCK1 {
-				regulator-always-on;
-				regulator-boot-on;
+			u-boot,dm-spl;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			pca9450,pmic-buck2-uses-i2c-dvs;
+			/* Run/Standby voltage */
+			pca9450,pmic-buck2-dvs-voltage = <950000>, <850000>;
+
+			buck1_reg: regulator@0 {
+				reg = <0>;
 				regulator-compatible = "buck1";
-				regulator-max-microvolt = <1300000>;
-				regulator-min-microvolt = <700000>;
-				regulator-ramp-delay = <1250>;
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <3125>;
 			};
 
-			buck2_reg: BUCK2 {
-				regulator-always-on;
-				regulator-boot-on;
+			buck2_reg: regulator@1 {
+				reg = <1>;
 				regulator-compatible = "buck2";
-				regulator-max-microvolt = <1300000>;
-				regulator-min-microvolt = <700000>;
-				regulator-ramp-delay = <1250>;
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
+				regulator-boot-on;
+				regulator-always-on;
+				regulator-ramp-delay = <3125>;
 			};
 
-			buck5_reg: BUCK5 {
-				regulator-always-on;
+			buck3_reg: regulator@2 {
+				reg = <2>;
+				regulator-compatible = "buck3";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <2187500>;
 				regulator-boot-on;
-				regulator-compatible = "buck5";
-				regulator-max-microvolt = <1350000>;
-				regulator-min-microvolt = <700000>;
+				regulator-always-on;
 			};
 
-			buck6_reg: BUCK6 {
-				regulator-always-on;
+			buck4_reg: regulator@3 {
+				reg = <3>;
+				regulator-compatible = "buck4";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
 				regulator-boot-on;
-				regulator-compatible = "buck6";
-				regulator-max-microvolt = <3300000>;
-				regulator-min-microvolt = <3000000>;
+				regulator-always-on;
 			};
 
-			buck7_reg: BUCK7 {
-				regulator-always-on;
+			buck5_reg: regulator@4 {
+				reg = <4>;
+				regulator-compatible = "buck5";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
 				regulator-boot-on;
-				regulator-compatible = "buck7";
-				regulator-max-microvolt = <1995000>;
-				regulator-min-microvolt = <1605000>;
+				regulator-always-on;
 			};
 
-			buck8_reg: BUCK8 {
-				regulator-always-on;
+			buck6_reg: regulator@5 {
+				reg = <5>;
+				regulator-compatible = "buck6";
+				regulator-min-microvolt = <600000>;
+				regulator-max-microvolt = <3400000>;
 				regulator-boot-on;
-				regulator-compatible = "buck8";
-				regulator-max-microvolt = <1400000>;
-				regulator-min-microvolt = <800000>;
+				regulator-always-on;
 			};
 
-			ldo1_reg: LDO1 {
-				regulator-always-on;
-				regulator-boot-on;
+			ldo1_reg: regulator@6 {
+				reg = <6>;
 				regulator-compatible = "ldo1";
+				regulator-min-microvolt = <1600000>;
 				regulator-max-microvolt = <3300000>;
-				regulator-min-microvolt = <3000000>;
+				regulator-boot-on;
+				regulator-always-on;
 			};
 
-			ldo2_reg: LDO2 {
-				regulator-always-on;
-				regulator-boot-on;
+			ldo2_reg: regulator@7 {
+				reg = <7>;
 				regulator-compatible = "ldo2";
-				regulator-max-microvolt = <900000>;
-				regulator-min-microvolt = <900000>;
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1150000>;
+				regulator-boot-on;
+				regulator-always-on;
 			};
 
-			ldo3_reg: LDO3 {
-				regulator-always-on;
-				regulator-boot-on;
+			ldo3_reg: regulator@8 {
+				reg = <8>;
 				regulator-compatible = "ldo3";
+				regulator-min-microvolt = <800000>;
 				regulator-max-microvolt = <3300000>;
-				regulator-min-microvolt = <1800000>;
+				regulator-boot-on;
+				regulator-always-on;
 			};
 
-			ldo4_reg: LDO4 {
-				regulator-always-on;
-				regulator-boot-on;
+			ldo4_reg: regulator@9 {
+				reg = <9>;
 				regulator-compatible = "ldo4";
-				regulator-max-microvolt = <1800000>;
-				regulator-min-microvolt = <900000>;
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
 			};
 
-			ldo5_reg: LDO5 {
+			ldo5_reg: regulator@10 {
+				reg = <10>;
 				regulator-compatible = "ldo5";
+				regulator-min-microvolt = <800000>;
 				regulator-max-microvolt = <3300000>;
-				regulator-min-microvolt = <3300000>;
 			};
 
-			ldo6_reg: LDO6 {
-				regulator-always-on;
-				regulator-boot-on;
-				regulator-compatible = "ldo6";
-				regulator-max-microvolt = <1800000>;
-				regulator-min-microvolt = <900000>;
-			};
 		};
 	};
 
@@ -321,12 +329,6 @@
 		reg = <0x32>;
 	};
 
-	adc@34 {
-		compatible = "maxim,max11607";
-		reg = <0x34>;
-		vcc-supply = <&ldo5_reg>;
-	};
-
 	eeprom_module: eeprom@50 {
 		compatible = "st,24c02", "atmel,24c02", "i2c-eeprom";
 		pagesize = <16>;
-- 
2.39.5