ARM: dma-mapping: provide per-cpu type map/unmap functions
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 26 Nov 2009 16:19:58 +0000 (16:19 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 15 Feb 2010 15:22:20 +0000 (15:22 +0000)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-By: Santosh Shilimkar <santosh.shilimkar@ti.com>
24 files changed:
arch/arm/include/asm/cacheflush.h
arch/arm/kernel/asm-offsets.c
arch/arm/mm/cache-fa.S
arch/arm/mm/cache-v3.S
arch/arm/mm/cache-v4.S
arch/arm/mm/cache-v4wb.S
arch/arm/mm/cache-v4wt.S
arch/arm/mm/cache-v6.S
arch/arm/mm/cache-v7.S
arch/arm/mm/dma-mapping.c
arch/arm/mm/proc-arm1020.S
arch/arm/mm/proc-arm1020e.S
arch/arm/mm/proc-arm1022.S
arch/arm/mm/proc-arm1026.S
arch/arm/mm/proc-arm920.S
arch/arm/mm/proc-arm922.S
arch/arm/mm/proc-arm925.S
arch/arm/mm/proc-arm926.S
arch/arm/mm/proc-arm940.S
arch/arm/mm/proc-arm946.S
arch/arm/mm/proc-feroceon.S
arch/arm/mm/proc-mohawk.S
arch/arm/mm/proc-xsc3.S
arch/arm/mm/proc-xscale.S

index 730aefcfbee3eb8e0c46ea0a6dc0b9ba0fd1e27f..4c733236e3424724249bc5bca557ecf83e328db6 100644 (file)
@@ -213,6 +213,9 @@ struct cpu_cache_fns {
        void (*coherent_user_range)(unsigned long, unsigned long);
        void (*flush_kern_dcache_area)(void *, size_t);
 
+       void (*dma_map_area)(const void *, size_t, int);
+       void (*dma_unmap_area)(const void *, size_t, int);
+
        void (*dma_inv_range)(const void *, const void *);
        void (*dma_clean_range)(const void *, const void *);
        void (*dma_flush_range)(const void *, const void *);
@@ -244,6 +247,8 @@ extern struct cpu_cache_fns cpu_cache;
  * is visible to DMA, or data written by DMA to system memory is
  * visible to the CPU.
  */
+#define dmac_map_area                  cpu_cache.dma_map_area
+#define dmac_unmap_area                cpu_cache.dma_unmap_area
 #define dmac_inv_range                 cpu_cache.dma_inv_range
 #define dmac_clean_range               cpu_cache.dma_clean_range
 #define dmac_flush_range               cpu_cache.dma_flush_range
@@ -270,10 +275,14 @@ extern void __cpuc_flush_dcache_area(void *, size_t);
  * is visible to DMA, or data written by DMA to system memory is
  * visible to the CPU.
  */
+#define dmac_map_area                  __glue(_CACHE,_dma_map_area)
+#define dmac_unmap_area                __glue(_CACHE,_dma_unmap_area)
 #define dmac_inv_range                 __glue(_CACHE,_dma_inv_range)
 #define dmac_clean_range               __glue(_CACHE,_dma_clean_range)
 #define dmac_flush_range               __glue(_CACHE,_dma_flush_range)
 
+extern void dmac_map_area(const void *, size_t, int);
+extern void dmac_unmap_area(const void *, size_t, int);
 extern void dmac_inv_range(const void *, const void *);
 extern void dmac_clean_range(const void *, const void *);
 extern void dmac_flush_range(const void *, const void *);
index 4a881258bb171f7c14828d12fdc4ef9bf91b0186..883511522fca9e83be970c2611fd2ce5a1a75a41 100644 (file)
@@ -12,6 +12,7 @@
  */
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/dma-mapping.h>
 #include <asm/mach/arch.h>
 #include <asm/thread_info.h>
 #include <asm/memory.h>
@@ -112,5 +113,9 @@ int main(void)
 #ifdef MULTI_PABORT
   DEFINE(PROCESSOR_PABT_FUNC,  offsetof(struct processor, _prefetch_abort));
 #endif
+  BLANK();
+  DEFINE(DMA_BIDIRECTIONAL,    DMA_BIDIRECTIONAL);
+  DEFINE(DMA_TO_DEVICE,                DMA_TO_DEVICE);
+  DEFINE(DMA_FROM_DEVICE,      DMA_FROM_DEVICE);
   return 0; 
 }
index a89444a3c016f0c2ecee35d38655b109664bc91b..8ebffdd6fcff896b59f4d587190da87ab2c81124 100644 (file)
@@ -205,6 +205,30 @@ ENTRY(fa_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain write buffer
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(fa_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     fa_dma_clean_range
+       bcs     fa_dma_inv_range
+       b       fa_dma_flush_range
+ENDPROC(fa_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(fa_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(fa_dma_unmap_area)
+
        __INITDATA
 
        .type   fa_cache_fns, #object
@@ -215,6 +239,8 @@ ENTRY(fa_cache_fns)
        .long   fa_coherent_kern_range
        .long   fa_coherent_user_range
        .long   fa_flush_kern_dcache_area
+       .long   fa_dma_map_area
+       .long   fa_dma_unmap_area
        .long   fa_dma_inv_range
        .long   fa_dma_clean_range
        .long   fa_dma_flush_range
index 2a482731ea36914f2f6ca2b6bb4299e7dee84742..6df52dc014bea2f618097602315ee63dbfb8abf6 100644 (file)
@@ -121,6 +121,28 @@ ENTRY(v3_dma_flush_range)
 ENTRY(v3_dma_clean_range)
        mov     pc, lr
 
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v3_dma_unmap_area)
+       teq     r2, #DMA_TO_DEVICE
+       bne     v3_dma_inv_range
+       /* FALLTHROUGH */
+
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v3_dma_map_area)
+       mov     pc, lr
+ENDPROC(v3_dma_unmap_area)
+ENDPROC(v3_dma_map_area)
+
        __INITDATA
 
        .type   v3_cache_fns, #object
@@ -131,6 +153,8 @@ ENTRY(v3_cache_fns)
        .long   v3_coherent_kern_range
        .long   v3_coherent_user_range
        .long   v3_flush_kern_dcache_area
+       .long   v3_dma_map_area
+       .long   v3_dma_unmap_area
        .long   v3_dma_inv_range
        .long   v3_dma_clean_range
        .long   v3_dma_flush_range
index 5c7da3e372e94faa6f85a07b2c154730140f44b6..df3b423713b9f77904d0043d4f0bcc7a3bdec081 100644 (file)
@@ -133,6 +133,28 @@ ENTRY(v4_dma_flush_range)
 ENTRY(v4_dma_clean_range)
        mov     pc, lr
 
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4_dma_unmap_area)
+       teq     r2, #DMA_TO_DEVICE
+       bne     v4_dma_inv_range
+       /* FALLTHROUGH */
+
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4_dma_map_area)
+       mov     pc, lr
+ENDPROC(v4_dma_unmap_area)
+ENDPROC(v4_dma_map_area)
+
        __INITDATA
 
        .type   v4_cache_fns, #object
@@ -143,6 +165,8 @@ ENTRY(v4_cache_fns)
        .long   v4_coherent_kern_range
        .long   v4_coherent_user_range
        .long   v4_flush_kern_dcache_area
+       .long   v4_dma_map_area
+       .long   v4_dma_unmap_area
        .long   v4_dma_inv_range
        .long   v4_dma_clean_range
        .long   v4_dma_flush_range
index 3dbedf1ec0e7790612385b34def041378af5f0d9..32e7a744849661aadc5f980f47af97644fcf9ee3 100644 (file)
@@ -216,6 +216,30 @@ ENTRY(v4wb_dma_clean_range)
        .globl  v4wb_dma_flush_range
        .set    v4wb_dma_flush_range, v4wb_coherent_kern_range
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4wb_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     v4wb_dma_clean_range
+       bcs     v4wb_dma_inv_range
+       b       v4wb_dma_flush_range
+ENDPROC(v4wb_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4wb_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(v4wb_dma_unmap_area)
+
        __INITDATA
 
        .type   v4wb_cache_fns, #object
@@ -226,6 +250,8 @@ ENTRY(v4wb_cache_fns)
        .long   v4wb_coherent_kern_range
        .long   v4wb_coherent_user_range
        .long   v4wb_flush_kern_dcache_area
+       .long   v4wb_dma_map_area
+       .long   v4wb_dma_unmap_area
        .long   v4wb_dma_inv_range
        .long   v4wb_dma_clean_range
        .long   v4wb_dma_flush_range
index b3b7410270b48e6bf3414de930e2eff0010cf6b3..3d8dad5b2650baccbc059e08374bd82df7a01494 100644 (file)
@@ -172,6 +172,29 @@ ENTRY(v4wt_dma_clean_range)
        .globl  v4wt_dma_flush_range
        .equ    v4wt_dma_flush_range, v4wt_dma_inv_range
 
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4wt_dma_unmap_area)
+       add     r1, r1, r0
+       teq     r2, #DMA_TO_DEVICE
+       bne     v4wt_dma_inv_range
+       /* FALLTHROUGH */
+
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v4wt_dma_map_area)
+       mov     pc, lr
+ENDPROC(v4wt_dma_unmap_area)
+ENDPROC(v4wt_dma_map_area)
+
        __INITDATA
 
        .type   v4wt_cache_fns, #object
@@ -182,6 +205,8 @@ ENTRY(v4wt_cache_fns)
        .long   v4wt_coherent_kern_range
        .long   v4wt_coherent_user_range
        .long   v4wt_flush_kern_dcache_area
+       .long   v4wt_dma_map_area
+       .long   v4wt_dma_unmap_area
        .long   v4wt_dma_inv_range
        .long   v4wt_dma_clean_range
        .long   v4wt_dma_flush_range
index 4ba0a24ce6f58341bcf0a78aef56531709e7b774..6f926dd0e0f7c29679bc421494f1c82f7c33794f 100644 (file)
@@ -263,6 +263,30 @@ ENTRY(v6_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain write buffer
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v6_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     v6_dma_clean_range
+       bcs     v6_dma_inv_range
+       b       v6_dma_flush_range
+ENDPROC(v6_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v6_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(v6_dma_unmap_area)
+
        __INITDATA
 
        .type   v6_cache_fns, #object
@@ -273,6 +297,8 @@ ENTRY(v6_cache_fns)
        .long   v6_coherent_kern_range
        .long   v6_coherent_user_range
        .long   v6_flush_kern_dcache_area
+       .long   v6_dma_map_area
+       .long   v6_dma_unmap_area
        .long   v6_dma_inv_range
        .long   v6_dma_clean_range
        .long   v6_dma_flush_range
index 9073db849fb46a75f08c18c1ae9790614696e377..e30d8bc6718228e368522a16fea7af36c17a7b73 100644 (file)
@@ -271,6 +271,30 @@ ENTRY(v7_dma_flush_range)
        mov     pc, lr
 ENDPROC(v7_dma_flush_range)
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v7_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     v7_dma_clean_range
+       bcs     v7_dma_inv_range
+       b       v7_dma_flush_range
+ENDPROC(v7_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(v7_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(v7_dma_unmap_area)
+
        __INITDATA
 
        .type   v7_cache_fns, #object
@@ -281,6 +305,8 @@ ENTRY(v7_cache_fns)
        .long   v7_coherent_kern_range
        .long   v7_coherent_user_range
        .long   v7_flush_kern_dcache_area
+       .long   v7_dma_map_area
+       .long   v7_dma_unmap_area
        .long   v7_dma_inv_range
        .long   v7_dma_clean_range
        .long   v7_dma_flush_range
index 0d68d2c83cdab66f95c4c3b64ed807510c432b75..efa8efa33f5ec91509b5969763379c583dcda4d8 100644 (file)
@@ -406,35 +406,31 @@ EXPORT_SYMBOL(dma_free_coherent);
  */
 static void dma_cache_maint(const void *start, size_t size, int direction)
 {
-       void (*inner_op)(const void *, const void *);
        void (*outer_op)(unsigned long, unsigned long);
 
-       BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(start + size - 1));
-
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               inner_op = dmac_inv_range;
                outer_op = outer_inv_range;
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               inner_op = dmac_clean_range;
                outer_op = outer_clean_range;
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               inner_op = dmac_flush_range;
                outer_op = outer_flush_range;
                break;
        default:
                BUG();
        }
 
-       inner_op(start, start + size);
        outer_op(__pa(start), __pa(start) + size);
 }
 
 void ___dma_single_cpu_to_dev(const void *kaddr, size_t size,
        enum dma_data_direction dir)
 {
+       BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1));
+
+       dmac_map_area(kaddr, size, dir);
        dma_cache_maint(kaddr, size, dir);
 }
 EXPORT_SYMBOL(___dma_single_cpu_to_dev);
@@ -442,12 +438,15 @@ EXPORT_SYMBOL(___dma_single_cpu_to_dev);
 void ___dma_single_dev_to_cpu(const void *kaddr, size_t size,
        enum dma_data_direction dir)
 {
-       /* nothing to do */
+       BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1));
+
+       dmac_unmap_area(kaddr, size, dir);
 }
 EXPORT_SYMBOL(___dma_single_dev_to_cpu);
 
 static void dma_cache_maint_page(struct page *page, unsigned long offset,
-       size_t size, void (*op)(const void *, const void *))
+       size_t size, enum dma_data_direction dir,
+       void (*op)(const void *, size_t, int))
 {
        /*
         * A single sg entry may refer to multiple physically contiguous
@@ -471,12 +470,12 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
                        vaddr = kmap_high_get(page);
                        if (vaddr) {
                                vaddr += offset;
-                               op(vaddr, vaddr + len);
+                               op(vaddr, len, dir);
                                kunmap_high(page);
                        }
                } else {
                        vaddr = page_address(page) + offset;
-                       op(vaddr, vaddr + len);
+                       op(vaddr, len, dir);
                }
                offset = 0;
                page++;
@@ -488,27 +487,23 @@ void ___dma_page_cpu_to_dev(struct page *page, unsigned long off,
        size_t size, enum dma_data_direction dir)
 {
        unsigned long paddr;
-       void (*inner_op)(const void *, const void *);
        void (*outer_op)(unsigned long, unsigned long);
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               inner_op = dmac_inv_range;
                outer_op = outer_inv_range;
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               inner_op = dmac_clean_range;
                outer_op = outer_clean_range;
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               inner_op = dmac_flush_range;
                outer_op = outer_flush_range;
                break;
        default:
                BUG();
        }
 
-       dma_cache_maint_page(page, off, size, inner_op);
+       dma_cache_maint_page(page, off, size, dir, dmac_map_area);
 
        paddr = page_to_phys(page) + off;
        outer_op(paddr, paddr + size);
@@ -518,7 +513,7 @@ EXPORT_SYMBOL(___dma_page_cpu_to_dev);
 void ___dma_page_dev_to_cpu(struct page *page, unsigned long off,
        size_t size, enum dma_data_direction dir)
 {
-       /* nothing to do */
+       dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
 }
 EXPORT_SYMBOL(___dma_page_dev_to_cpu);
 
index 8012e24282b2d0ffbbab5a38cd963c6cb9acf6e5..c85f5eb426347f1bb5ebe65fe564d427e0784f25 100644 (file)
@@ -330,6 +330,30 @@ ENTRY(arm1020_dma_flush_range)
        mcr     p15, 0, ip, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1020_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm1020_dma_clean_range
+       bcs     arm1020_dma_inv_range
+       b       arm1020_dma_flush_range
+ENDPROC(arm1020_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1020_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm1020_dma_unmap_area)
+
 ENTRY(arm1020_cache_fns)
        .long   arm1020_flush_kern_cache_all
        .long   arm1020_flush_user_cache_all
@@ -337,6 +361,8 @@ ENTRY(arm1020_cache_fns)
        .long   arm1020_coherent_kern_range
        .long   arm1020_coherent_user_range
        .long   arm1020_flush_kern_dcache_area
+       .long   arm1020_dma_map_area
+       .long   arm1020_dma_unmap_area
        .long   arm1020_dma_inv_range
        .long   arm1020_dma_clean_range
        .long   arm1020_dma_flush_range
index 41fe25d234f50b76b563c6b5516a258d45c014fe..5a3cf7620a2cba53032a12eb1384fbf387b9e8ad 100644 (file)
@@ -316,6 +316,30 @@ ENTRY(arm1020e_dma_flush_range)
        mcr     p15, 0, ip, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1020e_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm1020e_dma_clean_range
+       bcs     arm1020e_dma_inv_range
+       b       arm1020e_dma_flush_range
+ENDPROC(arm1020e_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1020e_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm1020e_dma_unmap_area)
+
 ENTRY(arm1020e_cache_fns)
        .long   arm1020e_flush_kern_cache_all
        .long   arm1020e_flush_user_cache_all
@@ -323,6 +347,8 @@ ENTRY(arm1020e_cache_fns)
        .long   arm1020e_coherent_kern_range
        .long   arm1020e_coherent_user_range
        .long   arm1020e_flush_kern_dcache_area
+       .long   arm1020e_dma_map_area
+       .long   arm1020e_dma_unmap_area
        .long   arm1020e_dma_inv_range
        .long   arm1020e_dma_clean_range
        .long   arm1020e_dma_flush_range
index 20a5b1b31a706051ac2c1b6cb58b293b3b2794a2..fec8f58784388e4fab5ee873dbf3fab5ff7d1896 100644 (file)
@@ -305,6 +305,30 @@ ENTRY(arm1022_dma_flush_range)
        mcr     p15, 0, ip, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1022_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm1022_dma_clean_range
+       bcs     arm1022_dma_inv_range
+       b       arm1022_dma_flush_range
+ENDPROC(arm1022_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1022_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm1022_dma_unmap_area)
+
 ENTRY(arm1022_cache_fns)
        .long   arm1022_flush_kern_cache_all
        .long   arm1022_flush_user_cache_all
@@ -312,6 +336,8 @@ ENTRY(arm1022_cache_fns)
        .long   arm1022_coherent_kern_range
        .long   arm1022_coherent_user_range
        .long   arm1022_flush_kern_dcache_area
+       .long   arm1022_dma_map_area
+       .long   arm1022_dma_unmap_area
        .long   arm1022_dma_inv_range
        .long   arm1022_dma_clean_range
        .long   arm1022_dma_flush_range
index 96aedb10fcc418c528f536fb9a06f77185a3fa9c..9ece6f666497b0974516b7a05de7ff35666f4a46 100644 (file)
@@ -299,6 +299,30 @@ ENTRY(arm1026_dma_flush_range)
        mcr     p15, 0, ip, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1026_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm1026_dma_clean_range
+       bcs     arm1026_dma_inv_range
+       b       arm1026_dma_flush_range
+ENDPROC(arm1026_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm1026_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm1026_dma_unmap_area)
+
 ENTRY(arm1026_cache_fns)
        .long   arm1026_flush_kern_cache_all
        .long   arm1026_flush_user_cache_all
@@ -306,6 +330,8 @@ ENTRY(arm1026_cache_fns)
        .long   arm1026_coherent_kern_range
        .long   arm1026_coherent_user_range
        .long   arm1026_flush_kern_dcache_area
+       .long   arm1026_dma_map_area
+       .long   arm1026_dma_unmap_area
        .long   arm1026_dma_inv_range
        .long   arm1026_dma_clean_range
        .long   arm1026_dma_flush_range
index 471669e2d7cb458567d9233a805dd8ce772bf719..6f6ab2747da62a9bd64a7c3f43f61f0eacb982ec 100644 (file)
@@ -288,6 +288,30 @@ ENTRY(arm920_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm920_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm920_dma_clean_range
+       bcs     arm920_dma_inv_range
+       b       arm920_dma_flush_range
+ENDPROC(arm920_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm920_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm920_dma_unmap_area)
+
 ENTRY(arm920_cache_fns)
        .long   arm920_flush_kern_cache_all
        .long   arm920_flush_user_cache_all
@@ -295,6 +319,8 @@ ENTRY(arm920_cache_fns)
        .long   arm920_coherent_kern_range
        .long   arm920_coherent_user_range
        .long   arm920_flush_kern_dcache_area
+       .long   arm920_dma_map_area
+       .long   arm920_dma_unmap_area
        .long   arm920_dma_inv_range
        .long   arm920_dma_clean_range
        .long   arm920_dma_flush_range
index ee111b00fa41951619593c758fe22eb06a4e4ee4..4e4396b121ca800b77b70102c46d8faa8158fa9c 100644 (file)
@@ -290,6 +290,30 @@ ENTRY(arm922_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm922_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm922_dma_clean_range
+       bcs     arm922_dma_inv_range
+       b       arm922_dma_flush_range
+ENDPROC(arm922_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm922_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm922_dma_unmap_area)
+
 ENTRY(arm922_cache_fns)
        .long   arm922_flush_kern_cache_all
        .long   arm922_flush_user_cache_all
@@ -297,6 +321,8 @@ ENTRY(arm922_cache_fns)
        .long   arm922_coherent_kern_range
        .long   arm922_coherent_user_range
        .long   arm922_flush_kern_dcache_area
+       .long   arm922_dma_map_area
+       .long   arm922_dma_unmap_area
        .long   arm922_dma_inv_range
        .long   arm922_dma_clean_range
        .long   arm922_dma_flush_range
index 8deb5bde58e4883765e1d7bb6b81b10e0388911b..7c01c5d1108c7585e484afa58dfada81b579d4bb 100644 (file)
@@ -341,6 +341,30 @@ ENTRY(arm925_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm925_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm925_dma_clean_range
+       bcs     arm925_dma_inv_range
+       b       arm925_dma_flush_range
+ENDPROC(arm925_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm925_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm925_dma_unmap_area)
+
 ENTRY(arm925_cache_fns)
        .long   arm925_flush_kern_cache_all
        .long   arm925_flush_user_cache_all
@@ -348,6 +372,8 @@ ENTRY(arm925_cache_fns)
        .long   arm925_coherent_kern_range
        .long   arm925_coherent_user_range
        .long   arm925_flush_kern_dcache_area
+       .long   arm925_dma_map_area
+       .long   arm925_dma_unmap_area
        .long   arm925_dma_inv_range
        .long   arm925_dma_clean_range
        .long   arm925_dma_flush_range
index 64db6e275a442f610239fe9b692753c4d88d14f9..72a01a4b80ab7c1696bce29253eedf722181db68 100644 (file)
@@ -304,6 +304,30 @@ ENTRY(arm926_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm926_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm926_dma_clean_range
+       bcs     arm926_dma_inv_range
+       b       arm926_dma_flush_range
+ENDPROC(arm926_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm926_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm926_dma_unmap_area)
+
 ENTRY(arm926_cache_fns)
        .long   arm926_flush_kern_cache_all
        .long   arm926_flush_user_cache_all
@@ -311,6 +335,8 @@ ENTRY(arm926_cache_fns)
        .long   arm926_coherent_kern_range
        .long   arm926_coherent_user_range
        .long   arm926_flush_kern_dcache_area
+       .long   arm926_dma_map_area
+       .long   arm926_dma_unmap_area
        .long   arm926_dma_inv_range
        .long   arm926_dma_clean_range
        .long   arm926_dma_flush_range
index 8196b9f401fb53f17cd0a215c384a872330e054d..6bb58fca7270d6d6352e5b765a7064ff6d5b0809 100644 (file)
@@ -233,6 +233,30 @@ ENTRY(arm940_dma_flush_range)
        mcr     p15, 0, ip, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm940_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm940_dma_clean_range
+       bcs     arm940_dma_inv_range
+       b       arm940_dma_flush_range
+ENDPROC(arm940_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm940_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm940_dma_unmap_area)
+
 ENTRY(arm940_cache_fns)
        .long   arm940_flush_kern_cache_all
        .long   arm940_flush_user_cache_all
@@ -240,6 +264,8 @@ ENTRY(arm940_cache_fns)
        .long   arm940_coherent_kern_range
        .long   arm940_coherent_user_range
        .long   arm940_flush_kern_dcache_area
+       .long   arm940_dma_map_area
+       .long   arm940_dma_unmap_area
        .long   arm940_dma_inv_range
        .long   arm940_dma_clean_range
        .long   arm940_dma_flush_range
index 9a951239c86c0a1b93dcefdf6687312b6c3c51c7..ac0f9ba719d70676de1e61955659dd93f9fdf148 100644 (file)
@@ -275,6 +275,30 @@ ENTRY(arm946_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm946_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     arm946_dma_clean_range
+       bcs     arm946_dma_inv_range
+       b       arm946_dma_flush_range
+ENDPROC(arm946_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(arm946_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(arm946_dma_unmap_area)
+
 ENTRY(arm946_cache_fns)
        .long   arm946_flush_kern_cache_all
        .long   arm946_flush_user_cache_all
@@ -282,6 +306,8 @@ ENTRY(arm946_cache_fns)
        .long   arm946_coherent_kern_range
        .long   arm946_coherent_user_range
        .long   arm946_flush_kern_dcache_area
+       .long   arm946_dma_map_area
+       .long   arm946_dma_unmap_area
        .long   arm946_dma_inv_range
        .long   arm946_dma_clean_range
        .long   arm946_dma_flush_range
index dbc39383e66aaf0d2ec0e5865f15e21dafb02ec7..97e1d784f152364df1d43611c953fb0f405493c2 100644 (file)
@@ -367,6 +367,44 @@ ENTRY(feroceon_range_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(feroceon_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     feroceon_dma_clean_range
+       bcs     feroceon_dma_inv_range
+       b       feroceon_dma_flush_range
+ENDPROC(feroceon_dma_map_area)
+
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(feroceon_range_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     feroceon_range_dma_clean_range
+       bcs     feroceon_range_dma_inv_range
+       b       feroceon_range_dma_flush_range
+ENDPROC(feroceon_range_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(feroceon_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(feroceon_dma_unmap_area)
+
 ENTRY(feroceon_cache_fns)
        .long   feroceon_flush_kern_cache_all
        .long   feroceon_flush_user_cache_all
@@ -374,6 +412,8 @@ ENTRY(feroceon_cache_fns)
        .long   feroceon_coherent_kern_range
        .long   feroceon_coherent_user_range
        .long   feroceon_flush_kern_dcache_area
+       .long   feroceon_dma_map_area
+       .long   feroceon_dma_unmap_area
        .long   feroceon_dma_inv_range
        .long   feroceon_dma_clean_range
        .long   feroceon_dma_flush_range
@@ -385,6 +425,8 @@ ENTRY(feroceon_range_cache_fns)
        .long   feroceon_coherent_kern_range
        .long   feroceon_coherent_user_range
        .long   feroceon_range_flush_kern_dcache_area
+       .long   feroceon_range_dma_map_area
+       .long   feroceon_dma_unmap_area
        .long   feroceon_range_dma_inv_range
        .long   feroceon_range_dma_clean_range
        .long   feroceon_range_dma_flush_range
index 9674d36cc97d4c1a6489599d2047b3c29ef58110..55b7fbec65489a777fc89b5c259100b24fb46d2d 100644 (file)
@@ -268,6 +268,30 @@ ENTRY(mohawk_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ drain WB
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(mohawk_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     mohawk_dma_clean_range
+       bcs     mohawk_dma_inv_range
+       b       mohawk_dma_flush_range
+ENDPROC(mohawk_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(mohawk_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(mohawk_dma_unmap_area)
+
 ENTRY(mohawk_cache_fns)
        .long   mohawk_flush_kern_cache_all
        .long   mohawk_flush_user_cache_all
@@ -275,6 +299,8 @@ ENTRY(mohawk_cache_fns)
        .long   mohawk_coherent_kern_range
        .long   mohawk_coherent_user_range
        .long   mohawk_flush_kern_dcache_area
+       .long   mohawk_dma_map_area
+       .long   mohawk_dma_unmap_area
        .long   mohawk_dma_inv_range
        .long   mohawk_dma_clean_range
        .long   mohawk_dma_flush_range
index 96456f5487986f349513b154be2ed22de1bd9eab..4e4ce889b3e6cc7fdd5c7d7419f7940ff2ad9bbb 100644 (file)
@@ -304,6 +304,30 @@ ENTRY(xsc3_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ data write barrier
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(xsc3_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     xsc3_dma_clean_range
+       bcs     xsc3_dma_inv_range
+       b       xsc3_dma_flush_range
+ENDPROC(xsc3_dma_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(xsc3_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(xsc3_dma_unmap_area)
+
 ENTRY(xsc3_cache_fns)
        .long   xsc3_flush_kern_cache_all
        .long   xsc3_flush_user_cache_all
@@ -311,6 +335,8 @@ ENTRY(xsc3_cache_fns)
        .long   xsc3_coherent_kern_range
        .long   xsc3_coherent_user_range
        .long   xsc3_flush_kern_dcache_area
+       .long   xsc3_dma_map_area
+       .long   xsc3_dma_unmap_area
        .long   xsc3_dma_inv_range
        .long   xsc3_dma_clean_range
        .long   xsc3_dma_flush_range
index 93df47265f2dfda487fcb7c11425d14b0a9ea02f..a7999f94bf276a1fc197de4dcb06679a836240c0 100644 (file)
@@ -363,6 +363,43 @@ ENTRY(xscale_dma_flush_range)
        mcr     p15, 0, r0, c7, c10, 4          @ Drain Write (& Fill) Buffer
        mov     pc, lr
 
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(xscale_dma_map_area)
+       add     r1, r1, r0
+       cmp     r2, #DMA_TO_DEVICE
+       beq     xscale_dma_clean_range
+       bcs     xscale_dma_inv_range
+       b       xscale_dma_flush_range
+ENDPROC(xscale_dma_map_area)
+
+/*
+ *     dma_map_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(xscale_dma_a0_map_area)
+       add     r1, r1, r0
+       teq     r2, #DMA_TO_DEVICE
+       beq     xscale_dma_clean_range
+       b       xscale_dma_flush_range
+ENDPROC(xscsale_dma_a0_map_area)
+
+/*
+ *     dma_unmap_area(start, size, dir)
+ *     - start - kernel virtual start address
+ *     - size  - size of region
+ *     - dir   - DMA direction
+ */
+ENTRY(xscale_dma_unmap_area)
+       mov     pc, lr
+ENDPROC(xscale_dma_unmap_area)
+
 ENTRY(xscale_cache_fns)
        .long   xscale_flush_kern_cache_all
        .long   xscale_flush_user_cache_all
@@ -370,6 +407,8 @@ ENTRY(xscale_cache_fns)
        .long   xscale_coherent_kern_range
        .long   xscale_coherent_user_range
        .long   xscale_flush_kern_dcache_area
+       .long   xscale_dma_map_area
+       .long   xscale_dma_unmap_area
        .long   xscale_dma_inv_range
        .long   xscale_dma_clean_range
        .long   xscale_dma_flush_range
@@ -394,6 +433,8 @@ ENTRY(xscale_80200_A0_A1_cache_fns)
        .long   xscale_coherent_kern_range
        .long   xscale_coherent_user_range
        .long   xscale_flush_kern_dcache_area
+       .long   xscale_dma_a0_map_area
+       .long   xscale_dma_unmap_area
        .long   xscale_dma_flush_range
        .long   xscale_dma_clean_range
        .long   xscale_dma_flush_range