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
26 ENTRY(ox820_fiq_start)
29 ldmia r12, {r8, r9, r10}
30 and r11, r10, #0x3000000
34 beq ox820_dma_map_area
36 beq ox820_dma_unmap_area
38 ox820_dma_flush_range:
39 bic r8, r8, #D_CACHE_LINE_SIZE - 1
41 mcr p15, 0, r8, c7, c14, 1 @ clean & invalidate D line
42 add r8, r8, #D_CACHE_LINE_SIZE
49 mcr p15, 0, r8, c7, c10, 4 @ drain write buffer
54 teq r10, #DMA_FROM_DEVICE
55 beq ox820_dma_inv_range
56 teq r10, #DMA_TO_DEVICE
57 bne ox820_dma_flush_range
59 ox820_dma_clean_range:
60 bic r8, r8, #D_CACHE_LINE_SIZE - 1
62 mcr p15, 0, r8, c7, c10, 1 @ clean D line
63 add r8, r8, #D_CACHE_LINE_SIZE
70 teq r10, #DMA_TO_DEVICE
74 tst r8, #D_CACHE_LINE_SIZE - 1
75 bic r8, r8, #D_CACHE_LINE_SIZE - 1
76 mcrne p15, 0, r8, c7, c10, 1 @ clean D line
77 tst r9, #D_CACHE_LINE_SIZE - 1
78 bic r9, r9, #D_CACHE_LINE_SIZE - 1
79 mcrne p15, 0, r9, c7, c14, 1 @ clean & invalidate D line
81 mcr p15, 0, r8, c7, c6, 1 @ invalidate D line
82 add r8, r8, #D_CACHE_LINE_SIZE