2 * Copyright (C) 2012 Gateworks Corporation
3 * Chris Lang <clang@gateworks.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/asm-offsets.h>
13 #define D_CACHE_LINE_SIZE 32
18 * R8 - DMA Start Address
22 * R12 - fiq_buffer Address
23 * R13 - DMA type Address
26 .global cns3xxx_fiq_end
27 ENTRY(cns3xxx_fiq_start)
36 ldmib r12, {r8, r9, r10}
37 and r11, r10, #0x3000000
41 beq cns3xxx_dma_map_area
43 beq cns3xxx_dma_unmap_area
44 b cns3xxx_dma_flush_range
49 mcr p15, 0, r8, c7, c10, 4 @ drain write buffer
54 teq r10, #DMA_FROM_DEVICE
55 beq cns3xxx_dma_inv_range
56 b cns3xxx_dma_clean_range
58 cns3xxx_dma_unmap_area:
60 teq r10, #DMA_TO_DEVICE
61 bne cns3xxx_dma_inv_range
64 cns3xxx_dma_flush_range:
65 bic r8, r8, #D_CACHE_LINE_SIZE - 1
67 mcr p15, 0, r8, c7, c14, 1 @ clean & invalidate D line
68 add r8, r8, #D_CACHE_LINE_SIZE
73 cns3xxx_dma_clean_range:
74 bic r8, r8, #D_CACHE_LINE_SIZE - 1
76 mcr p15, 0, r8, c7, c10, 1 @ clean D line
77 add r8, r8, #D_CACHE_LINE_SIZE
82 cns3xxx_dma_inv_range:
83 tst r8, #D_CACHE_LINE_SIZE - 1
84 bic r8, r8, #D_CACHE_LINE_SIZE - 1
85 mcrne p15, 0, r8, c7, c10, 1 @ clean D line
86 tst r9, #D_CACHE_LINE_SIZE - 1
87 bic r9, r9, #D_CACHE_LINE_SIZE - 1
88 mcrne p15, 0, r9, c7, c14, 1 @ clean & invalidate D line
90 mcr p15, 0, r8, c7, c6, 1 @ invalidate D line
91 add r8, r8, #D_CACHE_LINE_SIZE