aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/omap-iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iommu/omap-iommu.c')
-rw-r--r--drivers/iommu/omap-iommu.c39
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 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/iommu.h> 21#include <linux/iommu.h>
22#include <linux/omap-iommu.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/io.h>
24 26
25#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
26 28
27#include <plat/iommu.h> 29#include <linux/platform_data/iommu-omap.h>
28 30
29#include <plat/iopgtable.h> 31#include "omap-iopgtable.h"
32#include "omap-iommu.h"
30 33
31#define for_each_iotlb_cr(obj, n, __i, cr) \ 34#define for_each_iotlb_cr(obj, n, __i, cr) \
32 for (__i = 0; \ 35 for (__i = 0; \
@@ -51,6 +54,21 @@ struct omap_iommu_domain {
51 spinlock_t lock; 54 spinlock_t lock;
52}; 55};
53 56
57#define MMU_LOCK_BASE_SHIFT 10
58#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT)
59#define MMU_LOCK_BASE(x) \
60 ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
61
62#define MMU_LOCK_VICT_SHIFT 4
63#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT)
64#define MMU_LOCK_VICT(x) \
65 ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
66
67struct iotlb_lock {
68 short base;
69 short vict;
70};
71
54/* accommodate the difference between omap1 and omap2/3 */ 72/* accommodate the difference between omap1 and omap2/3 */
55static const struct iommu_functions *arch_iommu; 73static const struct iommu_functions *arch_iommu;
56 74
@@ -1015,6 +1033,23 @@ static void iopte_cachep_ctor(void *iopte)
1015 clean_dcache_area(iopte, IOPTE_TABLE_SIZE); 1033 clean_dcache_area(iopte, IOPTE_TABLE_SIZE);
1016} 1034}
1017 1035
1036static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa,
1037 u32 flags)
1038{
1039 memset(e, 0, sizeof(*e));
1040
1041 e->da = da;
1042 e->pa = pa;
1043 e->valid = 1;
1044 /* FIXME: add OMAP1 support */
1045 e->pgsz = flags & MMU_CAM_PGSZ_MASK;
1046 e->endian = flags & MMU_RAM_ENDIAN_MASK;
1047 e->elsz = flags & MMU_RAM_ELSZ_MASK;
1048 e->mixed = flags & MMU_RAM_MIXED_MASK;
1049
1050 return iopgsz_to_bytes(e->pgsz);
1051}
1052
1018static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, 1053static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
1019 phys_addr_t pa, size_t bytes, int prot) 1054 phys_addr_t pa, size_t bytes, int prot)
1020{ 1055{