All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>
To: "Benoît Cousson"
	<bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	"Tony Lindgren" <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	"Rajendra Nayak" <rnayak-l0cyMroinI0@public.gmane.org>,
	"Paul Walmsley" <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>
Subject: [RFC PATCH 4/7] ARM: OMAP4+: PRM: register interrupt information from DT
Date: Thu, 5 Jun 2014 22:35:58 -0500	[thread overview]
Message-ID: <1402025761-16831-5-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1402025761-16831-1-git-send-email-nm-l0cyMroinI0@public.gmane.org>

Allow the PRM interrupt information to be picked up from device tree.
the only exception is for OMAP4 which uses values pre-populated and allows
compatibility with older dtb.

Signed-off-by: Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>
---
 arch/arm/mach-omap2/prm44xx.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 1ecf244..784b3e1 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/of_irq.h>
 
 
 #include "soc.h"
@@ -698,11 +699,51 @@ int __init omap44xx_prm_init(void)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
+static struct of_device_id omap_prm_dt_match_table[] = {
+	{ .compatible = "ti,omap4-prm" },
+	{ .compatible = "ti,omap5-prm" },
+	{ .compatible = "ti,dra7-prm" },
+	{ }
+};
+
 static int omap44xx_prm_late_init(void)
 {
+	struct device_node *np;
+	int irq_num;
+
+	/* OMAP4+ is DT only now */
+	if (!of_have_populated_dt())
+		return 0;
+
 	if (!(prm_features & PRM_HAS_IO_WAKEUP))
 		return 0;
 
+	np = of_find_matching_node(NULL, omap_prm_dt_match_table);
+
+	if (!np) {
+		/* Default loaded up with OMAP4 values - older dtb compatible? */
+		if (!cpu_is_omap44xx())
+			return 0;
+	} else {
+		irq_num = of_irq_get(np, 0);
+		/*
+		 * Already have OMAP4 IRQ num. For all other platforms, we need
+		 * IRQ numbers from DT - old dtb compatible?
+		 */
+		if (irq_num < 0 && !cpu_is_omap44xx()) {
+
+			if (irq_num == -EPROBE_DEFER)
+				return irq_num;
+
+			/* Have nothing to do */
+			return 0;
+		}
+
+		/* Once OMAP4 DT is filled as well */
+		if (irq_num >= 0)
+			omap4_prcm_irq_setup.irq = irq_num;
+	}
+
 	omap44xx_prm_enable_io_wakeup();
 
 	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: nm@ti.com (Nishanth Menon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 4/7] ARM: OMAP4+: PRM: register interrupt information from DT
Date: Thu, 5 Jun 2014 22:35:58 -0500	[thread overview]
Message-ID: <1402025761-16831-5-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1402025761-16831-1-git-send-email-nm@ti.com>

Allow the PRM interrupt information to be picked up from device tree.
the only exception is for OMAP4 which uses values pre-populated and allows
compatibility with older dtb.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/prm44xx.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 1ecf244..784b3e1 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/of_irq.h>
 
 
 #include "soc.h"
@@ -698,11 +699,51 @@ int __init omap44xx_prm_init(void)
 	return prm_register(&omap44xx_prm_ll_data);
 }
 
+static struct of_device_id omap_prm_dt_match_table[] = {
+	{ .compatible = "ti,omap4-prm" },
+	{ .compatible = "ti,omap5-prm" },
+	{ .compatible = "ti,dra7-prm" },
+	{ }
+};
+
 static int omap44xx_prm_late_init(void)
 {
+	struct device_node *np;
+	int irq_num;
+
+	/* OMAP4+ is DT only now */
+	if (!of_have_populated_dt())
+		return 0;
+
 	if (!(prm_features & PRM_HAS_IO_WAKEUP))
 		return 0;
 
+	np = of_find_matching_node(NULL, omap_prm_dt_match_table);
+
+	if (!np) {
+		/* Default loaded up with OMAP4 values - older dtb compatible? */
+		if (!cpu_is_omap44xx())
+			return 0;
+	} else {
+		irq_num = of_irq_get(np, 0);
+		/*
+		 * Already have OMAP4 IRQ num. For all other platforms, we need
+		 * IRQ numbers from DT - old dtb compatible?
+		 */
+		if (irq_num < 0 && !cpu_is_omap44xx()) {
+
+			if (irq_num == -EPROBE_DEFER)
+				return irq_num;
+
+			/* Have nothing to do */
+			return 0;
+		}
+
+		/* Once OMAP4 DT is filled as well */
+		if (irq_num >= 0)
+			omap4_prcm_irq_setup.irq = irq_num;
+	}
+
 	omap44xx_prm_enable_io_wakeup();
 
 	return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
-- 
1.7.9.5

  parent reply	other threads:[~2014-06-06  3:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  3:35 [RFC PATCH 0/7] ARM: OMAP4+: PRM: minor cleanups and dt support of interrupts Nishanth Menon
2014-06-06  3:35 ` Nishanth Menon
2014-06-06  3:35 ` [RFC PATCH 1/7] ARM: OMAP4+: prminst: provide function to find prm_dev instance offset Nishanth Menon
2014-06-06  3:35   ` Nishanth Menon
2014-06-06  3:35 ` [RFC PATCH 2/7] ARM: OMAP4: prm use the generic prm_inst to allow logic to be abstracted Nishanth Menon
2014-06-06  3:35   ` Nishanth Menon
2014-06-06  3:35 ` [RFC PATCH 3/7] ARM: OMAP4+: PRM: remove "wkup" event Nishanth Menon
2014-06-06  3:35   ` Nishanth Menon
2014-07-21 10:44   ` Tony Lindgren
2014-07-21 10:44     ` Tony Lindgren
2014-07-21 11:17     ` Nishanth Menon
2014-07-21 11:17       ` Nishanth Menon
     [not found] ` <1402025761-16831-1-git-send-email-nm-l0cyMroinI0@public.gmane.org>
2014-06-06  3:35   ` Nishanth Menon [this message]
2014-06-06  3:35     ` [RFC PATCH 4/7] ARM: OMAP4+: PRM: register interrupt information from DT Nishanth Menon
2014-07-21 10:51     ` Tony Lindgren
2014-07-21 10:51       ` Tony Lindgren
2014-07-21 11:22       ` Nishanth Menon
2014-07-21 11:22         ` Nishanth Menon
2014-07-21 11:28         ` Tony Lindgren
2014-07-21 11:28           ` Tony Lindgren
2014-07-21 12:08           ` Nishanth Menon
2014-07-21 12:08             ` Nishanth Menon
2014-07-21 12:31             ` Tony Lindgren
2014-07-21 12:31               ` Tony Lindgren
2014-06-06  3:35 ` [RFC PATCH 5/7] ARM: dts: OMAP4: Add PRM interrupt Nishanth Menon
2014-06-06  3:35   ` Nishanth Menon
2014-06-06  3:36 ` [RFC PATCH 6/7] ARM: dts: OMAP5: add " Nishanth Menon
2014-06-06  3:36   ` Nishanth Menon
2014-06-06  3:36 ` [RFC PATCH 7/7] ARM: dts: DRA7: " Nishanth Menon
2014-06-06  3:36   ` Nishanth Menon
2014-06-17 15:38 ` [RFC PATCH 0/7] ARM: OMAP4+: PRM: minor cleanups and dt support of interrupts Nishanth Menon
2014-06-17 15:38   ` Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402025761-16831-5-git-send-email-nm@ti.com \
    --to=nm-l0cymroini0@public.gmane.org \
    --cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
    --cc=rnayak-l0cyMroinI0@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.