From patchwork Sat Nov 6 01:19:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: omar ramirez X-Patchwork-Id: 305122 X-Patchwork-Delegate: hiroshi.doyu@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA61UVR5017864 for ; Sat, 6 Nov 2010 01:30:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094Ab0KFBab (ORCPT ); Fri, 5 Nov 2010 21:30:31 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:50214 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281Ab0KFBaa (ORCPT ); Fri, 5 Nov 2010 21:30:30 -0400 Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id oA61UBme026487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Nov 2010 20:30:11 -0500 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id oA61U5Li010988; Fri, 5 Nov 2010 20:30:05 -0500 (CDT) Received: from localhost (bacab.am.dhcp.ti.com [128.247.77.143]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id oA61U5f15671; Fri, 5 Nov 2010 20:30:05 -0500 (CDT) From: Omar Ramirez Luna To: Tony Lindgren , Hiroshi DOYU Cc: Russell King , Hari Kanigeri , Paul Walmsley , Kevin Hilman , Benoit Cousson , Omar Ramirez Luna , "Govindraj.R" , Charulatha V , Ramesh Gupta , linux-omap@vger.kernel.org, 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 Message-Id: <1289006396-27230-2-git-send-email-omar.ramirez@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1289006396-27230-1-git-send-email-omar.ramirez@ti.com> References: <1289006396-27230-1-git-send-email-omar.ramirez@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 06 Nov 2010 01:30:33 +0000 (UTC) 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;