Magnus Damm | 79714ac | 2009-07-03 10:08:05 +0000 | [diff] [blame^] | 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_AREA_FLAG_PARENT (1 << 0) /* valid parent */ |
| 8 | |
| 9 | #define HWBLK_AREA(_flags, _parent) \ |
| 10 | { \ |
| 11 | .flags = _flags, \ |
| 12 | .parent = _parent, \ |
| 13 | } |
| 14 | |
| 15 | struct hwblk_area { |
| 16 | unsigned long cnt; |
| 17 | unsigned char parent; |
| 18 | unsigned char flags; |
| 19 | }; |
| 20 | |
| 21 | #define HWBLK(_mstp, _bit, _area) \ |
| 22 | { \ |
| 23 | .mstp = (void __iomem *)_mstp, \ |
| 24 | .bit = _bit, \ |
| 25 | .area = _area, \ |
| 26 | } |
| 27 | |
| 28 | struct hwblk { |
| 29 | void __iomem *mstp; |
| 30 | unsigned char bit; |
| 31 | unsigned char area; |
| 32 | unsigned long cnt; |
| 33 | }; |
| 34 | |
| 35 | struct hwblk_info { |
| 36 | struct hwblk_area *areas; |
| 37 | int nr_areas; |
| 38 | struct hwblk *hwblks; |
| 39 | int nr_hwblks; |
| 40 | }; |
| 41 | |
| 42 | /* Should be defined by processor-specific code */ |
| 43 | int arch_hwblk_init(void); |
| 44 | int arch_hwblk_sleep_mode(void); |
| 45 | |
| 46 | int hwblk_register(struct hwblk_info *info); |
| 47 | int hwblk_init(void); |
| 48 | |
| 49 | /* allow clocks to enable and disable hardware blocks */ |
| 50 | #define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \ |
| 51 | { \ |
| 52 | .name = _name, \ |
| 53 | .id = _id, \ |
| 54 | .parent = _parent, \ |
| 55 | .arch_flags = _hwblk, \ |
| 56 | .flags = _flags, \ |
| 57 | } |
| 58 | |
| 59 | int sh_hwblk_clk_register(struct clk *clks, int nr); |
| 60 | |
| 61 | #endif /* __ASM_SH_HWBLK_H */ |