diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-08-23 05:02:59 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-23 05:02:59 -0400 |
commit | 0858d9c0c591ce9baa1baf72eaf6f67823f3bc25 (patch) | |
tree | 1ea697a8e34ff1784572db22bcb5c9da7bbfb40c /arch/sh/include/asm/hwblk.h | |
parent | 9d7302299ee96ca954fe4ab8ca640333b6e19ad0 (diff) | |
parent | 963e04cafbf001ec431025a46ec246ae6d89daba (diff) |
Merge branch 'sh/hwblk' into sh/pm-runtime
Diffstat (limited to 'arch/sh/include/asm/hwblk.h')
-rw-r--r-- | arch/sh/include/asm/hwblk.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/arch/sh/include/asm/hwblk.h b/arch/sh/include/asm/hwblk.h new file mode 100644 index 000000000000..c01d72cb6757 --- /dev/null +++ b/arch/sh/include/asm/hwblk.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef __ASM_SH_HWBLK_H | ||
2 | #define __ASM_SH_HWBLK_H | ||
3 | |||
4 | #include <asm/clock.h> | ||
5 | #include <asm/io.h> | ||
6 | |||
7 | #define HWBLK_CNT_USAGE 0 | ||
8 | #define HWBLK_CNT_NR 1 | ||
9 | |||
10 | #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */ | ||
11 | |||
12 | #define HWBLK_AREA(_flags, _parent) \ | ||
13 | { \ | ||
14 | .flags = _flags, \ | ||
15 | .parent = _parent, \ | ||
16 | } | ||
17 | |||
18 | struct hwblk_area { | ||
19 | int cnt[HWBLK_CNT_NR]; | ||
20 | unsigned char parent; | ||
21 | unsigned char flags; | ||
22 | }; | ||
23 | |||
24 | #define HWBLK(_mstp, _bit, _area) \ | ||
25 | { \ | ||
26 | .mstp = (void __iomem *)_mstp, \ | ||
27 | .bit = _bit, \ | ||
28 | .area = _area, \ | ||
29 | } | ||
30 | |||
31 | struct hwblk { | ||
32 | void __iomem *mstp; | ||
33 | unsigned char bit; | ||
34 | unsigned char area; | ||
35 | int cnt[HWBLK_CNT_NR]; | ||
36 | }; | ||
37 | |||
38 | struct hwblk_info { | ||
39 | struct hwblk_area *areas; | ||
40 | int nr_areas; | ||
41 | struct hwblk *hwblks; | ||
42 | int nr_hwblks; | ||
43 | }; | ||
44 | |||
45 | /* Should be defined by processor-specific code */ | ||
46 | int arch_hwblk_init(void); | ||
47 | int arch_hwblk_sleep_mode(void); | ||
48 | |||
49 | int hwblk_register(struct hwblk_info *info); | ||
50 | int hwblk_init(void); | ||
51 | |||
52 | void hwblk_enable(struct hwblk_info *info, int hwblk); | ||
53 | void hwblk_disable(struct hwblk_info *info, int hwblk); | ||
54 | |||
55 | void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt); | ||
56 | void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt); | ||
57 | |||
58 | /* allow clocks to enable and disable hardware blocks */ | ||
59 | #define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \ | ||
60 | { \ | ||
61 | .name = _name, \ | ||
62 | .id = _id, \ | ||
63 | .parent = _parent, \ | ||
64 | .arch_flags = _hwblk, \ | ||
65 | .flags = _flags, \ | ||
66 | } | ||
67 | |||
68 | int sh_hwblk_clk_register(struct clk *clks, int nr); | ||
69 | |||
70 | #endif /* __ASM_SH_HWBLK_H */ | ||