2005-06-23 22:01:26 -07:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 - 2005 Tensilica Inc.
|
2015-05-25 06:55:05 +03:00
|
|
|
* Copyright (C) 2015 Cadence Design Systems Inc.
|
2005-06-23 22:01:26 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _XTENSA_DMA_MAPPING_H
|
|
|
|
#define _XTENSA_DMA_MAPPING_H
|
|
|
|
|
|
|
|
#include <asm/cache.h>
|
|
|
|
#include <asm/io.h>
|
2015-05-25 06:55:05 +03:00
|
|
|
|
|
|
|
#include <asm-generic/dma-coherent.h>
|
|
|
|
|
2005-06-23 22:01:26 -07:00
|
|
|
#include <linux/mm.h>
|
2007-10-24 13:28:40 +02:00
|
|
|
#include <linux/scatterlist.h>
|
2005-06-23 22:01:26 -07:00
|
|
|
|
2012-11-01 18:38:27 +04:00
|
|
|
#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
|
|
|
|
|
2015-05-25 06:55:05 +03:00
|
|
|
extern struct dma_map_ops xtensa_dma_map_ops;
|
2005-06-23 22:01:26 -07:00
|
|
|
|
2015-05-25 06:55:05 +03:00
|
|
|
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
|
2005-06-23 22:01:26 -07:00
|
|
|
{
|
2015-05-25 06:55:05 +03:00
|
|
|
if (dev && dev->archdata.dma_ops)
|
|
|
|
return dev->archdata.dma_ops;
|
|
|
|
else
|
|
|
|
return &xtensa_dma_map_ops;
|
2005-06-23 22:01:26 -07:00
|
|
|
}
|
|
|
|
|
2015-05-25 06:55:05 +03:00
|
|
|
#include <asm-generic/dma-mapping-common.h>
|
2005-06-23 22:01:26 -07:00
|
|
|
|
|
|
|
static inline int
|
|
|
|
dma_set_mask(struct device *dev, u64 mask)
|
|
|
|
{
|
|
|
|
if(!dev->dma_mask || !dma_supported(dev, mask))
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
*dev->dma_mask = mask;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-05-25 06:55:05 +03:00
|
|
|
void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
|
|
|
enum dma_data_direction direction);
|
2015-05-04 15:30:47 -07:00
|
|
|
|
2005-06-23 22:01:26 -07:00
|
|
|
#endif /* _XTENSA_DMA_MAPPING_H */
|