linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Joerg Roedel <Joerg.Roedel@amd.com>,
	iommu@lists.linux-foundation.org, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org, Cousson Benoit <b-cousson@ti.com>,
	Kevin Hilman <khilman@ti.com>, Tony Lindgren <tony@atomide.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Ohad Ben-Cohen <ohad@wizery.com>
Subject: [RFC 3/5] ARM: OMAP: iommu: declare a private iommu binding struct
Date: Sun, 25 Sep 2011 13:58:55 +0300	[thread overview]
Message-ID: <1316948337-7924-4-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1316948337-7924-1-git-send-email-ohad@wizery.com>

Declare an omap iommu private struct, which binds an iommu user
to its iommu device. This struct should be placed at the iommu user's
dev_archdata so generic IOMMU API can be used without having to
utilize omap-specific plumbing anymore.

While at it, provide an accessor method to ease the retrieval of the
omap_iommu handle from a user device.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/include/plat/iommu.h |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index a1d79ee..fa11ee2 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -111,6 +111,32 @@ struct iommu_platform_data {
 	u32 da_end;
 };
 
+/**
+ * struct iommu_arch_data - omap iommu private data
+ * @name: name of the iommu device
+ * @iommu_dev: handle of the iommu device
+ *
+ * This is an omap iommu private data object, which binds an iommu user
+ * to its iommu device. This object should be placed at the iommu user's
+ * dev_archdata so generic IOMMU API can be used without having to
+ * utilize omap-specific plumbing anymore.
+ */
+struct omap_iommu_arch_data {
+	const char *name;
+	struct omap_iommu *iommu_dev;
+};
+
+/**
+ * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
+ * @dev: iommu client device
+ */
+static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
+{
+	struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
+
+	return arch_data->iommu_dev;
+}
+
 /* IOMMU errors */
 #define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
 #define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
-- 
1.7.4.1

  parent reply	other threads:[~2011-09-25 10:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-25 10:58 [RFC 0/5] OMAP groundwork for IOMMU-based DMA API Ohad Ben-Cohen
2011-09-25 10:58 ` [RFC 1/5] ARM: dev_archdata: add private iommu extension Ohad Ben-Cohen
2011-09-27  1:30   ` Grant Likely
2011-10-02 18:48     ` Ohad Ben-Cohen
2011-10-05  9:26   ` Ohad Ben-Cohen
2011-10-13  9:15     ` Ohad Ben-Cohen
2011-10-13 10:42       ` Russell King - ARM Linux
2011-10-13 11:55         ` Ohad Ben-Cohen
2011-09-25 10:58 ` [RFC 2/5] ARM: OMAP: omap_device: add a method to set iommu private archdata Ohad Ben-Cohen
2011-09-26 22:53   ` Kevin Hilman
2011-09-27 18:09     ` Ohad Ben-Cohen
2011-10-04 18:15       ` Kevin Hilman
2011-10-04 19:54         ` Ohad Ben-Cohen
2011-10-04 20:29           ` Kevin Hilman
2011-10-05  7:01             ` Ohad Ben-Cohen
2011-10-04 21:40           ` Cousson, Benoit
2011-09-25 10:58 ` Ohad Ben-Cohen [this message]
2011-11-14 21:01   ` [RFC 3/5] ARM: OMAP: iommu: declare a private iommu binding struct Tony Lindgren
2011-09-25 10:58 ` [RFC 4/5] ARM: OMAP3: bind omap3isp_device to its iommu device Ohad Ben-Cohen
2011-11-09  9:17   ` Laurent Pinchart
2011-11-09  9:29     ` Ohad Ben-Cohen
2011-11-14 21:01     ` Tony Lindgren
2011-09-25 10:58 ` [RFC 5/5] iommu/omap: eliminate the public omap_find_iommu_device() method Ohad Ben-Cohen
2011-09-27 11:46   ` Laurent Pinchart
2011-11-09  8:50     ` Ohad Ben-Cohen
2011-11-09  9:17       ` Laurent Pinchart
2011-11-14 21:02         ` Tony Lindgren
2011-11-15 10:39 ` [RFC 0/5] OMAP groundwork for IOMMU-based DMA API Roedel, Joerg
2011-11-15 10:45   ` Ohad Ben-Cohen
2011-11-15 11:10     ` Roedel, Joerg
2011-11-15 11:18       ` Ohad Ben-Cohen
2011-12-05 14:21   ` Ohad Ben-Cohen
2011-12-05 15:18     ` Roedel, Joerg

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=1316948337-7924-4-git-send-email-ohad@wizery.com \
    --to=ohad@wizery.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=Joerg.Roedel@amd.com \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=grant.likely@secretlab.ca \
    --cc=iommu@lists.linux-foundation.org \
    --cc=khilman@ti.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.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).