9
0
Fork 0

arch/arm: mmu: add map_io_range()

Add a function to remap an IO range into a virtual addresses
range. This is particulary usefull for the few devices
mapped at physical address 0, as the MTD boot devices.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Robert Jarzmik 2011-12-19 10:17:21 +01:00 committed by Sascha Hauer
parent edd0f1cede
commit 0a9083d929
2 changed files with 18 additions and 0 deletions

View File

@ -111,6 +111,18 @@ static void remap_range(void *_start, size_t size, uint32_t flags)
tlb_invalidate();
}
void *map_io_sections(unsigned long phys, void *_start, size_t size)
{
unsigned long start = (unsigned long)_start, sec;
phys >>= 20;
for (sec = start; sec < start + size; sec += (1 << 20))
ttb[sec >> 20] = (phys++ << 20) | PMD_SECT_DEF_UNCACHED;
tlb_invalidate();
return _start;
}
/*
* remap the memory bank described by mem cachable and
* bufferable

View File

@ -32,6 +32,7 @@ void dma_flush_range(unsigned long, unsigned long);
void dma_inv_range(unsigned long, unsigned long);
unsigned long virt_to_phys(void *virt);
void *phys_to_virt(unsigned long phys);
void *map_io_sections(unsigned long physaddr, void *start, size_t size);
#else
static inline void *dma_alloc_coherent(size_t size)
@ -66,6 +67,11 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
{
}
static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
{
return (void *)phys;
}
#endif
#ifdef CONFIG_CACHE_L2X0