dma-mapping: use unsigned long for dma_attrs
[deliverable/linux.git] / arch / microblaze / include / asm / dma-mapping.h
CommitLineData
ccfe27d7
MS
1/*
2 * Implements the generic device dma API for microblaze and the pci
3 *
4 * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009-2010 PetaLogix
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
10 *
11 * This file is base on powerpc and x86 dma-mapping.h versions
12 * Copyright (C) 2004 IBM
13 */
14
15#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
16#define _ASM_MICROBLAZE_DMA_MAPPING_H
17
18/*
395cf969 19 * See Documentation/DMA-API-HOWTO.txt and
ccfe27d7
MS
20 * Documentation/DMA-API.txt for documentation.
21 */
22
23#include <linux/types.h>
24#include <linux/cache.h>
25#include <linux/mm.h>
26#include <linux/scatterlist.h>
27#include <linux/dma-debug.h>
ccfe27d7 28#include <asm/io.h>
cf560c18 29#include <asm/cacheflush.h>
ccfe27d7
MS
30
31#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
32
33#define __dma_alloc_coherent(dev, gfp, size, handle) NULL
34#define __dma_free_coherent(size, addr) ((void)0)
ccfe27d7 35
ccfe27d7
MS
36/*
37 * Available generic sets of operations
38 */
39extern struct dma_map_ops dma_direct_ops;
40
41static inline struct dma_map_ops *get_dma_ops(struct device *dev)
42{
3b3b6853 43 return &dma_direct_ops;
ccfe27d7
MS
44}
45
cf560c18
EB
46static inline void __dma_sync(unsigned long paddr,
47 size_t size, enum dma_data_direction direction)
48{
49 switch (direction) {
50 case DMA_TO_DEVICE:
51 case DMA_BIDIRECTIONAL:
52 flush_dcache_range(paddr, paddr + size);
53 break;
54 case DMA_FROM_DEVICE:
55 invalidate_dcache_range(paddr, paddr + size);
56 break;
57 default:
58 BUG();
59 }
60}
61
ccfe27d7
MS
62static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
63 enum dma_data_direction direction)
64{
65 BUG_ON(direction == DMA_NONE);
cf560c18 66 __dma_sync(virt_to_phys(vaddr), size, (int)direction);
ccfe27d7
MS
67}
68
69#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */
This page took 0.316637 seconds and 5 git commands to generate.