diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dma-debug.h | 7 | ||||
| -rw-r--r-- | include/linux/omap-iommu.h | 52 | ||||
| -rw-r--r-- | include/linux/platform_data/iommu-omap.h | 54 |
3 files changed, 113 insertions, 0 deletions
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h index 171ad8aedc8..fc0e34ce038 100644 --- a/include/linux/dma-debug.h +++ b/include/linux/dma-debug.h | |||
| @@ -39,6 +39,8 @@ extern void debug_dma_map_page(struct device *dev, struct page *page, | |||
| 39 | int direction, dma_addr_t dma_addr, | 39 | int direction, dma_addr_t dma_addr, |
| 40 | bool map_single); | 40 | bool map_single); |
| 41 | 41 | ||
| 42 | extern void debug_dma_mapping_error(struct device *dev, dma_addr_t dma_addr); | ||
| 43 | |||
| 42 | extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, | 44 | extern void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, |
| 43 | size_t size, int direction, bool map_single); | 45 | size_t size, int direction, bool map_single); |
| 44 | 46 | ||
| @@ -105,6 +107,11 @@ static inline void debug_dma_map_page(struct device *dev, struct page *page, | |||
| 105 | { | 107 | { |
| 106 | } | 108 | } |
| 107 | 109 | ||
| 110 | static inline void debug_dma_mapping_error(struct device *dev, | ||
| 111 | dma_addr_t dma_addr) | ||
| 112 | { | ||
| 113 | } | ||
| 114 | |||
| 108 | static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, | 115 | static inline void debug_dma_unmap_page(struct device *dev, dma_addr_t addr, |
| 109 | size_t size, int direction, | 116 | size_t size, int direction, |
| 110 | bool map_single) | 117 | bool map_single) |
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h new file mode 100644 index 00000000000..cac78de09c0 --- /dev/null +++ b/include/linux/omap-iommu.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | * omap iommu: simple virtual address space management | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
| 5 | * | ||
| 6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
| 7 | * | ||
| 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. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #ifndef _INTEL_IOMMU_H_ | ||
| 14 | #define _INTEL_IOMMU_H_ | ||
| 15 | |||
| 16 | struct iovm_struct { | ||
| 17 | struct omap_iommu *iommu; /* iommu object which this belongs to */ | ||
| 18 | u32 da_start; /* area definition */ | ||
| 19 | u32 da_end; | ||
| 20 | u32 flags; /* IOVMF_: see below */ | ||
| 21 | struct list_head list; /* linked in ascending order */ | ||
| 22 | const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */ | ||
| 23 | void *va; /* mpu side mapped address */ | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define MMU_RAM_ENDIAN_SHIFT 9 | ||
| 27 | #define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) | ||
| 28 | #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) | ||
| 29 | #define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE | ||
| 30 | #define MMU_RAM_ELSZ_SHIFT 7 | ||
| 31 | #define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8 | ||
| 32 | |||
| 33 | struct iommu_domain; | ||
| 34 | |||
| 35 | extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da); | ||
| 36 | extern u32 | ||
| 37 | omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, | ||
| 38 | const struct sg_table *sgt, u32 flags); | ||
| 39 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, | ||
| 40 | struct device *dev, u32 da); | ||
| 41 | extern u32 | ||
| 42 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, | ||
| 43 | u32 da, size_t bytes, u32 flags); | ||
| 44 | extern void | ||
| 45 | omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, | ||
| 46 | const u32 da); | ||
| 47 | extern void *omap_da_to_va(struct device *dev, u32 da); | ||
| 48 | |||
| 49 | extern void omap_iommu_save_ctx(struct device *dev); | ||
| 50 | extern void omap_iommu_restore_ctx(struct device *dev); | ||
| 51 | |||
| 52 | #endif | ||
diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h new file mode 100644 index 00000000000..5b429c43a29 --- /dev/null +++ b/include/linux/platform_data/iommu-omap.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * omap iommu: main structures | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2009 Nokia Corporation | ||
| 5 | * | ||
| 6 | * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | ||
| 7 | * | ||
| 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. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/platform_device.h> | ||
| 14 | |||
| 15 | #define MMU_REG_SIZE 256 | ||
| 16 | |||
| 17 | /** | ||
| 18 | * struct iommu_arch_data - omap iommu private data | ||
| 19 | * @name: name of the iommu device | ||
| 20 | * @iommu_dev: handle of the iommu device | ||
| 21 | * | ||
| 22 | * This is an omap iommu private data object, which binds an iommu user | ||
| 23 | * to its iommu device. This object should be placed at the iommu user's | ||
| 24 | * dev_archdata so generic IOMMU API can be used without having to | ||
| 25 | * utilize omap-specific plumbing anymore. | ||
| 26 | */ | ||
| 27 | struct omap_iommu_arch_data { | ||
| 28 | const char *name; | ||
| 29 | struct omap_iommu *iommu_dev; | ||
| 30 | }; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod | ||
| 34 | * @da_start: device address where the va space starts. | ||
| 35 | * @da_end: device address where the va space ends. | ||
| 36 | * @nr_tlb_entries: number of entries supported by the translation | ||
| 37 | * look-aside buffer (TLB). | ||
| 38 | */ | ||
| 39 | struct omap_mmu_dev_attr { | ||
| 40 | u32 da_start; | ||
| 41 | u32 da_end; | ||
| 42 | int nr_tlb_entries; | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct iommu_platform_data { | ||
| 46 | const char *name; | ||
| 47 | const char *reset_name; | ||
| 48 | int nr_tlb_entries; | ||
| 49 | u32 da_start; | ||
| 50 | u32 da_end; | ||
| 51 | |||
| 52 | int (*assert_reset)(struct platform_device *pdev, const char *name); | ||
| 53 | int (*deassert_reset)(struct platform_device *pdev, const char *name); | ||
| 54 | }; | ||
