From 745aff2248856e38db5c190301ffe14b101dce70 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Fri, 11 Aug 2017 16:26:10 +0200 Subject: MIPS: add virt_to_phys() and phys_to_virt() Signed-off-by: Antony Pavlov Signed-off-by: Peter Mamonov Signed-off-by: Oleksij Rempel Signed-off-by: Lucas Stach --- arch/mips/include/asm/io.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'arch/mips/include') diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 4bee5913a5..5a4cbf564a 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -12,11 +12,36 @@ #include #include +#include #include void dma_flush_range(unsigned long, unsigned long); void dma_inv_range(unsigned long, unsigned long); +/* + * virt_to_phys - map virtual addresses to physical + * @address: address to remap + * + * The returned physical address is the physical (CPU) mapping for + * the memory address given. + */ +static inline unsigned long virt_to_phys(const void *address) +{ + return (unsigned long)CPHYSADDR(address); +} + +/* + * phys_to_virt - map physical address to virtual + * @address: address to remap + * + * The returned virtual address is a current CPU mapping for + * the memory address given. + */ +static inline void *phys_to_virt(unsigned long address) +{ + return (void *)CKSEG0ADDR(address); +} + #define IO_SPACE_LIMIT 0 /*****************************************************************************/ -- cgit v1.2.3