Commit 02f37748 authored by Max Filippov's avatar Max Filippov Committed by Chris Zankel

xtensa: fix ioremap

- fix ioremap_nocache to actually return non-cacheable address
- add explicit ioremap_cache
- fix KIO aperture checking arithmetic
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent af42e970
...@@ -67,12 +67,12 @@ static inline void * phys_to_virt(unsigned long address) ...@@ -67,12 +67,12 @@ static inline void * phys_to_virt(unsigned long address)
* Return the virtual (cached) address for the specified bus memory. * Return the virtual (cached) address for the specified bus memory.
* Note that we currently don't support any address outside the KIO segment. * Note that we currently don't support any address outside the KIO segment.
*/ */
static inline void __iomem *ioremap_nocache(unsigned long offset,
static inline void *ioremap(unsigned long offset, unsigned long size) unsigned long size)
{ {
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
if (offset >= XCHAL_KIO_PADDR if (offset >= XCHAL_KIO_PADDR
&& offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
else else
BUG(); BUG();
...@@ -81,11 +81,12 @@ static inline void *ioremap(unsigned long offset, unsigned long size) ...@@ -81,11 +81,12 @@ static inline void *ioremap(unsigned long offset, unsigned long size)
#endif #endif
} }
static inline void *ioremap_nocache(unsigned long offset, unsigned long size) static inline void __iomem *ioremap_cache(unsigned long offset,
unsigned long size)
{ {
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
if (offset >= XCHAL_KIO_PADDR if (offset >= XCHAL_KIO_PADDR
&& offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
else else
BUG(); BUG();
...@@ -94,7 +95,14 @@ static inline void *ioremap_nocache(unsigned long offset, unsigned long size) ...@@ -94,7 +95,14 @@ static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
#endif #endif
} }
static inline void iounmap(void *addr) #define ioremap_wc ioremap_nocache
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
return ioremap_nocache(offset, size);
}
static inline void iounmap(volatile void __iomem *addr)
{ {
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment