mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
nios2: Use asm-generic/io.h
Convert the nios2 architecture to make use of the new asm-generic/io.h to provide address mapping functions. As nios2 actually performs non-identity mapping between physical & virtual addresses we can't simply make use of the generic functions, with the exception of being able to drop our no-op unmap_physmem() and definitions of unused map flags. Feedback from architecture maintainers is welcome. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: Thomas Chou <thomas@wytron.com.tw>
This commit is contained in:
parent
d1cbeafd5e
commit
e16986c481
1 changed files with 8 additions and 7 deletions
|
@ -19,9 +19,6 @@ static inline void sync(void)
|
||||||
* properties specified by "flags".
|
* properties specified by "flags".
|
||||||
*/
|
*/
|
||||||
#define MAP_NOCACHE 1
|
#define MAP_NOCACHE 1
|
||||||
#define MAP_WRCOMBINE 0
|
|
||||||
#define MAP_WRBACK 0
|
|
||||||
#define MAP_WRTHROUGH 0
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
||||||
|
@ -32,20 +29,22 @@ map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
||||||
else
|
else
|
||||||
return (void *)(paddr | gd->arch.mem_region_base);
|
return (void *)(paddr | gd->arch.mem_region_base);
|
||||||
}
|
}
|
||||||
|
#define map_physmem map_physmem
|
||||||
|
|
||||||
/*
|
static inline void *phys_to_virt(phys_addr_t paddr)
|
||||||
* Take down a mapping set up by map_physmem().
|
|
||||||
*/
|
|
||||||
static inline void unmap_physmem(void *vaddr, unsigned long flags)
|
|
||||||
{
|
{
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
return (void *)(paddr | gd->arch.mem_region_base);
|
||||||
}
|
}
|
||||||
|
#define phys_to_virt phys_to_virt
|
||||||
|
|
||||||
static inline phys_addr_t virt_to_phys(void * vaddr)
|
static inline phys_addr_t virt_to_phys(void * vaddr)
|
||||||
{
|
{
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
return (phys_addr_t)vaddr & gd->arch.physaddr_mask;
|
return (phys_addr_t)vaddr & gd->arch.physaddr_mask;
|
||||||
}
|
}
|
||||||
|
#define virt_to_phys virt_to_phys
|
||||||
|
|
||||||
#define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v))
|
#define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v))
|
||||||
#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))
|
#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))
|
||||||
|
@ -171,4 +170,6 @@ static inline void outsl (unsigned long port, const void *src, unsigned long cou
|
||||||
#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
|
#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
|
||||||
#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
|
#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
|
||||||
|
|
||||||
|
#include <asm-generic/io.h>
|
||||||
|
|
||||||
#endif /* __ASM_NIOS2_IO_H_ */
|
#endif /* __ASM_NIOS2_IO_H_ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue