Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347510
b: refs/heads/master
c: ebf7cda
h: refs/heads/master
v: v3
  • Loading branch information
Omar Ramirez Luna authored and Joerg Roedel committed Dec 3, 2012
1 parent 283cea3 commit edc32ee
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 44 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 72b15b6ae97796c5fac687addde5dbfab872cf94
refs/heads/master: ebf7cda0f92effd8169b831fae81e9437dce1fef
1 change: 0 additions & 1 deletion trunk/arch/arm/mach-omap2/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
return -ENOMEM;

pdata->name = oh->name;
pdata->clk_name = oh->main_clk;
pdata->nr_tlb_entries = a->nr_tlb_entries;
pdata->da_start = a->da_start;
pdata->da_end = a->da_end;
Expand Down
40 changes: 19 additions & 21 deletions trunk/drivers/iommu/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/iommu.h>
#include <linux/omap-iommu.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>

#include <asm/cacheflush.h>

Expand Down Expand Up @@ -160,7 +160,7 @@ static int iommu_enable(struct omap_iommu *obj)
}
}

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);

err = arch_iommu->enable(obj);

Expand All @@ -177,7 +177,7 @@ static void iommu_disable(struct omap_iommu *obj)

arch_iommu->disable(obj);

clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);

if (pdata->assert_reset)
pdata->assert_reset(pdev, pdata->reset_name);
Expand Down Expand Up @@ -303,7 +303,7 @@ static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
if (!obj || !obj->nr_tlb_entries || !e)
return -EINVAL;

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);

iotlb_lock_get(obj, &l);
if (l.base == obj->nr_tlb_entries) {
Expand Down Expand Up @@ -333,7 +333,7 @@ static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)

cr = iotlb_alloc_cr(obj, e);
if (IS_ERR(cr)) {
clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);
return PTR_ERR(cr);
}

Expand All @@ -347,7 +347,7 @@ static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
l.vict = l.base;
iotlb_lock_set(obj, &l);
out:
clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);
return err;
}

Expand Down Expand Up @@ -377,7 +377,7 @@ static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
int i;
struct cr_regs cr;

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);

for_each_iotlb_cr(obj, obj->nr_tlb_entries, i, cr) {
u32 start;
Expand All @@ -396,7 +396,7 @@ static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
}
}
clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);

if (i == obj->nr_tlb_entries)
dev_dbg(obj->dev, "%s: no page for %08x\n", __func__, da);
Expand All @@ -410,15 +410,15 @@ static void flush_iotlb_all(struct omap_iommu *obj)
{
struct iotlb_lock l;

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);

l.base = 0;
l.vict = 0;
iotlb_lock_set(obj, &l);

iommu_write_reg(obj, 1, MMU_GFLUSH);

clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);
}

#if defined(CONFIG_OMAP_IOMMU_DEBUG) || defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE)
Expand All @@ -428,11 +428,11 @@ ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes)
if (!obj || !buf)
return -EINVAL;

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);

bytes = arch_iommu->dump_ctx(obj, buf, bytes);

clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);

return bytes;
}
Expand All @@ -446,7 +446,7 @@ __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
struct cr_regs tmp;
struct cr_regs *p = crs;

clk_enable(obj->clk);
pm_runtime_get_sync(obj->dev);
iotlb_lock_get(obj, &saved);

for_each_iotlb_cr(obj, num, i, tmp) {
Expand All @@ -456,7 +456,7 @@ __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
}

iotlb_lock_set(obj, &saved);
clk_disable(obj->clk);
pm_runtime_put_sync(obj->dev);

return p - crs;
}
Expand Down Expand Up @@ -946,10 +946,6 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
if (!obj)
return -ENOMEM;

obj->clk = clk_get(&pdev->dev, pdata->clk_name);
if (IS_ERR(obj->clk))
goto err_clk;

obj->nr_tlb_entries = pdata->nr_tlb_entries;
obj->name = pdata->name;
obj->dev = &pdev->dev;
Expand Down Expand Up @@ -992,6 +988,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
goto err_irq;
platform_set_drvdata(pdev, obj);

pm_runtime_irq_safe(obj->dev);
pm_runtime_enable(obj->dev);

dev_info(&pdev->dev, "%s registered\n", obj->name);
return 0;

Expand All @@ -1000,8 +999,6 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
err_ioremap:
release_mem_region(res->start, resource_size(res));
err_mem:
clk_put(obj->clk);
err_clk:
kfree(obj);
return err;
}
Expand All @@ -1022,7 +1019,8 @@ static int __devexit omap_iommu_remove(struct platform_device *pdev)
release_mem_region(res->start, resource_size(res));
iounmap(obj->regbase);

clk_put(obj->clk);
pm_runtime_disable(obj->dev);

dev_info(&pdev->dev, "%s removed\n", obj->name);
kfree(obj);
return 0;
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/iommu/omap-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ struct iotlb_entry {
struct omap_iommu {
const char *name;
struct module *owner;
struct clk *clk;
void __iomem *regbase;
struct device *dev;
void *isr_priv;
Expand Down Expand Up @@ -116,8 +115,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
* MMU Register offsets
*/
#define MMU_REVISION 0x00
#define MMU_SYSCONFIG 0x10
#define MMU_SYSSTATUS 0x14
#define MMU_IRQSTATUS 0x18
#define MMU_IRQENABLE 0x1c
#define MMU_WALKING_ST 0x40
Expand Down
17 changes: 0 additions & 17 deletions trunk/drivers/iommu/omap-iommu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
*/
#define IOMMU_ARCH_VERSION 0x00000011

/* SYSCONF */
#define MMU_SYS_IDLE_SHIFT 3
#define MMU_SYS_IDLE_FORCE (0 << MMU_SYS_IDLE_SHIFT)
#define MMU_SYS_IDLE_NONE (1 << MMU_SYS_IDLE_SHIFT)
#define MMU_SYS_IDLE_SMART (2 << MMU_SYS_IDLE_SHIFT)
#define MMU_SYS_IDLE_MASK (3 << MMU_SYS_IDLE_SHIFT)

#define MMU_SYS_AUTOIDLE 1

/* IRQSTATUS & IRQENABLE */
#define MMU_IRQ_MULTIHITFAULT (1 << 4)
#define MMU_IRQ_TABLEWALKFAULT (1 << 3)
Expand Down Expand Up @@ -105,11 +96,6 @@ static int omap2_iommu_enable(struct omap_iommu *obj)
dev_info(obj->dev, "%s: version %d.%d\n", obj->name,
(l >> 4) & 0xf, l & 0xf);

l = iommu_read_reg(obj, MMU_SYSCONFIG);
l &= ~MMU_SYS_IDLE_MASK;
l |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE);
iommu_write_reg(obj, l, MMU_SYSCONFIG);

iommu_write_reg(obj, pa, MMU_TTB);

__iommu_set_twl(obj, true);
Expand All @@ -123,7 +109,6 @@ static void omap2_iommu_disable(struct omap_iommu *obj)

l &= ~MMU_CNTL_MASK;
iommu_write_reg(obj, l, MMU_CNTL);
iommu_write_reg(obj, MMU_SYS_IDLE_FORCE, MMU_SYSCONFIG);

dev_dbg(obj->dev, "%s is shutting down\n", obj->name);
}
Expand Down Expand Up @@ -252,8 +237,6 @@ omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len)
char *p = buf;

pr_reg(REVISION);
pr_reg(SYSCONFIG);
pr_reg(SYSSTATUS);
pr_reg(IRQSTATUS);
pr_reg(IRQENABLE);
pr_reg(WALKING_ST);
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/platform_data/iommu-omap.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct omap_mmu_dev_attr {

struct iommu_platform_data {
const char *name;
const char *clk_name;
const char *reset_name;
int nr_tlb_entries;
u32 da_start;
Expand Down

0 comments on commit edc32ee

Please sign in to comment.