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:
parent
edd0f1cede
commit
0a9083d929
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue