Skip to contentSkip to conversation

drivers/irqchip: Enable IMX_GPCV2 on i.MX7 by default

PATCH In review Andrey Smirnov 3 participants 7 messages Jan 26, 2017 – Feb 1, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drivers/irqchip: Enable IMX_GPCV2 on i.MX7 by default

Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Shawn Guo <[email protected]>
---
 drivers/irqchip/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/Kconfig +1 -1
index ae96731..d271cc3 100644
@@ -250,7 +250,7 @@ config RENESAS_H8S_INTC
 	select IRQ_DOMAIN
 
 config IMX_GPCV2
-	bool
+	def_bool y if SOC_IMX7D
 	select IRQ_DOMAIN
 	help
 	  Enables the wakeup IRQs for IMX platforms with GPCv2 block
Signature · 1 line
2.9.3
#1 lore raw

PATCH 2/4 irqchip: Add IRQCHIP_DECLARE_DRIVER macro

Add IRQCHIP_DECLARE_DRIVER macro to allow having driver code that both registers irqchip and a platform driver. Based on analogous code of CLK_OF_DECLARE_DRIVER.

Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
---
 include/linux/irqchip.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
include/linux/irqchip.h +16 -0
index 89c34b2..611e8cc 100644
@@ -27,6 +27,22 @@
 #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
 
 /*
+ * Use this macro when you have a driver that requires two
+ * initialization routines, one at IRQCHIP_DECLARE, and one at
+ * platform device probe
+ */
+#define IRQCHIP_DECLARE_DRIVER(name, compat, fn)			\
+	static int __init						\
+	name##_of_irqchip_init_driver(struct device_node *np,		\
+				      struct device_node *parent)	\
+	{								\
+		of_node_clear_flag(np, OF_POPULATED);			\
+		return fn(np, parent);					\
+	}								\
+	OF_DECLARE_2(irqchip, name, compat, name##_of_irqchip_init_driver)
+
+
+/*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their version and their initialization function.
  *
Signature · 1 line
2.9.3
#2 lore raw

PATCH 3/4 i.MX: GPC: Use IRQCHIP_DECLARE_DRIVER

In reply to Andrey Smirnov

Use IRQCHIP_DECLARE_DRIVER instead of Use IRQCHIP_DECLARE to allow 'imx_gpc_driver' to be probed in addition to irqchip initialized by imx_gpc_init().

Cc yurovsky at gmail.com
Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-imx/gpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +1 -1
index 1dc2a34..8f0d19b 100644
@@ -279,7 +279,7 @@ static int __init imx_gpc_init(struct device_node *node,
 
 	return 0;
 }
-IRQCHIP_DECLARE(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
+IRQCHIP_DECLARE_DRIVER(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
 
 void __init imx_gpc_check_dt(void)
 {
Signature · 1 line
2.9.3
#3 lore raw

Re: [PATCH 3/4] i.MX: GPC: Use IRQCHIP_DECLARE_DRIVER

Hi Andrey,

Am Donnerstag, den 26.01.2017, 14:05 -0800 schrieb Andrey Smirnov:

Quoted 20 lines

Use IRQCHIP_DECLARE_DRIVER instead of Use IRQCHIP_DECLARE to allow 'imx_gpc_driver' to be probed in addition to irqchip initialized by imx_gpc_init().

Cc yurovsky at gmail.com
Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-imx/gpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +0 -0
index 1dc2a34..8f0d19b 100644

arch/arm/mach-imx/gpc.c static int __init imx_gpc_init(struct device_node *node, · line 285

Quoted 8 lines
arch/arm/mach-imx/gpc.c +1 -1
@@ -279,7 +279,7 @@ static int __init imx_gpc_init(struct device_node *node,
 
 	return 0;
 }
-IRQCHIP_DECLARE(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
+IRQCHIP_DECLARE_DRIVER(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
 
 void __init imx_gpc_check_dt(void)
 {

I don't see the other patches from the series on the list, so commenting
here: You might want to take a look at my GPC rework series, it has a much nicer binding for the power domains, that you might want to use for the GPCv2 also.

Additionally I think the power domain stuff doesn't belong into the irqchip driver, but rather in a separate driver in drivers/soc like it is done in my series.

I'll send out an updated version of this series today and you might consider basing your GPCv2 on top of that.

Regards,
Lucas

#4 lore raw

Re: [PATCH 3/4] i.MX: GPC: Use IRQCHIP_DECLARE_DRIVER

Quoted 29 lines · Lucas Stach

Hi Andrey,

Am Donnerstag, den 26.01.2017, 14:05 -0800 schrieb Andrey Smirnov:

Quoted 26 lines

Use IRQCHIP_DECLARE_DRIVER instead of Use IRQCHIP_DECLARE to allow 'imx_gpc_driver' to be probed in addition to irqchip initialized by imx_gpc_init().

Cc yurovsky at gmail.com
Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-imx/gpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/gpc.c +1 -1
index 1dc2a34..8f0d19b 100644
@@ -279,7 +279,7 @@ static int __init imx_gpc_init(struct device_node *node,
 
      return 0;
 }
-IRQCHIP_DECLARE(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
+IRQCHIP_DECLARE_DRIVER(imx_gpc, "fsl,imx6q-gpc", imx_gpc_init);
 
Quoted 7 lines

arch/arm/mach-imx/gpc.c static int __init imx_gpc_init(struct device_node *node, · line 285

Quoted 2 lines
arch/arm/mach-imx/gpc.c +0 -0
 void __init imx_gpc_check_dt(void)
 {

I don't see the other patches from the series on the list, so commenting
here: You might want to take a look at my GPC rework series, it has a much nicer binding for the power domains, that you might want to use for the GPCv2 also.

I messed up distribution list of my original patches, sorry. OK, I'll take a look.

Quoted 7 lines

Additionally I think the power domain stuff doesn't belong into the irqchip driver, but rather in a separate driver in drivers/soc like it is done in my series.

I'll send out an updated version of this series today and you might consider basing your GPCv2 on top of that.

Please CC me on it if you haven't sent the patches already.

Thanks,
Andrey Smirnov

#5 lore raw

PATCH 4/4 irqchip/imx-gpcv2: Add power domain support

In reply to Andrey Smirnov

Add code allowing for control of various power domains managed by GPCv2 IP block found in i.MX7 series of SoCs. Power domains covered by this patch are:

- PCIE PHY
- MIPI PHY
- USB HSIC PHY
- USB OTG1/2 PHY

Support for any other power domain controlled by GPC is not present, and can be added at some later point.

Testing of this code was done against a PCIe driver.

Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
---
 .../devicetree/bindings/power/fsl,imx-gpcv2.txt    |  63 +++++
 drivers/irqchip/irq-imx-gpcv2.c                    | 263 ++++++++++++++++++++-
 include/dt-bindings/power/imx7-power.h             |  18 ++
 3 files changed, 343 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/power/fsl,imx-gpcv2.txt
 create mode 100644 include/dt-bindings/power/imx7-power.h
Documentation/devicetree/bindings/power/fsl,imx-gpcv2.txt new file +63 -0
new file mode 100644
index 0000000..d971006
@@ -0,0 +1,63 @@
+Freescale i.MX General Power Controller v2
+==========================================
+
+The i.MX7S/D General Power Control (GPC) block contains Power Gating
+Control (PGC) for various power domains.
+
+Required properties:
+
+- compatible: Should be "fsl,imx7d-gpc"
+
+- reg: should be register base and length as documented in the
+  datasheet
+
+- interrupts: Should contain GPC interrupt request 1
+
+- pcie-phy-supply: Link to the LDO regulator powering the PCIE PHY
+  power domain (connected to PCIE_VP/VP_TX/VP_RX pads)
+
+- mipi-phy-supply: Link to the LDO regulator powering the MIPI PHY
+  power domain (connected to VDD_MIPI_1P0 pad)
+
+- usb-hsic-phy-supply: Link to the LDO regulator powering the USB HSIC
+  PHY power domain (connected to VDD_USB_H_1P2 pad)
+
+- #power-domain-cells: Should be 1, see below:
+
+The gpc node is a power-controller as documented by the generic power
+domain bindings in
+Documentation/devicetree/bindings/power/power_domain.txt.
+
+Example:
+
+	gpc: gpc@303a0000 {
+		compatible = "fsl,imx7d-gpc";
+		reg = <0x303a0000 0x10000>;
+		interrupt-controller;
+		interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&intc>;
+		#power-domain-cells = <1>;
+		pcie-phy-supply = <&reg_1p0d>;
+	};
+
+
+Specifying power domain for IP modules
+======================================
+
+IP cores belonging to a power domain should contain a 'power-domains'
+property that is a phandle pointing to the gpc device node and a
+DOMAIN_INDEX specifying the power domain the device belongs to.
+
+Example of a device that is part of the PU power domain:
+
+	pcie: pcie@0x33800000 {
+	      reg = <0x33800000 0x4000>,
+	            <0x4ff00000 0x80000>;
+		/* ... */
+		power-domains = <&gpc IMX7_POWER_DOMAIN_PCIE_PHY>;
+		/* ... */
+	};
+
+All valid DOMAIN_INDEX values are defined and can be found in
+include/dt-bindings/power/imx7-power.h
drivers/irqchip/irq-imx-gpcv2.c +262 -1

285 lines not on this page · raw message

include/dt-bindings/power/imx7-power.h new file +18 -0
new file mode 100644
index 0000000..24dde62
@@ -0,0 +1,18 @@
+/*
+ *  Copyright © 2017 Impinj
+ *
+ * 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.
+ */
+
+#ifndef __DT_BINDINGS_ARM_IMX7_POWER_H__
+#define __DT_BINDINGS_ARM_IMX7_POWER_H__
+
+#define IMX7_POWER_DOMAIN_USB_HSIC_PHY	0
+#define IMX7_POWER_DOMAIN_USB_OTG2_PHY	1
+#define IMX7_POWER_DOMAIN_USB_OTG1_PHY	2
+#define IMX7_POWER_DOMAIN_PCIE_PHY	3
+#define IMX7_POWER_DOMAIN_MIPI_PHY	4
+
+#endif
Signature · 1 line
2.9.3
maintainer Acked-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] irqchip/imx-gpcv2: Add power domain support

Quoted 23 lines · Andrey Smirnov

Add code allowing for control of various power domains managed by GPCv2 IP block found in i.MX7 series of SoCs. Power domains covered by this patch are:

- PCIE PHY
- MIPI PHY
- USB HSIC PHY
- USB OTG1/2 PHY

Support for any other power domain controlled by GPC is not present, and can be added at some later point.

Testing of this code was done against a PCIe driver.

Cc Shawn Guo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Quoted 2 lines
---
 .../devicetree/bindings/power/fsl,imx-gpcv2.txt    |  63 +++++
Quoted 5 lines
 drivers/irqchip/irq-imx-gpcv2.c                    | 263 ++++++++++++++++++++-
 include/dt-bindings/power/imx7-power.h             |  18 ++
 3 files changed, 343 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/power/fsl,imx-gpcv2.txt
 create mode 100644 include/dt-bindings/power/imx7-power.h

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html