spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / arch / arm / plat-omap / include / plat / iovmm.h
blob498e57cda6cd4babfebd0c474a4a71a101ff064b
1 /*
2 * omap iommu: simple virtual address space management
4 * Copyright (C) 2008-2009 Nokia Corporation
6 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __IOMMU_MMAP_H
14 #define __IOMMU_MMAP_H
16 #include <linux/iommu.h>
18 struct iovm_struct {
19 struct omap_iommu *iommu; /* iommu object which this belongs to */
20 u32 da_start; /* area definition */
21 u32 da_end;
22 u32 flags; /* IOVMF_: see below */
23 struct list_head list; /* linked in ascending order */
24 const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
25 void *va; /* mpu side mapped address */
29 * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma)
31 * lower 16 bit is used for h/w and upper 16 bit is for s/w.
33 #define IOVMF_SW_SHIFT 16
36 * iovma: h/w flags derived from cam and ram attribute
38 #define IOVMF_CAM_MASK (~((1 << 10) - 1))
39 #define IOVMF_RAM_MASK (~IOVMF_CAM_MASK)
41 #define IOVMF_PGSZ_MASK (3 << 0)
42 #define IOVMF_PGSZ_1M MMU_CAM_PGSZ_1M
43 #define IOVMF_PGSZ_64K MMU_CAM_PGSZ_64K
44 #define IOVMF_PGSZ_4K MMU_CAM_PGSZ_4K
45 #define IOVMF_PGSZ_16M MMU_CAM_PGSZ_16M
47 #define IOVMF_ENDIAN_MASK (1 << 9)
48 #define IOVMF_ENDIAN_BIG MMU_RAM_ENDIAN_BIG
49 #define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
51 #define IOVMF_ELSZ_MASK (3 << 7)
52 #define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
53 #define IOVMF_ELSZ_16 MMU_RAM_ELSZ_16
54 #define IOVMF_ELSZ_32 MMU_RAM_ELSZ_32
55 #define IOVMF_ELSZ_NONE MMU_RAM_ELSZ_NONE
57 #define IOVMF_MIXED_MASK (1 << 6)
58 #define IOVMF_MIXED MMU_RAM_MIXED
61 * iovma: s/w flags, used for mapping and umapping internally.
63 #define IOVMF_MMIO (1 << IOVMF_SW_SHIFT)
64 #define IOVMF_ALLOC (2 << IOVMF_SW_SHIFT)
65 #define IOVMF_ALLOC_MASK (3 << IOVMF_SW_SHIFT)
67 /* "superpages" is supported just with physically linear pages */
68 #define IOVMF_DISCONT (1 << (2 + IOVMF_SW_SHIFT))
69 #define IOVMF_LINEAR (2 << (2 + IOVMF_SW_SHIFT))
70 #define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT))
72 #define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT))
75 extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
76 extern u32
77 omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
78 const struct sg_table *sgt, u32 flags);
79 extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
80 struct device *dev, u32 da);
81 extern u32
82 omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
83 u32 da, size_t bytes, u32 flags);
84 extern void
85 omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
86 const u32 da);
87 extern void *omap_da_to_va(struct device *dev, u32 da);
89 #endif /* __IOMMU_MMAP_H */