diff mbox

[4/4] arm: exynos4: add device tree support for external wakeup interrupt controller

Message ID 1323266392-28330-5-git-send-email-thomas.abraham@linaro.org
State Superseded
Headers show

Commit Message

thomas.abraham@linaro.org Dec. 7, 2011, 1:59 p.m. UTC
Add device tree support for external wakeup source interrupt controller
on Exynos4.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 .../bindings/arm/samsung/wakeup-eint.txt           |   14 ++++++++++++++
 arch/arm/mach-exynos/cpu.c                         |    5 ++++-
 arch/arm/mach-exynos/irq-eint.c                    |    9 +++++++++
 3 files changed, 27 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt

Comments

Rob Herring Dec. 7, 2011, 4:16 p.m. UTC | #1
On 12/07/2011 07:59 AM, Thomas Abraham wrote:
> Add device tree support for external wakeup source interrupt controller
> on Exynos4.
> 
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  .../bindings/arm/samsung/wakeup-eint.txt           |   14 ++++++++++++++
>  arch/arm/mach-exynos/cpu.c                         |    5 ++++-
>  arch/arm/mach-exynos/irq-eint.c                    |    9 +++++++++
>  3 files changed, 27 insertions(+), 1 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
> 
> diff --git a/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
> new file mode 100644
> index 0000000..0ca5782
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
> @@ -0,0 +1,14 @@
> +* Samsung Exynos4 External Wakeup Interrupt Source Controller
> +
> +Samsung Exynos4 processor supports 32 external wakeup interrupt sources. First
> +16 of these interrupts are directly connected to GIC and the rest 16 of the
> +interrupts are grouped together to deliver a single interrupt to GIC.
> +
> +Required properties:
> +
> +- compatible: should be "samsung,exynos4210-wakeup-eint".
> +- interrupt-controller: Identifies the node as an interrupt controller.
> +- interrupt-cells: Specifies the number of cells required to specify the
> +    interrupt source number. The value of should be <2>. The first cell
> +    represents the wakeup interrupt source number and the second cell
> +    should be zero (currently unused).

interrupt-parent needs to be set to the gic?

> diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c
> index 6d27c36..306c13c 100644
> --- a/arch/arm/mach-exynos/cpu.c
> +++ b/arch/arm/mach-exynos/cpu.c
> @@ -245,6 +245,8 @@ static void exynos4_gic_irq_fix_base(struct irq_data *d)
>  #ifdef CONFIG_OF
>  static const struct of_device_id exynos4_dt_irq_match[] = {
>  	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
> +	{ .compatible = "samsung,exynos4210-wakeup-eint",
> +		.data = exynos4_init_irq_eint, },
>  	{},
>  };
>  #endif
> @@ -278,7 +280,8 @@ void __init exynos4_init_irq(void)
>  	 * uses GIC instead of VIC.
>  	 */
>  	s5p_init_irq(NULL, 0);
> -	exynos4_init_irq_eint();
> +	if (!of_have_populated_dt())
> +		exynos4_init_irq_eint();
>  }
>  
>  struct sysdev_class exynos4_sysclass = {
> diff --git a/arch/arm/mach-exynos/irq-eint.c b/arch/arm/mach-exynos/irq-eint.c
> index 771b156..e78fdfa 100644
> --- a/arch/arm/mach-exynos/irq-eint.c
> +++ b/arch/arm/mach-exynos/irq-eint.c
> @@ -18,6 +18,7 @@
>  #include <linux/gpio.h>
>  #include <linux/irqdomain.h>
>  #include <linux/export.h>
> +#include <linux/of.h>
>  
>  #include <plat/pm.h>
>  #include <plat/cpu.h>
> @@ -210,6 +211,14 @@ int __init exynos4_init_irq_eint(void)
>  	}
>  	domain->nr_irq = EXYNOS4_EINT_NR;
>  	domain->ops = &irq_domain_simple_ops;
> +#ifdef CONFIG_OF
> +	if (of_have_populated_dt()) {
> +		domain->of_node = of_find_compatible_node(NULL, NULL,
> +					"samsung,exynos4210-wakeup-eint");
> +		if (!domain->of_node)
> +			pr_info("exynos4_init_irq_eint: of_node not found\n");
> +	}
> +#endif

Your function prototype is wrong for of_irq_init as it provides you the
node ptr.

Otherwise, the series looks pretty good.

Rob
thomas.abraham@linaro.org Dec. 7, 2011, 4:49 p.m. UTC | #2
Hi Rob,

On 7 December 2011 21:46, Rob Herring <robherring2@gmail.com> wrote:
> On 12/07/2011 07:59 AM, Thomas Abraham wrote:
>> Add device tree support for external wakeup source interrupt controller
>> on Exynos4.
>>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: Grant Likely <grant.likely@secretlab.ca>
>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>> ---

[...]

>> diff --git a/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
>> new file mode 100644
>> index 0000000..0ca5782
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
>> @@ -0,0 +1,14 @@
>> +* Samsung Exynos4 External Wakeup Interrupt Source Controller
>> +
>> +Samsung Exynos4 processor supports 32 external wakeup interrupt sources. First
>> +16 of these interrupts are directly connected to GIC and the rest 16 of the
>> +interrupts are grouped together to deliver a single interrupt to GIC.
>> +
>> +Required properties:
>> +
>> +- compatible: should be "samsung,exynos4210-wakeup-eint".
>> +- interrupt-controller: Identifies the node as an interrupt controller.
>> +- interrupt-cells: Specifies the number of cells required to specify the
>> +    interrupt source number. The value of should be <2>. The first cell
>> +    represents the wakeup interrupt source number and the second cell
>> +    should be zero (currently unused).
>
> interrupt-parent needs to be set to the gic?

Yes, I missed that. gic is set as the interrupt parent in the root
node and all child nodes inherit it. I will add interrupt-parent as
the required property as list gic as the parent.

>
>> diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c

[...]

>> +#ifdef CONFIG_OF
>> +     if (of_have_populated_dt()) {
>> +             domain->of_node = of_find_compatible_node(NULL, NULL,
>> +                                     "samsung,exynos4210-wakeup-eint");
>> +             if (!domain->of_node)
>> +                     pr_info("exynos4_init_irq_eint: of_node not found\n");
>> +     }
>> +#endif
>
> Your function prototype is wrong for of_irq_init as it provides you the
> node ptr.

Thanks. I got this wrong. That would make the code above much simpler.
I will fix this.

>
> Otherwise, the series looks pretty good.
>
> Rob

Thanks for your review and comments.

Regards,
Thomas.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
new file mode 100644
index 0000000..0ca5782
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt
@@ -0,0 +1,14 @@ 
+* Samsung Exynos4 External Wakeup Interrupt Source Controller
+
+Samsung Exynos4 processor supports 32 external wakeup interrupt sources. First
+16 of these interrupts are directly connected to GIC and the rest 16 of the
+interrupts are grouped together to deliver a single interrupt to GIC.
+
+Required properties:
+
+- compatible: should be "samsung,exynos4210-wakeup-eint".
+- interrupt-controller: Identifies the node as an interrupt controller.
+- interrupt-cells: Specifies the number of cells required to specify the
+    interrupt source number. The value of should be <2>. The first cell
+    represents the wakeup interrupt source number and the second cell
+    should be zero (currently unused).
diff --git a/arch/arm/mach-exynos/cpu.c b/arch/arm/mach-exynos/cpu.c
index 6d27c36..306c13c 100644
--- a/arch/arm/mach-exynos/cpu.c
+++ b/arch/arm/mach-exynos/cpu.c
@@ -245,6 +245,8 @@  static void exynos4_gic_irq_fix_base(struct irq_data *d)
 #ifdef CONFIG_OF
 static const struct of_device_id exynos4_dt_irq_match[] = {
 	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+	{ .compatible = "samsung,exynos4210-wakeup-eint",
+		.data = exynos4_init_irq_eint, },
 	{},
 };
 #endif
@@ -278,7 +280,8 @@  void __init exynos4_init_irq(void)
 	 * uses GIC instead of VIC.
 	 */
 	s5p_init_irq(NULL, 0);
-	exynos4_init_irq_eint();
+	if (!of_have_populated_dt())
+		exynos4_init_irq_eint();
 }
 
 struct sysdev_class exynos4_sysclass = {
diff --git a/arch/arm/mach-exynos/irq-eint.c b/arch/arm/mach-exynos/irq-eint.c
index 771b156..e78fdfa 100644
--- a/arch/arm/mach-exynos/irq-eint.c
+++ b/arch/arm/mach-exynos/irq-eint.c
@@ -18,6 +18,7 @@ 
 #include <linux/gpio.h>
 #include <linux/irqdomain.h>
 #include <linux/export.h>
+#include <linux/of.h>
 
 #include <plat/pm.h>
 #include <plat/cpu.h>
@@ -210,6 +211,14 @@  int __init exynos4_init_irq_eint(void)
 	}
 	domain->nr_irq = EXYNOS4_EINT_NR;
 	domain->ops = &irq_domain_simple_ops;
+#ifdef CONFIG_OF
+	if (of_have_populated_dt()) {
+		domain->of_node = of_find_compatible_node(NULL, NULL,
+					"samsung,exynos4210-wakeup-eint");
+		if (!domain->of_node)
+			pr_info("exynos4_init_irq_eint: of_node not found\n");
+	}
+#endif
 	irq_domain_add(domain);
 
 	irq_domain_for_each_irq(domain, hwirq, irq) {