imx: add support for i.MX8MQ power domain controller

Add support for the power domain controller that's used on the
i.MX8MQ.  This will be needed to be able to power on the PCIe
controller.  Bindings taken from Linux, driver implementation
taken from the i.MX8 power domain controller and adjusted for
the i.MX8M SoC.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
diff --git a/arch/arm/dts/fsl-imx8mq.dtsi b/arch/arm/dts/fsl-imx8mq.dtsi
index 814a1b7..fbf5009 100644
--- a/arch/arm/dts/fsl-imx8mq.dtsi
+++ b/arch/arm/dts/fsl-imx8mq.dtsi
@@ -19,6 +19,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/pins-imx8mq.h>
+#include <dt-bindings/power/imx8mq-power.h>
 #include <dt-bindings/thermal/thermal.h>
 
 / {
@@ -71,12 +72,6 @@
 		interrupt-parent = <&gic>;
 	};
 
-	power: power-controller {
-		compatible = "fsl,imx8mq-pm-domain";
-		num-domains = <11>;
-		#power-domain-cells = <1>;
-	};
-
 	pwm2: pwm@30670000 {
 		compatible = "fsl,imx8mq-pwm", "fsl,imx27-pwm";
 		reg = <0x0 0x30670000 0x0 0x10000>;
@@ -276,6 +271,37 @@
 		interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
 		#interrupt-cells = <3>;
 		interrupt-parent = <&gic>;
+
+		pgc {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			/*
+			 * As per comment in ATF source code:
+			 *
+			 * PCIE1 and PCIE2 share the
+			 * same reset signal, if we
+			 * power down PCIE2, PCIE1
+			 * will be held in reset too.
+			 *
+			 * So instead of creating two
+			 * separate power domains for
+			 * PCIE1 and PCIE2 we create a
+			 * link between both and use
+			 * it as a shared PCIE power
+			 * domain.
+			 */
+			pgc_pcie: power-domain@1 {
+				#power-domain-cells = <0>;
+				reg = <IMX8M_POWER_DOMAIN_PCIE1>;
+				power-domains = <&pgc_pcie2>;
+			};
+
+			pgc_pcie2: power-domain@a {
+				#power-domain-cells = <0>;
+				reg = <IMX8M_POWER_DOMAIN_PCIE2>;
+			};
+		};
 	};
 
 	usdhc1: usdhc@30b40000 {
diff --git a/arch/arm/include/asm/arch-imx8m/power-domain.h b/arch/arm/include/asm/arch-imx8m/power-domain.h
new file mode 100644
index 0000000..0f94945
--- /dev/null
+++ b/arch/arm/include/asm/arch-imx8m/power-domain.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2017 NXP
+ */
+
+#ifndef _ASM_ARCH_IMX8M_POWER_DOMAIN_H
+#define _ASM_ARCH_IMX8M_POWER_DOMAIN_H
+
+struct imx8m_power_domain_platdata {
+	int resource_id;
+	int has_pd;
+	struct power_domain pd;
+};
+
+#endif