All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: linux-omap@vger.kernel.org
Cc: tony@atomide.com, linux-arm-kernel@lists.infradead.org,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Benoit Cousson <b-cousson@ti.com>, Rajendra Nayak <rnayak@ti.com>
Subject: [PATCH 7/8] ARM: OMAP: hwmod: extract module address space from DT blob
Date: Wed, 20 Feb 2013 21:08:54 +0530	[thread overview]
Message-ID: <1361374735-22018-8-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1361374735-22018-1-git-send-email-santosh.shilimkar@ti.com>

Patch adds the code for extracting the module ocp address space from device
tree blob in case the hwmod address space look up fails.

The idea is to remove the address space data from hwmod and extract it from
DT blob.

Cc: Benoit Cousson <b-cousson@ti.com>

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 4653efb..5aad348 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -138,6 +138,7 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/bootmem.h>
+#include <linux/of.h>
 
 #include "clock.h"
 #include "omap_hwmod.h"
@@ -2336,6 +2337,11 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
 {
 	struct omap_hwmod_addr_space *mem;
 	void __iomem *va_start;
+	struct device_node *np;
+	const void *reg_prop;
+	const char *p;
+	unsigned long start = 0, size = 0;
+
 
 	if (!oh)
 		return;
@@ -2349,10 +2355,33 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
 	if (!mem) {
 		pr_debug("omap_hwmod: %s: no MPU register target found\n",
 			 oh->name);
+
+		/* Extract the IO space from device tree blob */
+		if (!of_have_populated_dt())
+			return;
+
+		for_each_child_of_node(of_find_node_by_name(NULL, "ocp"), np) {
+			if (of_find_property(np, "ti,hwmods", NULL)) {
+				p = of_get_property(np, "ti,hwmods", NULL);
+				if (!strcmp(p, oh->name)) {
+					reg_prop = of_get_property(np, "reg",
+									NULL);
+					start = of_read_number(reg_prop, 1);
+					size = of_read_number(reg_prop + 4, 1);
+				}
+			}
+		}
+	} else {
+		start = mem->pa_start;
+		size = mem->pa_end - mem->pa_start;
+	}
+
+	if (!start) {
+		pr_debug("omap_hwmod: %s: No address space found\n", oh->name);
 		return;
 	}
 
-	va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
+	va_start = ioremap(start, size);
 	if (!va_start) {
 		pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
 		return;
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8] ARM: OMAP: hwmod: extract module address space from DT blob
Date: Wed, 20 Feb 2013 21:08:54 +0530	[thread overview]
Message-ID: <1361374735-22018-8-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1361374735-22018-1-git-send-email-santosh.shilimkar@ti.com>

Patch adds the code for extracting the module ocp address space from device
tree blob in case the hwmod address space look up fails.

The idea is to remove the address space data from hwmod and extract it from
DT blob.

Cc: Benoit Cousson <b-cousson@ti.com>

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 4653efb..5aad348 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -138,6 +138,7 @@
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/bootmem.h>
+#include <linux/of.h>
 
 #include "clock.h"
 #include "omap_hwmod.h"
@@ -2336,6 +2337,11 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
 {
 	struct omap_hwmod_addr_space *mem;
 	void __iomem *va_start;
+	struct device_node *np;
+	const void *reg_prop;
+	const char *p;
+	unsigned long start = 0, size = 0;
+
 
 	if (!oh)
 		return;
@@ -2349,10 +2355,33 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
 	if (!mem) {
 		pr_debug("omap_hwmod: %s: no MPU register target found\n",
 			 oh->name);
+
+		/* Extract the IO space from device tree blob */
+		if (!of_have_populated_dt())
+			return;
+
+		for_each_child_of_node(of_find_node_by_name(NULL, "ocp"), np) {
+			if (of_find_property(np, "ti,hwmods", NULL)) {
+				p = of_get_property(np, "ti,hwmods", NULL);
+				if (!strcmp(p, oh->name)) {
+					reg_prop = of_get_property(np, "reg",
+									NULL);
+					start = of_read_number(reg_prop, 1);
+					size = of_read_number(reg_prop + 4, 1);
+				}
+			}
+		}
+	} else {
+		start = mem->pa_start;
+		size = mem->pa_end - mem->pa_start;
+	}
+
+	if (!start) {
+		pr_debug("omap_hwmod: %s: No address space found\n", oh->name);
 		return;
 	}
 
-	va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
+	va_start = ioremap(start, size);
 	if (!va_start) {
 		pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
 		return;
-- 
1.7.9.5

  parent reply	other threads:[~2013-02-20 15:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 15:38 [PATCH 0/8] ARM: dts: OMAP5: ocp address space and few updates Santosh Shilimkar
2013-02-20 15:38 ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 1/8] ARM: dts: omap5-evm: Update available memory to 2032 MB Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 2/8] ARM: dts: OMAP5: Align the local timer dt node as per the current binding code Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 3/8] ARM: dts: OMAP5: Specify nonsecure PPI IRQ for arch timer Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 4/8] ARM: dts: OMAP5: Move the gic node out of ocp space Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 5/8] ARM: dts: OMAP5: Update the timer and gic nodes for HYP kernel support Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 6/8] ARM: dts: OMAP5: Update keypad reg property Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-20 15:38 ` Santosh Shilimkar [this message]
2013-02-20 15:38   ` [PATCH 7/8] ARM: OMAP: hwmod: extract module address space from DT blob Santosh Shilimkar
2013-02-20 15:42   ` Felipe Balbi
2013-02-20 15:42     ` Felipe Balbi
2013-02-20 15:46     ` Santosh Shilimkar
2013-02-20 15:46       ` Santosh Shilimkar
2013-02-20 15:38 ` [PATCH 8/8] ARM: dts: OMAP5: Add ocp address space for all hwmods Santosh Shilimkar
2013-02-20 15:38   ` Santosh Shilimkar
2013-02-25 10:56   ` Benoit Cousson
2013-02-25 10:56     ` Benoit Cousson
2013-02-25 11:16     ` Santosh Shilimkar
2013-02-25 11:16       ` Santosh Shilimkar
2013-03-15 10:24 ` [PATCH 0/8] ARM: dts: OMAP5: ocp address space and few updates Santosh Shilimkar
2013-03-15 10:24   ` Santosh Shilimkar
2013-03-15 12:45   ` Benoit Cousson
2013-03-15 12:45     ` Benoit Cousson
2013-03-15 12:53     ` Santosh Shilimkar
2013-03-15 12:53       ` Santosh Shilimkar

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=1361374735-22018-8-git-send-email-santosh.shilimkar@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=b-cousson@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rnayak@ti.com \
    --cc=tony@atomide.com \
    /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.