From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: "Tony Lindgren" <tony@atomide.com>, "Benoît Cousson" <b-cousson@ti.com>
Subject: [PATCH 5/7] ARM: OMAP2+: hwmod: add omap_hwmod_get_mpu_irq() and omap_hwmod_get_mpu_rt_pa()
Date: Mon, 30 Jan 2012 03:18:17 -0700 [thread overview]
Message-ID: <20120130101816.10450.2624.stgit@dusk> (raw)
In-Reply-To: <20120130101251.10450.58423.stgit@dusk>
The timer integration code pokes around in hwmod data structures.
Those data structures are about to change. Define some functions for
the timer integration code to use instead.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoît Cousson <b-cousson@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 82 ++++++++++++++++++++++++++
arch/arm/plat-omap/include/plat/omap_hwmod.h | 3 +
2 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 4e8d332..f7bf759 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2794,3 +2794,85 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
return 0;
}
+
+/*
+ * IP block data retrieval functions
+ */
+
+/**
+ * omap_hwmod_get_mpu_irq - return a hwmod's MPU IRQ line ID, if it only has one
+ * @oh: struct omap_hwmod * to examine MPU IRQs on
+ *
+ * If the IP block represented by @oh only has one IRQ line, return its
+ * ID; otherwise, return -ENOENT if the IP block has no MPU IRQs, or -EINVAL
+ * if @oh is null or hasn't yet been registered.
+ */
+int omap_hwmod_get_mpu_irq(struct omap_hwmod *oh)
+{
+ struct omap_hwmod_irq_info *ii;
+
+ if (!oh)
+ return -EINVAL;
+
+ if (oh->_state == _HWMOD_STATE_UNKNOWN)
+ return -EINVAL;
+
+ if (!oh->mpu_irqs)
+ return -ENOENT;
+
+ ii = &oh->mpu_irqs[0];
+
+ if (ii->irq == -1)
+ return -ENOENT;
+
+ return ii->irq;
+}
+
+/**
+ * omap_hwmod_get_mpu_rt_pa - get the register target physical start & end addrs
+ * @oh: struct omap_hwmod * to retrieve physical address information for
+ * @pa_start: ptr to a u32 to return the starting physical address of the RT
+ * @pa_end: ptr to a u32 to return the ending physical address of the RT
+ *
+ * For a given hwmod @oh, return the starting MPU physical address of
+ * @oh's register target address space in the u32 pointed to by
+ * @pa_start, and return the ending MPU physical address of @oh's
+ * register target address space in the u32 pointed to by @pa_end.
+ * (Device registers, particularly the OCP header registers, are
+ * expected to reside in this space.) The previous contents of the
+ * data pointed to by @pa_start and @pa_end are ignored and
+ * overwritten. @pa_start is usually (but not always) the same as the
+ * device's "base address." Note that @pa_start and @pa_end are
+ * currently only guaranteed to be valid addresses for the MPU, not
+ * for other interconnect initiators.
+ *
+ * Returns 0 upon success, -EINVAL if any arguments are null or if the
+ * hwmod hasn't been registered, or -ENOENT if @oh has no MPU register
+ * target address space.
+ */
+int omap_hwmod_get_mpu_rt_pa(struct omap_hwmod *oh, u32 *pa_start, u32 *pa_end)
+{
+ struct omap_hwmod_addr_space *mem;
+
+ if (!oh || !pa_start || !pa_end)
+ return -EINVAL;
+
+ if (oh->_state == _HWMOD_STATE_UNKNOWN)
+ return -EINVAL;
+
+ if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
+ return -ENOENT;
+
+ mem = _find_mpu_rt_addr_space(oh);
+ if (!mem) {
+ pr_debug("omap_hwmod: %s: no MPU register target found\n",
+ oh->name);
+ return -ENOENT;
+ }
+
+ *pa_start = mem->pa_start;
+ *pa_end = mem->pa_end;
+
+ return 0;
+}
+
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 6470101..0d95c86 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -610,6 +610,9 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);
int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx);
+int omap_hwmod_get_mpu_irq(struct omap_hwmod *oh);
+int omap_hwmod_get_mpu_rt_pa(struct omap_hwmod *oh, u32 *pa_start, u32 *pa_end);
+
/*
* Chip variant-specific hwmod init routines - XXX should be converted
* to use initcalls once the initial boot ordering is straightened out
--
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
next prev parent reply other threads:[~2012-01-30 10:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 10:18 [PATCH 0/7] ARM: OMAP2+: hwmod/timer: first set of cleanups for 3.4 Paul Walmsley
2012-01-30 10:18 ` [PATCH 1/7] ARM: OMAP2+: hwmod: control all hardreset lines attached to a hwmod Paul Walmsley
2012-01-30 10:18 ` [PATCH 2/7] ARM: OMAP4: hwmod data: remove pseudo-hwmods associated with hardreset lines Paul Walmsley
2012-01-30 10:18 ` [PATCH 3/7] ARM: OMAP2+: hwmod: ensure that SYSCONFIG bits are reprogrammed after a reset Paul Walmsley
2012-01-30 10:18 ` [PATCH 4/7] ARM: OMAP2+: hwmod: provide a function to return the address space of the MPU RT Paul Walmsley
2012-01-30 10:18 ` Paul Walmsley [this message]
2012-01-30 17:13 ` [PATCH 5/7] ARM: OMAP2+: hwmod: add omap_hwmod_get_mpu_irq() and omap_hwmod_get_mpu_rt_pa() Tony Lindgren
2012-01-30 21:36 ` Paul Walmsley
2012-01-30 10:18 ` [PATCH 7/7] ARM: OMAP2+: hwmod: split the _setup() function Paul Walmsley
2012-01-30 10:18 ` [PATCH 6/7] ARM: OMAP2+: timer: use a proper interface to get hwmod data Paul Walmsley
2012-01-30 23:14 ` [PATCH 0/7] ARM: OMAP2+: hwmod/timer: first set of cleanups for 3.4 Kevin Hilman
2012-01-30 23:36 ` Paul Walmsley
2012-01-31 8:05 ` Cousson, Benoit
2012-01-31 8:14 ` Paul Walmsley
2012-01-31 8:19 ` Cousson, Benoit
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=20120130101816.10450.2624.stgit@dusk \
--to=paul@pwsan.com \
--cc=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).