From: omar.ramirez@ti•com (Omar Ramirez Luna)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 1/6] omap: iommu: remove redundant clock usage
Date: Fri, 5 Nov 2010 19:19:51 -0600 [thread overview]
Message-ID: <1289006396-27230-2-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1289006396-27230-1-git-send-email-omar.ramirez@ti.com>
iommu driver is meant to provide control of mmu hardware blocks
its current users (MMUs) are part of larger subsystems and do not
have a dedicated clock as the one they use is shared with the
entire subsystem, it doesn't make sense to enable/disable on each
register read/write operation as the driver using its interface
should also be handling the same clock.
iommu should only enable/disable the clock on mmu request/free from
the driver wanting to use it.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti•com>
---
arch/arm/plat-omap/iommu.c | 38 +++++---------------------------------
1 files changed, 5 insertions(+), 33 deletions(-)
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index 6cd151b..de992c8 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -108,7 +108,6 @@ static int iommu_enable(struct iommu *obj)
err = arch_iommu->enable(obj);
- clk_disable(obj->clk);
return err;
}
@@ -117,8 +116,6 @@ static void iommu_disable(struct iommu *obj)
if (!obj)
return;
- clk_enable(obj->clk);
-
arch_iommu->disable(obj);
clk_disable(obj->clk);
@@ -237,20 +234,16 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n)
**/
int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
{
- int err = 0;
struct iotlb_lock l;
struct cr_regs *cr;
if (!obj || !obj->nr_tlb_entries || !e)
return -EINVAL;
- clk_enable(obj->clk);
-
iotlb_lock_get(obj, &l);
if (l.base == obj->nr_tlb_entries) {
dev_warn(obj->dev, "%s: preserve entries full\n", __func__);
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
if (!e->prsvd) {
int i;
@@ -262,8 +255,7 @@ int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
if (i == obj->nr_tlb_entries) {
dev_dbg(obj->dev, "%s: full: no entry\n", __func__);
- err = -EBUSY;
- goto out;
+ return -EBUSY;
}
iotlb_lock_get(obj, &l);
@@ -273,10 +265,8 @@ int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
}
cr = iotlb_alloc_cr(obj, e);
- if (IS_ERR(cr)) {
- clk_disable(obj->clk);
+ if (IS_ERR(cr))
return PTR_ERR(cr);
- }
iotlb_load_cr(obj, cr);
kfree(cr);
@@ -287,9 +277,8 @@ int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
if (++l.vict == obj->nr_tlb_entries)
l.vict = l.base;
iotlb_lock_set(obj, &l);
-out:
- clk_disable(obj->clk);
- return err;
+
+ return 0;
}
EXPORT_SYMBOL_GPL(load_iotlb_entry);
@@ -305,8 +294,6 @@ void flush_iotlb_page(struct iommu *obj, u32 da)
int i;
struct cr_regs cr;
- clk_enable(obj->clk);
-
for_each_iotlb_cr(obj, obj->nr_tlb_entries, i, cr) {
u32 start;
size_t bytes;
@@ -324,7 +311,6 @@ void flush_iotlb_page(struct iommu *obj, u32 da)
iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
}
}
- clk_disable(obj->clk);
if (i == obj->nr_tlb_entries)
dev_dbg(obj->dev, "%s: no page for %08x\n", __func__, da);
@@ -359,15 +345,11 @@ void flush_iotlb_all(struct iommu *obj)
{
struct iotlb_lock l;
- clk_enable(obj->clk);
-
l.base = 0;
l.vict = 0;
iotlb_lock_set(obj, &l);
iommu_write_reg(obj, 1, MMU_GFLUSH);
-
- clk_disable(obj->clk);
}
EXPORT_SYMBOL_GPL(flush_iotlb_all);
@@ -382,9 +364,7 @@ EXPORT_SYMBOL_GPL(flush_iotlb_all);
*/
void iommu_set_twl(struct iommu *obj, bool on)
{
- clk_enable(obj->clk);
arch_iommu->set_twl(obj, on);
- clk_disable(obj->clk);
}
EXPORT_SYMBOL_GPL(iommu_set_twl);
@@ -395,12 +375,8 @@ ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes)
if (!obj || !buf)
return -EINVAL;
- clk_enable(obj->clk);
-
bytes = arch_iommu->dump_ctx(obj, buf, bytes);
- clk_disable(obj->clk);
-
return bytes;
}
EXPORT_SYMBOL_GPL(iommu_dump_ctx);
@@ -412,7 +388,6 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num)
struct cr_regs tmp;
struct cr_regs *p = crs;
- clk_enable(obj->clk);
iotlb_lock_get(obj, &saved);
for_each_iotlb_cr(obj, num, i, tmp) {
@@ -422,7 +397,6 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num)
}
iotlb_lock_set(obj, &saved);
- clk_disable(obj->clk);
return p - crs;
}
@@ -795,9 +769,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
if (!err)
return IRQ_HANDLED;
- clk_enable(obj->clk);
stat = iommu_report_fault(obj, &da);
- clk_disable(obj->clk);
if (!stat)
return IRQ_HANDLED;
--
1.7.1
next prev parent reply other threads:[~2010-11-06 1:19 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-06 1:19 [PATCH 0/6] omap: iommu: hwmod support and code reorganization Omar Ramirez Luna
2010-11-06 1:19 ` Omar Ramirez Luna [this message]
2010-11-06 19:11 ` [PATCH 1/6] omap: iommu: remove redundant clock usage Cousson, Benoit
2010-11-07 15:55 ` Ramirez Luna, Omar
2010-11-06 1:19 ` [PATCH 2/6] OMAP3: hwmod data: Add mmu for iva2 and isp Omar Ramirez Luna
2010-11-06 19:15 ` Cousson, Benoit
2010-11-07 16:00 ` Ramirez Luna, Omar
2010-11-08 23:05 ` Cousson, Benoit
2010-11-08 23:52 ` Ramirez Luna, Omar
2010-11-06 1:19 ` [PATCH 3/6] OMAP4: hwmod data: add mmu hwmod for ducati and tesla Omar Ramirez Luna
2010-11-06 20:47 ` Cousson, Benoit
2010-11-07 16:18 ` Ramirez Luna, Omar
2010-11-08 23:21 ` Cousson, Benoit
2010-11-08 23:48 ` Ramirez Luna, Omar
2010-11-09 0:03 ` Cousson, Benoit
2010-11-06 1:19 ` [PATCH 4/6] omap: iommu: intial hwmod support Omar Ramirez Luna
2010-11-06 21:05 ` Cousson, Benoit
2010-11-07 16:21 ` Ramirez Luna, Omar
2010-11-06 1:19 ` [PATCH 5/6] omap: iommu: hwmod device enable/disable routines Omar Ramirez Luna
2010-11-06 21:17 ` Cousson, Benoit
2010-11-07 16:24 ` Ramirez Luna, Omar
2010-11-06 1:19 ` [PATCH 6/6] omap: iommu: code reorganization and cleanup Omar Ramirez Luna
2010-11-06 8:34 ` Felipe Contreras
2010-11-07 16:29 ` Ramirez Luna, Omar
2010-11-06 21:28 ` Cousson, Benoit
2010-11-07 16:27 ` Ramirez Luna, Omar
2010-11-06 1:32 ` [PATCH 0/6] omap: iommu: hwmod support and code reorganization Ramirez Luna, Omar
2010-11-06 18:31 ` Cousson, Benoit
2010-11-07 15:43 ` Ramirez Luna, Omar
2010-11-08 21:56 ` Cousson, Benoit
2010-11-06 18:56 ` 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=1289006396-27230-2-git-send-email-omar.ramirez@ti.com \
--to=omar.ramirez@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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