1
2
3
4
5
6#ifndef __ASM_AVR32_ADDRSPACE_H
7#define __ASM_AVR32_ADDRSPACE_H
8
9#include <asm/types.h>
10
11
12#define P0SEG 0x00000000
13#define P1SEG 0x80000000
14#define P2SEG 0xa0000000
15#define P3SEG 0xc0000000
16#define P4SEG 0xe0000000
17
18
19#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
20
21
22#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
23
24
25
26
27#define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))
28#define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG))
29#define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
30#define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
31
32
33static inline unsigned long virt_to_phys(volatile void *address)
34{
35 return PHYSADDR(address);
36}
37
38static inline void * phys_to_virt(unsigned long address)
39{
40 return (void *)P1SEGADDR(address);
41}
42
43#define cached(addr) ((void *)P1SEGADDR(addr))
44#define uncached(addr) ((void *)P2SEGADDR(addr))
45
46
47
48
49
50
51
52
53
54#define MAP_NOCACHE (0)
55#define MAP_WRCOMBINE (1 << 7)
56#define MAP_WRBACK (MAP_WRCOMBINE | (1 << 9))
57#define MAP_WRTHROUGH (MAP_WRBACK | (1 << 0))
58
59static inline void *
60map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
61{
62 return (void *)paddr;
63}
64
65#endif
66