xref: /OK3568_Linux_fs/kernel/arch/mips/loongson2ef/lemote-2f/dma.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun #include <linux/dma-direct.h>
3*4882a593Smuzhiyun 
phys_to_dma(struct device * dev,phys_addr_t paddr)4*4882a593Smuzhiyun dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
5*4882a593Smuzhiyun {
6*4882a593Smuzhiyun 	return paddr | 0x80000000;
7*4882a593Smuzhiyun }
8*4882a593Smuzhiyun 
dma_to_phys(struct device * dev,dma_addr_t dma_addr)9*4882a593Smuzhiyun phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dma_addr)
10*4882a593Smuzhiyun {
11*4882a593Smuzhiyun 	if (dma_addr > 0x8fffffff)
12*4882a593Smuzhiyun 		return dma_addr;
13*4882a593Smuzhiyun 	return dma_addr & 0x0fffffff;
14*4882a593Smuzhiyun }
15