diff options
author | Joerg Roedel <joro@8bytes.org> | 2012-12-03 21:40:59 +0400 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2012-12-03 21:40:59 +0400 |
commit | 18e170d03bcd17f5ccb35b271a95783f63145be7 (patch) | |
tree | 5ce68cab628b93119d4c160efc6092e1ba6fa93e /drivers/iommu/omap-iommu.c | |
parent | 9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff) | |
parent | 2ab7c84815cffd5fe4946a472fc67fefa8ac3c29 (diff) | |
download | linux-18e170d03bcd17f5ccb35b271a95783f63145be7.tar.xz |
Merge branch 'omap-for-v3.8/cleanup-headers-iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/omap
Diffstat (limited to 'drivers/iommu/omap-iommu.c')
-rw-r--r-- | drivers/iommu/omap-iommu.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d0b1234581be..badc17c2bcb4 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -19,14 +19,17 @@ #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 <asm/cacheflush.h> -#include <plat/iommu.h> +#include <linux/platform_data/iommu-omap.h> -#include <plat/iopgtable.h> +#include "omap-iopgtable.h" +#include "omap-iommu.h" #define for_each_iotlb_cr(obj, n, __i, cr) \ for (__i = 0; \ @@ -51,6 +54,21 @@ struct omap_iommu_domain { spinlock_t lock; }; +#define MMU_LOCK_BASE_SHIFT 10 +#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) +#define MMU_LOCK_BASE(x) \ + ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) + +#define MMU_LOCK_VICT_SHIFT 4 +#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) +#define MMU_LOCK_VICT(x) \ + ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) + +struct iotlb_lock { + short base; + short vict; +}; + /* accommodate the difference between omap1 and omap2/3 */ static const struct iommu_functions *arch_iommu; @@ -1015,6 +1033,23 @@ static void iopte_cachep_ctor(void *iopte) clean_dcache_area(iopte, IOPTE_TABLE_SIZE); } +static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, + u32 flags) +{ + memset(e, 0, sizeof(*e)); + + e->da = da; + e->pa = pa; + e->valid = 1; + /* FIXME: add OMAP1 support */ + e->pgsz = flags & MMU_CAM_PGSZ_MASK; + e->endian = flags & MMU_RAM_ENDIAN_MASK; + e->elsz = flags & MMU_RAM_ELSZ_MASK; + e->mixed = flags & MMU_RAM_MIXED_MASK; + + return iopgsz_to_bytes(e->pgsz); +} + static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, phys_addr_t pa, size_t bytes, int prot) { |