1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_ARM_DMA_DIRECT_H
3 #define ASM_ARM_DMA_DIRECT_H 1
5 static inline dma_addr_t
phys_to_dma(struct device
*dev
, phys_addr_t paddr
)
7 unsigned int offset
= paddr
& ~PAGE_MASK
;
8 return pfn_to_dma(dev
, __phys_to_pfn(paddr
)) + offset
;
11 static inline phys_addr_t
dma_to_phys(struct device
*dev
, dma_addr_t dev_addr
)
13 unsigned int offset
= dev_addr
& ~PAGE_MASK
;
14 return __pfn_to_phys(dma_to_pfn(dev
, dev_addr
)) + offset
;
17 static inline bool dma_capable(struct device
*dev
, dma_addr_t addr
, size_t size
)
24 mask
= *dev
->dma_mask
;
26 limit
= (mask
+ 1) & ~mask
;
27 if (limit
&& size
> limit
)
30 if ((addr
| (addr
+ size
- 1)) & ~mask
)
36 #endif /* ASM_ARM_DMA_DIRECT_H */