aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-06-05 07:36:22 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-06-05 07:36:22 -0400
commitbd63ce27d9d62bc40a962b991cbbbe4f0dc913d2 (patch)
treebd998b187b7ea4e9f28c0c61912b701bc6ff6420 /arch/arm/include
parent1fb333489fb917c704ad43e51b45c12f52215a9c (diff)
parent6b74f61a471ad0f3a5e919e314d4f60cd3966f5e (diff)
Merge branch 'devel-stable' into for-next
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/dma-mapping.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index e701a4d9aa59..c45b61a4b4a5 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -58,21 +58,37 @@ static inline int dma_set_mask(struct device *dev, u64 mask)
58#ifndef __arch_pfn_to_dma 58#ifndef __arch_pfn_to_dma
59static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) 59static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn)
60{ 60{
61 if (dev)
62 pfn -= dev->dma_pfn_offset;
61 return (dma_addr_t)__pfn_to_bus(pfn); 63 return (dma_addr_t)__pfn_to_bus(pfn);
62} 64}
63 65
64static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr) 66static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr)
65{ 67{
66 return __bus_to_pfn(addr); 68 unsigned long pfn = __bus_to_pfn(addr);
69
70 if (dev)
71 pfn += dev->dma_pfn_offset;
72
73 return pfn;
67} 74}
68 75
69static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) 76static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
70{ 77{
78 if (dev) {
79 unsigned long pfn = dma_to_pfn(dev, addr);
80
81 return phys_to_virt(__pfn_to_phys(pfn));
82 }
83
71 return (void *)__bus_to_virt((unsigned long)addr); 84 return (void *)__bus_to_virt((unsigned long)addr);
72} 85}
73 86
74static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) 87static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
75{ 88{
89 if (dev)
90 return pfn_to_dma(dev, virt_to_pfn(addr));
91
76 return (dma_addr_t)__virt_to_bus((unsigned long)(addr)); 92 return (dma_addr_t)__virt_to_bus((unsigned long)(addr));
77} 93}
78 94
@@ -105,6 +121,13 @@ static inline unsigned long dma_max_pfn(struct device *dev)
105} 121}
106#define dma_max_pfn(dev) dma_max_pfn(dev) 122#define dma_max_pfn(dev) dma_max_pfn(dev)
107 123
124static inline int set_arch_dma_coherent_ops(struct device *dev)
125{
126 set_dma_ops(dev, &arm_coherent_dma_ops);
127 return 0;
128}
129#define set_arch_dma_coherent_ops(dev) set_arch_dma_coherent_ops(dev)
130
108static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 131static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
109{ 132{
110 unsigned int offset = paddr & ~PAGE_MASK; 133 unsigned int offset = paddr & ~PAGE_MASK;