aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-arm/arch-ns9xxx/clock.h4
-rw-r--r--include/asm-arm/arch-ns9xxx/hardware.h39
2 files changed, 30 insertions, 13 deletions
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h
index bf30cbdcc2bf..90604d48d561 100644
--- a/include/asm-arm/arch-ns9xxx/clock.h
+++ b/include/asm-arm/arch-ns9xxx/clock.h
@@ -46,8 +46,8 @@ static inline u32 ns9xxx_systemclock(void)
46 * 46 *
47 * Fine. 47 * Fine.
48 */ 48 */
49 return CRYSTAL * (REGGET(pll, SYS_PLL, ND) + 1) 49 return CRYSTAL * (REGGETIM(pll, SYS_PLL, ND) + 1)
50 >> REGGET(pll, SYS_PLL, FS); 50 >> REGGETIM(pll, SYS_PLL, FS);
51} 51}
52 52
53static inline u32 ns9xxx_cpuclock(void) __attribute__((const)); 53static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
diff --git a/include/asm-arm/arch-ns9xxx/hardware.h b/include/asm-arm/arch-ns9xxx/hardware.h
index 25600554c4fe..b5d66f963981 100644
--- a/include/asm-arm/arch-ns9xxx/hardware.h
+++ b/include/asm-arm/arch-ns9xxx/hardware.h
@@ -27,9 +27,11 @@
27#define io_v2p(x) ((((x) & 0x0f000000) << 4) \ 27#define io_v2p(x) ((((x) & 0x0f000000) << 4) \
28 + ((x) & 0x00ffffff)) 28 + ((x) & 0x00ffffff))
29 29
30#define __REGSHIFT(mask) ((mask) & (-(mask)))
31
30#define __REGBIT(bit) ((u32)1 << (bit)) 32#define __REGBIT(bit) ((u32)1 << (bit))
31#define __REGBITS(hbit, lbit) ((((u32)1 << ((hbit) - (lbit) + 1)) - 1) << (lbit)) 33#define __REGBITS(hbit, lbit) ((((u32)1 << ((hbit) - (lbit) + 1)) - 1) << (lbit))
32#define __REGVAL(mask, value) (((value) * ((mask) & (-(mask))) & (mask))) 34#define __REGVAL(mask, value) (((value) * __REGSHIFT(mask)) & (mask))
33 35
34#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
35 37
@@ -39,21 +41,36 @@
39# define __REGB(x) (*((volatile u8 *)io_p2v((x)))) 41# define __REGB(x) (*((volatile u8 *)io_p2v((x))))
40# define __REGB2(x) (*((volatile u8 *)io_p2v((x)) + (y))) 42# define __REGB2(x) (*((volatile u8 *)io_p2v((x)) + (y)))
41 43
44# define __REGSET(var, field, value) \
45 ((var) = (((var) & ~((field) & ~(value))) | (value)))
46
42# define REGSET(var, reg, field, value) \ 47# define REGSET(var, reg, field, value) \
43 ((var) = (((var) \ 48 __REGSET(var, reg ## _ ## field, reg ## _ ## field ## _ ## value)
44 & ~(reg ## _ ## field & \ 49
45 ~ reg ## _ ## field ## _ ## value)) \ 50# define REGSET_IDX(var, reg, field, idx, value) \
46 | (reg ## _ ## field ## _ ## value))) 51 __REGSET(var, reg ## _ ## field((idx)), reg ## _ ## field ## _ ## value((idx)))
47 52
48# define REGSETIM(var, reg, field, value) \ 53# define REGSETIM(var, reg, field, value) \
49 ((var) = (((var) \ 54 __REGSET(var, reg ## _ ## field, __REGVAL(reg ## _ ## field, (value)))
50 & ~(reg ## _ ## field & \ 55
51 ~(__REGVAL(reg ## _ ## field, value)))) \ 56# define REGSETIM_IDX(var, reg, field, idx, value) \
52 | (__REGVAL(reg ## _ ## field, value)))) 57 __REGSET(var, reg ## _ ## field((idx)), __REGVAL(reg ## _ ## field((idx)), (value)))
58
59# define __REGGET(var, field) \
60 (((var) & (field)))
53 61
54# define REGGET(var, reg, field) \ 62# define REGGET(var, reg, field) \
55 ((var & (reg ## _ ## field)) / \ 63 __REGGET(var, reg ## _ ## field)
56 ((reg ## _ ## field) & (-(reg ## _ ## field)))) 64
65# define REGGET_IDX(var, reg, field, idx) \
66 __REGGET(var, reg ## _ ## field((idx)))
67
68# define REGGETIM(var, reg, field) \
69 __REGGET(var, reg ## _ ## field) / __REGSHIFT(reg ## _ ## field)
70
71# define REGGETIM_IDX(var, reg, field, idx) \
72 __REGGET(var, reg ## _ ## field((idx))) / \
73 __REGSHIFT(reg ## _ ## field((idx)))
57 74
58#else 75#else
59 76