hwblk.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef __ASM_SH_HWBLK_H
  2. #define __ASM_SH_HWBLK_H
  3. #include <asm/clock.h>
  4. #include <asm/io.h>
  5. #define HWBLK_CNT_USAGE 0
  6. #define HWBLK_CNT_IDLE 1
  7. #define HWBLK_CNT_DEVICES 2
  8. #define HWBLK_CNT_NR 3
  9. #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
  10. #define HWBLK_AREA(_flags, _parent) \
  11. { \
  12. .flags = _flags, \
  13. .parent = _parent, \
  14. }
  15. struct hwblk_area {
  16. int cnt[HWBLK_CNT_NR];
  17. unsigned char parent;
  18. unsigned char flags;
  19. };
  20. #define HWBLK(_mstp, _bit, _area) \
  21. { \
  22. .mstp = (void __iomem *)_mstp, \
  23. .bit = _bit, \
  24. .area = _area, \
  25. }
  26. struct hwblk {
  27. void __iomem *mstp;
  28. unsigned char bit;
  29. unsigned char area;
  30. int cnt[HWBLK_CNT_NR];
  31. };
  32. struct hwblk_info {
  33. struct hwblk_area *areas;
  34. int nr_areas;
  35. struct hwblk *hwblks;
  36. int nr_hwblks;
  37. };
  38. /* Should be defined by processor-specific code */
  39. int arch_hwblk_init(void);
  40. int arch_hwblk_sleep_mode(void);
  41. int hwblk_register(struct hwblk_info *info);
  42. int hwblk_init(void);
  43. void hwblk_enable(struct hwblk_info *info, int hwblk);
  44. void hwblk_disable(struct hwblk_info *info, int hwblk);
  45. void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
  46. void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
  47. /* allow clocks to enable and disable hardware blocks */
  48. #define SH_HWBLK_CLK(_hwblk, _parent, _flags) \
  49. [_hwblk] = { \
  50. .parent = _parent, \
  51. .arch_flags = _hwblk, \
  52. .flags = _flags, \
  53. }
  54. int sh_hwblk_clk_register(struct clk *clks, int nr);
  55. #endif /* __ASM_SH_HWBLK_H */