ARM: dma-api: fix max_pfn off-by-one error in __dma_supported()
[linux/fpc-iii.git] / arch / microblaze / kernel / dma.c
blobd7bebd04247b72b797185cca5494dd7ca8755fea
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2009-2010 PetaLogix
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corporation
6 * Provide default implementations of the DMA mapping callbacks for
7 * directly mapped busses.
8 */
10 #include <linux/device.h>
11 #include <linux/dma-noncoherent.h>
12 #include <linux/gfp.h>
13 #include <linux/dma-debug.h>
14 #include <linux/export.h>
15 #include <linux/bug.h>
16 #include <asm/cacheflush.h>
18 static void __dma_sync(phys_addr_t paddr, size_t size,
19 enum dma_data_direction direction)
21 switch (direction) {
22 case DMA_TO_DEVICE:
23 case DMA_BIDIRECTIONAL:
24 flush_dcache_range(paddr, paddr + size);
25 break;
26 case DMA_FROM_DEVICE:
27 invalidate_dcache_range(paddr, paddr + size);
28 break;
29 default:
30 BUG();
34 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
35 enum dma_data_direction dir)
37 __dma_sync(paddr, size, dir);
40 void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
41 enum dma_data_direction dir)
43 __dma_sync(paddr, size, dir);