diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-29 22:13:10 +0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-29 22:13:10 +0400 | 
| commit | b77d643ced576bdd1e918aebda869de74696cde9 (patch) | |
| tree | bb5d708f4bbb48461923a28e63a8cf8bdd477dd7 /arch/mips/include/asm/dma-mapping.h | |
| parent | b4020c1b198c0f0c0b0ff0cfdd824a26b93edd6f (diff) | |
| parent | 64575f918f3279d8487cf670dbefa956ce16a526 (diff) | |
| download | linux-b77d643ced576bdd1e918aebda869de74696cde9.tar.xz | |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (46 commits)
  ftrace/MIPS: Enable C Version of recordmcount
  ftrace/MIPS: Add module support for C version of recordmcount
  ftrace/MIPS: Add MIPS64 support for C version of recordmcount
  MIPS: Make TASK_SIZE reflect proper size for both 32 and 64 bit processes.
  MIPS: Allow UserLocal on MIPS_R1 processors
  MIPS: Honor L2 bypass bit
  MIPS: Add BMIPS CP0 register definitions
  MIPS: Add BMIPS processor types to Kconfig
  MIPS: Decouple BMIPS CPU support from bcm47xx/bcm63xx SoC code
  MIPS: Add support for hardware performance events (mipsxx)
  MIPS: Perf-events: Add callchain support
  MIPS: add support for hardware performance events (skeleton)
  MIPS: add support for software performance events
  MIPS: define local_xchg from xchg_local to atomic_long_xchg
  MIPS: AR7: Add support for Titan (TNETV10xx) SoC variant
  MIPS: AR7: Initialize GPIO earlier
  MIPS: Add platform device and Kconfig for Octeon USB EHCI / OHCI
  USB: Add EHCI and OHCH glue for OCTEON II SOCs.
  MIPS: Octeon: Add register definitions for EHCI / OHCI USB glue logic.
  MIPS: Octeon: Apply CN63XXP1 errata workarounds.
  ...
Diffstat (limited to 'arch/mips/include/asm/dma-mapping.h')
| -rw-r--r-- | arch/mips/include/asm/dma-mapping.h | 96 | 
1 files changed, 58 insertions, 38 deletions
| diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 18fbf7af8e93..655f849bd08d 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h @@ -5,51 +5,41 @@  #include <asm/cache.h>  #include <asm-generic/dma-coherent.h> -void *dma_alloc_noncoherent(struct device *dev, size_t size, -			   dma_addr_t *dma_handle, gfp_t flag); +#include <dma-coherence.h> -void dma_free_noncoherent(struct device *dev, size_t size, -			 void *vaddr, dma_addr_t dma_handle); +extern struct dma_map_ops *mips_dma_map_ops; -void *dma_alloc_coherent(struct device *dev, size_t size, -			   dma_addr_t *dma_handle, gfp_t flag); +static inline struct dma_map_ops *get_dma_ops(struct device *dev) +{ +	if (dev && dev->archdata.dma_ops) +		return dev->archdata.dma_ops; +	else +		return mips_dma_map_ops; +} -void dma_free_coherent(struct device *dev, size_t size, -			 void *vaddr, dma_addr_t dma_handle); +static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) +{ +	if (!dev->dma_mask) +		return 0; -extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, -	enum dma_data_direction direction); -extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, -	size_t size, enum dma_data_direction direction); -extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, -	enum dma_data_direction direction); -extern dma_addr_t dma_map_page(struct device *dev, struct page *page, -	unsigned long offset, size_t size, enum dma_data_direction direction); - -static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, -	size_t size, enum dma_data_direction direction) +	return addr + size <= *dev->dma_mask; +} + +static inline void dma_mark_clean(void *addr, size_t size) {} + +#include <asm-generic/dma-mapping-common.h> + +static inline int dma_supported(struct device *dev, u64 mask)  { -	dma_unmap_single(dev, dma_address, size, direction); +	struct dma_map_ops *ops = get_dma_ops(dev); +	return ops->dma_supported(dev, mask);  } -extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, -	int nhwentries, enum dma_data_direction direction); -extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, -	size_t size, enum dma_data_direction direction); -extern void dma_sync_single_for_device(struct device *dev, -	dma_addr_t dma_handle, size_t size, enum dma_data_direction direction); -extern void dma_sync_single_range_for_cpu(struct device *dev, -	dma_addr_t dma_handle, unsigned long offset, size_t size, -	enum dma_data_direction direction); -extern void dma_sync_single_range_for_device(struct device *dev, -	dma_addr_t dma_handle, unsigned long offset, size_t size, -	enum dma_data_direction direction); -extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, -	int nelems, enum dma_data_direction direction); -extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, -	int nelems, enum dma_data_direction direction); -extern int dma_mapping_error(struct device *dev, dma_addr_t dma_addr); -extern int dma_supported(struct device *dev, u64 mask); +static inline int dma_mapping_error(struct device *dev, u64 mask) +{ +	struct dma_map_ops *ops = get_dma_ops(dev); +	return ops->mapping_error(dev, mask); +}  static inline int  dma_set_mask(struct device *dev, u64 mask) @@ -65,4 +55,34 @@ dma_set_mask(struct device *dev, u64 mask)  extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,  	       enum dma_data_direction direction); +static inline void *dma_alloc_coherent(struct device *dev, size_t size, +				       dma_addr_t *dma_handle, gfp_t gfp) +{ +	void *ret; +	struct dma_map_ops *ops = get_dma_ops(dev); + +	ret = ops->alloc_coherent(dev, size, dma_handle, gfp); + +	debug_dma_alloc_coherent(dev, size, *dma_handle, ret); + +	return ret; +} + +static inline void dma_free_coherent(struct device *dev, size_t size, +				     void *vaddr, dma_addr_t dma_handle) +{ +	struct dma_map_ops *ops = get_dma_ops(dev); + +	ops->free_coherent(dev, size, vaddr, dma_handle); + +	debug_dma_free_coherent(dev, size, vaddr, dma_handle); +} + + +void *dma_alloc_noncoherent(struct device *dev, size_t size, +			   dma_addr_t *dma_handle, gfp_t flag); + +void dma_free_noncoherent(struct device *dev, size_t size, +			 void *vaddr, dma_addr_t dma_handle); +  #endif /* _ASM_DMA_MAPPING_H */ | 
