diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/sh/include/asm/hwblk.h | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
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 00000000000..855e945c619 --- /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_IDLE 1 | ||
| 9 | #define HWBLK_CNT_DEVICES 2 | ||
| 10 | #define HWBLK_CNT_NR 3 | ||
| 11 | |||
| 12 | #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */ | ||
| 13 | |||
| 14 | #define HWBLK_AREA(_flags, _parent) \ | ||
| 15 | { \ | ||
| 16 | .flags = _flags, \ | ||
| 17 | .parent = _parent, \ | ||
| 18 | } | ||
| 19 | |||
| 20 | struct hwblk_area { | ||
| 21 | int cnt[HWBLK_CNT_NR]; | ||
| 22 | unsigned char parent; | ||
| 23 | unsigned char flags; | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define HWBLK(_mstp, _bit, _area) \ | ||
| 27 | { \ | ||
| 28 | .mstp = (void __iomem *)_mstp, \ | ||
| 29 | .bit = _bit, \ | ||
| 30 | .area = _area, \ | ||
| 31 | } | ||
| 32 | |||
| 33 | struct hwblk { | ||
| 34 | void __iomem *mstp; | ||
| 35 | unsigned char bit; | ||
| 36 | unsigned char area; | ||
| 37 | int cnt[HWBLK_CNT_NR]; | ||
| 38 | }; | ||
| 39 | |||
| 40 | struct hwblk_info { | ||
| 41 | struct hwblk_area *areas; | ||
| 42 | int nr_areas; | ||
| 43 | struct hwblk *hwblks; | ||
| 44 | int nr_hwblks; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /* Should be defined by processor-specific code */ | ||
| 48 | int arch_hwblk_init(void); | ||
| 49 | int arch_hwblk_sleep_mode(void); | ||
| 50 | |||
| 51 | int hwblk_register(struct hwblk_info *info); | ||
| 52 | int hwblk_init(void); | ||
| 53 | |||
| 54 | void hwblk_enable(struct hwblk_info *info, int hwblk); | ||
| 55 | void hwblk_disable(struct hwblk_info *info, int hwblk); | ||
| 56 | |||
| 57 | void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt); | ||
| 58 | void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt); | ||
| 59 | |||
| 60 | /* allow clocks to enable and disable hardware blocks */ | ||
| 61 | #define SH_HWBLK_CLK(_hwblk, _parent, _flags) \ | ||
| 62 | [_hwblk] = { \ | ||
| 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 */ | ||
