diff options
Diffstat (limited to 'arch/mips/include/asm/io.h')
-rw-r--r-- | arch/mips/include/asm/io.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index c155199430..4584eec8ca 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + /* * Stolen from the linux-2.6/include/asm-generic/io.h */ @@ -25,9 +27,10 @@ void dma_inv_range(unsigned long, unsigned long); * The returned physical address is the physical (CPU) mapping for * the memory address given. */ -static inline unsigned long virt_to_phys(const void *address) +#define virt_to_phys virt_to_phys +static inline unsigned long virt_to_phys(const volatile void *address) { - return (unsigned long)CPHYSADDR(address); + return CPHYSADDR((unsigned long)address); } /* @@ -37,9 +40,14 @@ static inline unsigned long virt_to_phys(const void *address) * The returned virtual address is a current CPU mapping for * the memory address given. */ +#define phys_to_virt phys_to_virt static inline void *phys_to_virt(unsigned long address) { - return (void *)CKSEG0ADDR(address); + if (IS_ENABLED(CONFIG_MMU)) { + return (void *)CKSEG0ADDR(address); + } + + return (void *)CKSEG1ADDR(address); } #define IO_SPACE_LIMIT 0 |