This source file includes following definitions.
- malidp_read32
- malidp_write32
- malidp_write64
- malidp_write32_mask
- malidp_write_group
1
2
3
4
5
6
7 #ifndef _MALIDP_IO_H_
8 #define _MALIDP_IO_H_
9
10 #include <linux/io.h>
11
12 static inline u32
13 malidp_read32(u32 __iomem *base, u32 offset)
14 {
15 return readl((base + (offset >> 2)));
16 }
17
18 static inline void
19 malidp_write32(u32 __iomem *base, u32 offset, u32 v)
20 {
21 writel(v, (base + (offset >> 2)));
22 }
23
24 static inline void
25 malidp_write64(u32 __iomem *base, u32 offset, u64 v)
26 {
27 writel(lower_32_bits(v), (base + (offset >> 2)));
28 writel(upper_32_bits(v), (base + (offset >> 2) + 1));
29 }
30
31 static inline void
32 malidp_write32_mask(u32 __iomem *base, u32 offset, u32 m, u32 v)
33 {
34 u32 tmp = malidp_read32(base, offset);
35
36 tmp &= (~m);
37 malidp_write32(base, offset, v | tmp);
38 }
39
40 static inline void
41 malidp_write_group(u32 __iomem *base, u32 offset, int num, const u32 *values)
42 {
43 int i;
44
45 for (i = 0; i < num; i++)
46 malidp_write32(base, offset + i * 4, values[i]);
47 }
48
49 #endif