diff options
Diffstat (limited to 'include/asm-arm/arch-ns9xxx/hardware.h')
-rw-r--r-- | include/asm-arm/arch-ns9xxx/hardware.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/asm-arm/arch-ns9xxx/hardware.h b/include/asm-arm/arch-ns9xxx/hardware.h new file mode 100644 index 000000000000..6819da7c48d4 --- /dev/null +++ b/include/asm-arm/arch-ns9xxx/hardware.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * include/asm-arm/arch-ns9xxx/hardware.h | ||
3 | * | ||
4 | * Copyright (C) 2006 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __ASM_ARCH_HARDWARE_H | ||
12 | #define __ASM_ARCH_HARDWARE_H | ||
13 | |||
14 | #include <asm/memory.h> | ||
15 | |||
16 | /* | ||
17 | * NetSilicon NS9xxx internal mapping: | ||
18 | * | ||
19 | * physical <--> virtual | ||
20 | * 0x90000000 - 0x906fffff <--> 0xf9000000 - 0xf96fffff | ||
21 | * 0xa0100000 - 0xa0afffff <--> 0xfa100000 - 0xfaafffff | ||
22 | */ | ||
23 | #define io_p2v(x) (0xf0000000 \ | ||
24 | + (((x) & 0xf0000000) >> 4) \ | ||
25 | + ((x) & 0x00ffffff)) | ||
26 | |||
27 | #define io_v2p(x) ((((x) & 0x0f000000) << 4) \ | ||
28 | + ((x) & 0x00ffffff)) | ||
29 | |||
30 | #define __REGBIT(bit) ((u32)1 << (bit)) | ||
31 | #define __REGBITS(hbit, lbit) ((((u32)1 << ((hbit) - (lbit) + 1)) - 1) << (lbit)) | ||
32 | #define __REGVAL(mask, value) (((value) * ((mask) & (-(mask))) & (mask))) | ||
33 | |||
34 | #ifndef __ASSEMBLY__ | ||
35 | |||
36 | # define __REG(x) (*((volatile u32 *)io_p2v((x)))) | ||
37 | # define __REG2(x, y) (*((volatile u32 *)io_p2v((x)) + (y))) | ||
38 | |||
39 | # define __REGB(x) (*((volatile u8 *)io_p2v((x)))) | ||
40 | # define __REGB2(x) (*((volatile u8 *)io_p2v((x)) + (y))) | ||
41 | |||
42 | # define REGSET(var, reg, field, value) \ | ||
43 | ((var) = (((var) \ | ||
44 | & ~(reg ## _ ## field & \ | ||
45 | ~ reg ## _ ## field ## _ ## value)) \ | ||
46 | | (reg ## _ ## field ## _ ## value))) | ||
47 | |||
48 | # define REGSETIM(var, reg, field, value) \ | ||
49 | ((var) = (((var) \ | ||
50 | & ~(reg ## _ ## field & \ | ||
51 | ~(__REGVAL(reg ## _ ## field, value)))) \ | ||
52 | | (__REGVAL(reg ## _ ## field, value)))) | ||
53 | |||
54 | # define REGGET(reg, field) \ | ||
55 | ((reg & (reg ## _ ## field)) / (field & (-field))) | ||
56 | |||
57 | #else | ||
58 | |||
59 | # define __REG(x) io_p2v(x) | ||
60 | # define __REG2(x, y) io_p2v((x) + (y)) | ||
61 | |||
62 | # define __REGB(x) __REG((x)) | ||
63 | # define __REGB2(x, y) __REG2((x), (y)) | ||
64 | |||
65 | #endif | ||
66 | |||
67 | #endif /* ifndef __ASM_ARCH_HARDWARE_H */ | ||