From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: "Benoît Cousson" <b-cousson@ti.com>
Subject: [PATCH v2 6/8] ARM: OMAP2+: hwmod: provide a function to return the address space of the MPU RT
Date: Mon, 27 Feb 2012 22:37:04 -0700 [thread overview]
Message-ID: <20120228053701.16278.97562.stgit@dusk> (raw)
In-Reply-To: <20120228053524.16278.59430.stgit@dusk>
A subsequent patch will need to know the struct omap_hwmod_addr_space
record corresponding to the module's register target, used by the MPU.
So, convert _find_mpu_rt_base() into _find_mpu_rt_addr_space(). Then
modify its sole current user, _populate_mpu_rt_base(), to extract the
MPU RT base address itself from the struct omap_hwmod_addr_space record.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 57 +++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index aeb6f4c..88b6d96 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -920,24 +920,22 @@ static int __init _find_mpu_port_index(struct omap_hwmod *oh)
}
/**
- * _find_mpu_rt_base - find hwmod register target base addr accessible by MPU
+ * _find_mpu_rt_addr_space - return MPU register target address space for @oh
* @oh: struct omap_hwmod *
*
- * Return the virtual address of the base of the register target of
- * device @oh, or NULL on error.
+ * Returns a pointer to the struct omap_hwmod_addr_space record representing
+ * the register target MPU address space; or returns NULL upon error.
*/
-static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
+static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap_hwmod *oh)
{
struct omap_hwmod_ocp_if *os;
struct omap_hwmod_addr_space *mem;
- int i = 0, found = 0;
- void __iomem *va_start;
+ int found = 0, i = 0;
- if (!oh || oh->slaves_cnt == 0)
+ if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0)
return NULL;
- os = oh->slaves[index];
-
+ os = oh->slaves[oh->_mpu_port_index];
if (!os->addr)
return NULL;
@@ -947,20 +945,7 @@ static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
found = 1;
} while (!found && mem->pa_start != mem->pa_end);
- if (found) {
- va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
- if (!va_start) {
- pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
- return NULL;
- }
- pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
- oh->name, va_start);
- } else {
- pr_debug("omap_hwmod: %s: no MPU register target found\n",
- oh->name);
- }
-
- return (found) ? va_start : NULL;
+ return (found) ? mem : NULL;
}
/**
@@ -1772,10 +1757,32 @@ static int _shutdown(struct omap_hwmod *oh)
*/
static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
{
+ struct omap_hwmod_addr_space *mem;
+ void __iomem *va_start;
+
+ if (!oh)
+ return;
+
if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
- return 0;
+ return;
+
+ mem = _find_mpu_rt_addr_space(oh);
+ if (!mem) {
+ pr_debug("omap_hwmod: %s: no MPU register target found\n",
+ oh->name);
+ return;
+ }
+
+ va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
+ if (!va_start) {
+ pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
+ return;
+ }
+
+ pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
+ oh->name, va_start);
- oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index);
+ oh->_mpu_rt_va = va_start;
}
/**
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 6/8] ARM: OMAP2+: hwmod: provide a function to return the address space of the MPU RT
Date: Mon, 27 Feb 2012 22:37:04 -0700 [thread overview]
Message-ID: <20120228053701.16278.97562.stgit@dusk> (raw)
In-Reply-To: <20120228053524.16278.59430.stgit@dusk>
A subsequent patch will need to know the struct omap_hwmod_addr_space
record corresponding to the module's register target, used by the MPU.
So, convert _find_mpu_rt_base() into _find_mpu_rt_addr_space(). Then
modify its sole current user, _populate_mpu_rt_base(), to extract the
MPU RT base address itself from the struct omap_hwmod_addr_space record.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Beno?t Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 57 +++++++++++++++++++++-----------------
1 files changed, 32 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index aeb6f4c..88b6d96 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -920,24 +920,22 @@ static int __init _find_mpu_port_index(struct omap_hwmod *oh)
}
/**
- * _find_mpu_rt_base - find hwmod register target base addr accessible by MPU
+ * _find_mpu_rt_addr_space - return MPU register target address space for @oh
* @oh: struct omap_hwmod *
*
- * Return the virtual address of the base of the register target of
- * device @oh, or NULL on error.
+ * Returns a pointer to the struct omap_hwmod_addr_space record representing
+ * the register target MPU address space; or returns NULL upon error.
*/
-static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
+static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap_hwmod *oh)
{
struct omap_hwmod_ocp_if *os;
struct omap_hwmod_addr_space *mem;
- int i = 0, found = 0;
- void __iomem *va_start;
+ int found = 0, i = 0;
- if (!oh || oh->slaves_cnt == 0)
+ if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0)
return NULL;
- os = oh->slaves[index];
-
+ os = oh->slaves[oh->_mpu_port_index];
if (!os->addr)
return NULL;
@@ -947,20 +945,7 @@ static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
found = 1;
} while (!found && mem->pa_start != mem->pa_end);
- if (found) {
- va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
- if (!va_start) {
- pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
- return NULL;
- }
- pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
- oh->name, va_start);
- } else {
- pr_debug("omap_hwmod: %s: no MPU register target found\n",
- oh->name);
- }
-
- return (found) ? va_start : NULL;
+ return (found) ? mem : NULL;
}
/**
@@ -1772,10 +1757,32 @@ static int _shutdown(struct omap_hwmod *oh)
*/
static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
{
+ struct omap_hwmod_addr_space *mem;
+ void __iomem *va_start;
+
+ if (!oh)
+ return;
+
if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
- return 0;
+ return;
+
+ mem = _find_mpu_rt_addr_space(oh);
+ if (!mem) {
+ pr_debug("omap_hwmod: %s: no MPU register target found\n",
+ oh->name);
+ return;
+ }
+
+ va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
+ if (!va_start) {
+ pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
+ return;
+ }
+
+ pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
+ oh->name, va_start);
- oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index);
+ oh->_mpu_rt_va = va_start;
}
/**
next prev parent reply other threads:[~2012-02-28 5:37 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 5:36 [PATCH v2 0/8] ARM: OMAP2+: hwmod/timer: first set of cleanups for 3.4 Paul Walmsley
2012-02-28 5:36 ` Paul Walmsley
2012-02-28 5:36 ` [PATCH v2 1/8] ARM: OMAP2+: hwmod: control all hardreset lines attached to a hwmod Paul Walmsley
2012-02-28 5:36 ` Paul Walmsley
2012-02-28 5:36 ` [PATCH v2 2/8] ARM: OMAP4: hwmod data: remove pseudo-hwmods associated with hardreset lines Paul Walmsley
2012-02-28 5:36 ` Paul Walmsley
2012-02-28 5:36 ` [PATCH v2 3/8] ARM: OMAP2+: hwmod: reorganize and document the setup process Paul Walmsley
2012-02-28 5:36 ` Paul Walmsley
2012-04-19 8:14 ` Paul Walmsley
2012-04-19 8:14 ` Paul Walmsley
2012-04-19 8:17 ` Paul Walmsley
2012-04-19 8:17 ` Paul Walmsley
2012-04-19 8:22 ` Cousson, Benoit
2012-04-19 8:22 ` Cousson, Benoit
2012-04-19 9:49 ` Paul Walmsley
2012-04-19 9:49 ` Paul Walmsley
2012-04-19 12:05 ` Cousson, Benoit
2012-04-19 12:05 ` Cousson, Benoit
2012-02-28 5:36 ` [PATCH v2 4/8] ARM: OMAP2+: hwmod: revise hardreset behavior Paul Walmsley
2012-02-28 5:36 ` Paul Walmsley
2012-04-19 6:53 ` Paul Walmsley
2012-04-19 6:53 ` Paul Walmsley
2012-04-19 12:07 ` Cousson, Benoit
2012-04-19 12:07 ` Cousson, Benoit
2012-04-19 17:17 ` Paul Walmsley
2012-04-19 17:17 ` Paul Walmsley
2012-04-19 19:14 ` Cousson, Benoit
2012-04-19 19:14 ` Cousson, Benoit
2012-04-19 19:46 ` Paul Walmsley
2012-04-19 19:46 ` Paul Walmsley
2012-04-19 21:15 ` Ramirez Luna, Omar
2012-04-19 21:15 ` Ramirez Luna, Omar
2012-02-28 5:37 ` [PATCH v2 5/8] ARM: OMAP2+: hwmod: ensure that SYSCONFIG bits are reprogrammed after a reset Paul Walmsley
2012-02-28 5:37 ` Paul Walmsley
2012-03-15 0:31 ` Ramirez Luna, Omar
2012-03-15 0:31 ` Ramirez Luna, Omar
2012-03-15 6:25 ` Paul Walmsley
2012-03-15 6:25 ` Paul Walmsley
2012-03-15 15:21 ` Ramirez Luna, Omar
2012-03-15 15:21 ` Ramirez Luna, Omar
2012-04-11 20:15 ` Paul Walmsley
2012-04-11 20:15 ` Paul Walmsley
2012-04-19 8:21 ` Paul Walmsley
2012-04-19 8:21 ` Paul Walmsley
2012-02-28 5:37 ` Paul Walmsley [this message]
2012-02-28 5:37 ` [PATCH v2 6/8] ARM: OMAP2+: hwmod: provide a function to return the address space of the MPU RT Paul Walmsley
2012-02-28 5:37 ` [PATCH v2 7/8] ARM: OMAP2+: hwmod: add omap_hwmod_get_resource_byname() Paul Walmsley
2012-02-28 5:37 ` Paul Walmsley
2012-02-28 5:37 ` [PATCH v2 8/8] ARM: OMAP2+: timer: use a proper interface to get hwmod data Paul Walmsley
2012-02-28 5:37 ` Paul Walmsley
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=20120228053701.16278.97562.stgit@dusk \
--to=paul@pwsan.com \
--cc=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.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.