1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2004 - 2007 Paul Mundt
6 #include <linux/dma-map-ops.h>
7 #include <asm/cacheflush.h>
8 #include <asm/addrspace.h>
10 void arch_dma_prep_coherent(struct page
*page
, size_t size
)
12 __flush_purge_region(page_address(page
), size
);
15 void arch_sync_dma_for_device(phys_addr_t paddr
, size_t size
,
16 enum dma_data_direction dir
)
18 void *addr
= sh_cacheop_vaddr(phys_to_virt(paddr
));
21 case DMA_FROM_DEVICE
: /* invalidate only */
22 __flush_invalidate_region(addr
, size
);
24 case DMA_TO_DEVICE
: /* writeback only */
25 __flush_wback_region(addr
, size
);
27 case DMA_BIDIRECTIONAL
: /* writeback and invalidate */
28 __flush_purge_region(addr
, size
);