hwblk.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_NR 1
  7. #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
  8. #define HWBLK_AREA(_flags, _parent) \
  9. { \
  10. .flags = _flags, \
  11. .parent = _parent, \
  12. }
  13. struct hwblk_area {
  14. int cnt[HWBLK_CNT_NR];
  15. unsigned char parent;
  16. unsigned char flags;
  17. };
  18. #define HWBLK(_mstp, _bit, _area) \
  19. { \
  20. .mstp = (void __iomem *)_mstp, \
  21. .bit = _bit, \
  22. .area = _area, \
  23. }
  24. struct hwblk {
  25. void __iomem *mstp;
  26. unsigned char bit;
  27. unsigned char area;
  28. int cnt[HWBLK_CNT_NR];
  29. };
  30. struct hwblk_info {
  31. struct hwblk_area *areas;
  32. int nr_areas;
  33. struct hwblk *hwblks;
  34. int nr_hwblks;
  35. };
  36. /* Should be defined by processor-specific code */
  37. int arch_hwblk_init(void);
  38. int arch_hwblk_sleep_mode(void);
  39. int hwblk_register(struct hwblk_info *info);
  40. int hwblk_init(void);
  41. void hwblk_enable(struct hwblk_info *info, int hwblk);
  42. void hwblk_disable(struct hwblk_info *info, int hwblk);
  43. void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
  44. void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
  45. /* allow clocks to enable and disable hardware blocks */
  46. #define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \
  47. { \
  48. .name = _name, \
  49. .id = _id, \
  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 */