[PATCH 4/6] ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c

2012-11-02 Thread Tony Lindgren
This file should not be in arch/arm. Move it to drivers/iommu
to allow making most of the header local to drivers/iommu.

This is needed as we are removing plat and mach includes
from drivers for ARM common zImage support.

Cc: Joerg Roedel j...@8bytes.org
Cc: Ohad Ben-Cohen o...@wizery.com
Cc: Ido Yariv i...@wizery.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Omar Ramirez Luna omar.l...@linaro.org
Cc: linux-me...@vger.kernel.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/Makefile|2 
 arch/arm/plat-omap/include/plat/iommu.h |  272 ++-
 drivers/iommu/Makefile  |1 
 drivers/iommu/omap-iommu-debug.c|1 
 drivers/iommu/omap-iommu.c  |   19 ++
 drivers/iommu/omap-iommu.h  |  255 +
 drivers/iommu/omap-iommu2.c |2 
 drivers/iommu/omap-iopgtable.h  |   22 ---
 drivers/iommu/omap-iovmm.c  |1 
 9 files changed, 293 insertions(+), 282 deletions(-)
 create mode 100644 drivers/iommu/omap-iommu.h
 rename arch/arm/mach-omap2/iommu2.c = drivers/iommu/omap-iommu2.c (99%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..d6721a7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -184,8 +184,6 @@ obj-$(CONFIG_HW_PERF_EVENTS)+= pmu.o
 obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
 mailbox_mach-objs  := mailbox.o
 
-obj-$(CONFIG_OMAP_IOMMU)   += iommu2.o
-
 iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
 obj-y  += $(iommu-m) $(iommu-y)
 
diff --git a/arch/arm/plat-omap/include/plat/iommu.h 
b/arch/arm/plat-omap/include/plat/iommu.h
index a4b71b1..c677b9f 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -10,103 +10,21 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __MACH_IOMMU_H
-#define __MACH_IOMMU_H
-
-#include linux/io.h
-
-#if defined(CONFIG_ARCH_OMAP1)
-#error iommu for this processor not implemented yet
-#endif
-
-struct iotlb_entry {
-   u32 da;
-   u32 pa;
-   u32 pgsz, prsvd, valid;
-   union {
-   u16 ap;
-   struct {
-   u32 endian, elsz, mixed;
-   };
-   };
-};
-
-struct omap_iommu {
-   const char  *name;
-   struct module   *owner;
-   struct clk  *clk;
-   void __iomem*regbase;
-   struct device   *dev;
-   void*isr_priv;
-   struct iommu_domain *domain;
-
-   unsigned intrefcount;
-   spinlock_t  iommu_lock; /* global for this whole object */
-
-   /*
-* We don't change iopgd for a situation like pgd for a task,
-* but share it globally for each iommu.
-*/
-   u32 *iopgd;
-   spinlock_t  page_table_lock; /* protect iopgd */
-
-   int nr_tlb_entries;
-
-   struct list_headmmap;
-   struct mutexmmap_lock; /* protect mmap */
-
-   void *ctx; /* iommu context: registres saved area */
-   u32 da_start;
-   u32 da_end;
-};
-
-struct cr_regs {
-   union {
-   struct {
-   u16 cam_l;
-   u16 cam_h;
-   };
-   u32 cam;
-   };
-   union {
-   struct {
-   u16 ram_l;
-   u16 ram_h;
-   };
-   u32 ram;
-   };
-};
-
-struct iotlb_lock {
-   short base;
-   short vict;
-};
-
-/* architecture specific functions */
-struct iommu_functions {
-   unsigned long   version;
-
-   int (*enable)(struct omap_iommu *obj);
-   void (*disable)(struct omap_iommu *obj);
-   void (*set_twl)(struct omap_iommu *obj, bool on);
-   u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
-
-   void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-   void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-
-   struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
-   struct iotlb_entry *e);
-   int (*cr_valid)(struct cr_regs *cr);
-   u32 (*cr_to_virt)(struct cr_regs *cr);
-   void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
-   ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
-   char *buf);
-
-   u32 (*get_pte_attr)(struct iotlb_entry *e);
+#define MMU_REG_SIZE   256
 
-   void (*save_ctx)(struct omap_iommu *obj);
-   void (*restore_ctx)(struct omap_iommu *obj);
-   ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
+/**
+ * struct iommu_arch_data - omap iommu private data
+ * @name: name of the 

[PATCH 4/6] ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c

2012-10-24 Thread Tony Lindgren
This file should not be in arch/arm. Move it to drivers/iommu
to allow making most of the header local to drivers/iommu.

This is needed as we are removing plat and mach includes
from drivers for ARM common zImage support.

Cc: Joerg Roedel joerg.roe...@amd.com
Cc: Ohad Ben-Cohen o...@wizery.com
Cc: Ido Yariv i...@wizery.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Omar Ramirez Luna omar.l...@linaro.org
Cc: linux-me...@vger.kernel.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/Makefile|2 
 arch/arm/plat-omap/include/plat/iommu.h |  272 ++-
 drivers/iommu/Makefile  |1 
 drivers/iommu/omap-iommu-debug.c|1 
 drivers/iommu/omap-iommu.c  |   19 ++
 drivers/iommu/omap-iommu.h  |  255 +
 drivers/iommu/omap-iommu2.c |2 
 drivers/iommu/omap-iopgtable.h  |   22 ---
 drivers/iommu/omap-iovmm.c  |1 
 9 files changed, 293 insertions(+), 282 deletions(-)
 create mode 100644 drivers/iommu/omap-iommu.h
 rename arch/arm/mach-omap2/iommu2.c = drivers/iommu/omap-iommu2.c (99%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..d6721a7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -184,8 +184,6 @@ obj-$(CONFIG_HW_PERF_EVENTS)+= pmu.o
 obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
 mailbox_mach-objs  := mailbox.o
 
-obj-$(CONFIG_OMAP_IOMMU)   += iommu2.o
-
 iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
 obj-y  += $(iommu-m) $(iommu-y)
 
diff --git a/arch/arm/plat-omap/include/plat/iommu.h 
b/arch/arm/plat-omap/include/plat/iommu.h
index a4b71b1..c677b9f 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -10,103 +10,21 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __MACH_IOMMU_H
-#define __MACH_IOMMU_H
-
-#include linux/io.h
-
-#if defined(CONFIG_ARCH_OMAP1)
-#error iommu for this processor not implemented yet
-#endif
-
-struct iotlb_entry {
-   u32 da;
-   u32 pa;
-   u32 pgsz, prsvd, valid;
-   union {
-   u16 ap;
-   struct {
-   u32 endian, elsz, mixed;
-   };
-   };
-};
-
-struct omap_iommu {
-   const char  *name;
-   struct module   *owner;
-   struct clk  *clk;
-   void __iomem*regbase;
-   struct device   *dev;
-   void*isr_priv;
-   struct iommu_domain *domain;
-
-   unsigned intrefcount;
-   spinlock_t  iommu_lock; /* global for this whole object */
-
-   /*
-* We don't change iopgd for a situation like pgd for a task,
-* but share it globally for each iommu.
-*/
-   u32 *iopgd;
-   spinlock_t  page_table_lock; /* protect iopgd */
-
-   int nr_tlb_entries;
-
-   struct list_headmmap;
-   struct mutexmmap_lock; /* protect mmap */
-
-   void *ctx; /* iommu context: registres saved area */
-   u32 da_start;
-   u32 da_end;
-};
-
-struct cr_regs {
-   union {
-   struct {
-   u16 cam_l;
-   u16 cam_h;
-   };
-   u32 cam;
-   };
-   union {
-   struct {
-   u16 ram_l;
-   u16 ram_h;
-   };
-   u32 ram;
-   };
-};
-
-struct iotlb_lock {
-   short base;
-   short vict;
-};
-
-/* architecture specific functions */
-struct iommu_functions {
-   unsigned long   version;
-
-   int (*enable)(struct omap_iommu *obj);
-   void (*disable)(struct omap_iommu *obj);
-   void (*set_twl)(struct omap_iommu *obj, bool on);
-   u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
-
-   void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-   void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-
-   struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
-   struct iotlb_entry *e);
-   int (*cr_valid)(struct cr_regs *cr);
-   u32 (*cr_to_virt)(struct cr_regs *cr);
-   void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
-   ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
-   char *buf);
-
-   u32 (*get_pte_attr)(struct iotlb_entry *e);
+#define MMU_REG_SIZE   256
 
-   void (*save_ctx)(struct omap_iommu *obj);
-   void (*restore_ctx)(struct omap_iommu *obj);
-   ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
+/**
+ * struct iommu_arch_data - omap iommu private data
+ * @name: name of 

[PATCH 4/6] ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c

2012-10-18 Thread Tony Lindgren
This file should not be in arch/arm. Move it to drivers/iommu
to allow making most of the header local to drivers/iommu.

This is needed as we are removing plat and mach includes
from drivers for ARM common zImage support.

Cc: Joerg Roedel joerg.roe...@amd.com
Cc: Ohad Ben-Cohen o...@wizery.com
Cc: Ido Yariv i...@wizery.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: Omar Ramirez Luna omar.l...@linaro.org
Cc: linux-me...@vger.kernel.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/Makefile|2 
 arch/arm/plat-omap/include/plat/iommu.h |  272 ++-
 drivers/iommu/Makefile  |1 
 drivers/iommu/omap-iommu-debug.c|1 
 drivers/iommu/omap-iommu.c  |   19 ++
 drivers/iommu/omap-iommu.h  |  255 +
 drivers/iommu/omap-iommu2.c |2 
 drivers/iommu/omap-iopgtable.h  |   22 ---
 drivers/iommu/omap-iovmm.c  |1 
 9 files changed, 293 insertions(+), 282 deletions(-)
 create mode 100644 drivers/iommu/omap-iommu.h
 rename arch/arm/mach-omap2/iommu2.c = drivers/iommu/omap-iommu2.c (99%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..d6721a7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -184,8 +184,6 @@ obj-$(CONFIG_HW_PERF_EVENTS)+= pmu.o
 obj-$(CONFIG_OMAP_MBOX_FWK)+= mailbox_mach.o
 mailbox_mach-objs  := mailbox.o
 
-obj-$(CONFIG_OMAP_IOMMU)   += iommu2.o
-
 iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
 obj-y  += $(iommu-m) $(iommu-y)
 
diff --git a/arch/arm/plat-omap/include/plat/iommu.h 
b/arch/arm/plat-omap/include/plat/iommu.h
index a4b71b1..c677b9f 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -10,103 +10,21 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __MACH_IOMMU_H
-#define __MACH_IOMMU_H
-
-#include linux/io.h
-
-#if defined(CONFIG_ARCH_OMAP1)
-#error iommu for this processor not implemented yet
-#endif
-
-struct iotlb_entry {
-   u32 da;
-   u32 pa;
-   u32 pgsz, prsvd, valid;
-   union {
-   u16 ap;
-   struct {
-   u32 endian, elsz, mixed;
-   };
-   };
-};
-
-struct omap_iommu {
-   const char  *name;
-   struct module   *owner;
-   struct clk  *clk;
-   void __iomem*regbase;
-   struct device   *dev;
-   void*isr_priv;
-   struct iommu_domain *domain;
-
-   unsigned intrefcount;
-   spinlock_t  iommu_lock; /* global for this whole object */
-
-   /*
-* We don't change iopgd for a situation like pgd for a task,
-* but share it globally for each iommu.
-*/
-   u32 *iopgd;
-   spinlock_t  page_table_lock; /* protect iopgd */
-
-   int nr_tlb_entries;
-
-   struct list_headmmap;
-   struct mutexmmap_lock; /* protect mmap */
-
-   void *ctx; /* iommu context: registres saved area */
-   u32 da_start;
-   u32 da_end;
-};
-
-struct cr_regs {
-   union {
-   struct {
-   u16 cam_l;
-   u16 cam_h;
-   };
-   u32 cam;
-   };
-   union {
-   struct {
-   u16 ram_l;
-   u16 ram_h;
-   };
-   u32 ram;
-   };
-};
-
-struct iotlb_lock {
-   short base;
-   short vict;
-};
-
-/* architecture specific functions */
-struct iommu_functions {
-   unsigned long   version;
-
-   int (*enable)(struct omap_iommu *obj);
-   void (*disable)(struct omap_iommu *obj);
-   void (*set_twl)(struct omap_iommu *obj, bool on);
-   u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
-
-   void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-   void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-
-   struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
-   struct iotlb_entry *e);
-   int (*cr_valid)(struct cr_regs *cr);
-   u32 (*cr_to_virt)(struct cr_regs *cr);
-   void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
-   ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
-   char *buf);
-
-   u32 (*get_pte_attr)(struct iotlb_entry *e);
+#define MMU_REG_SIZE   256
 
-   void (*save_ctx)(struct omap_iommu *obj);
-   void (*restore_ctx)(struct omap_iommu *obj);
-   ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
+/**
+ * struct iommu_arch_data - omap iommu private data
+ * @name: name of