From c8d35c84f5494d8d294205b598f927a11fd41f34 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 2 Nov 2012 12:24:03 -0700 Subject: ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h Looks like the iommu framework does not have generic functions exported for all the needs yet. The hardware specific functions are defined in files like intel-iommu.h and amd-iommu.h. Follow the same standard for omap-iommu.h. This is needed because we are removing plat and mach includes for ARM common zImage support. Further work should continue in the iommu framework context as only pure platform data will be communicated from arch/arm/*omap*/* code to the iommu framework. Cc: Ido Yariv Cc: Laurent Pinchart Cc: Omar Ramirez Luna Cc: linux-media@vger.kernel.org Acked-by: Mauro Carvalho Chehab Acked-by: Ohad Ben-Cohen Acked-by: Joerg Roedel Signed-off-by: Tony Lindgren --- include/linux/omap-iommu.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 include/linux/omap-iommu.h (limited to 'include') 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 @@ +/* + * omap iommu: simple virtual address space management + * + * Copyright (C) 2008-2009 Nokia Corporation + * + * Written by Hiroshi DOYU + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _INTEL_IOMMU_H_ +#define _INTEL_IOMMU_H_ + +struct iovm_struct { + struct omap_iommu *iommu; /* iommu object which this belongs to */ + u32 da_start; /* area definition */ + u32 da_end; + u32 flags; /* IOVMF_: see below */ + struct list_head list; /* linked in ascending order */ + const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */ + void *va; /* mpu side mapped address */ +}; + +#define MMU_RAM_ENDIAN_SHIFT 9 +#define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT) +#define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT) +#define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE +#define MMU_RAM_ELSZ_SHIFT 7 +#define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8 + +struct iommu_domain; + +extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da); +extern u32 +omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, + const struct sg_table *sgt, u32 flags); +extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, + struct device *dev, u32 da); +extern u32 +omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, + u32 da, size_t bytes, u32 flags); +extern void +omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, + const u32 da); +extern void *omap_da_to_va(struct device *dev, u32 da); + +extern void omap_iommu_save_ctx(struct device *dev); +extern void omap_iommu_restore_ctx(struct device *dev); + +#endif -- cgit v1.2.3 From 2ab7c84815cffd5fe4946a472fc67fefa8ac3c29 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 2 Nov 2012 12:24:14 -0700 Subject: ARM: OMAP2+: Move iommu/iovmm headers to platform_data Move iommu/iovmm headers from plat/ to platform_data/ as part of the single zImage work. Partially based on an earlier version by Ido Yariv . Cc: Ido Yariv Cc: Laurent Pinchart Cc: Omar Ramirez Luna Acked-by: Mauro Carvalho Chehab Acked-by: Ohad Ben-Cohen Acked-by: Joerg Roedel Signed-off-by: Tony Lindgren --- include/linux/platform_data/iommu-omap.h | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 include/linux/platform_data/iommu-omap.h (limited to 'include') diff --git a/include/linux/platform_data/iommu-omap.h b/include/linux/platform_data/iommu-omap.h new file mode 100644 index 00000000000..c677b9f2fef --- /dev/null +++ b/include/linux/platform_data/iommu-omap.h @@ -0,0 +1,49 @@ +/* + * omap iommu: main structures + * + * Copyright (C) 2008-2009 Nokia Corporation + * + * Written by Hiroshi DOYU + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define MMU_REG_SIZE 256 + +/** + * struct iommu_arch_data - omap iommu private data + * @name: name of the iommu device + * @iommu_dev: handle of the iommu device + * + * This is an omap iommu private data object, which binds an iommu user + * to its iommu device. This object should be placed at the iommu user's + * dev_archdata so generic IOMMU API can be used without having to + * utilize omap-specific plumbing anymore. + */ +struct omap_iommu_arch_data { + const char *name; + struct omap_iommu *iommu_dev; +}; + +/** + * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod + * @da_start: device address where the va space starts. + * @da_end: device address where the va space ends. + * @nr_tlb_entries: number of entries supported by the translation + * look-aside buffer (TLB). + */ +struct omap_mmu_dev_attr { + u32 da_start; + u32 da_end; + int nr_tlb_entries; +}; + +struct iommu_platform_data { + const char *name; + const char *clk_name; + const int nr_tlb_entries; + u32 da_start; + u32 da_end; +}; -- cgit v1.2.3