hwblk.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #if !defined(CONFIG_CPU_SUBTYPE_SH7722) && \
  39. !defined(CONFIG_CPU_SUBTYPE_SH7723) && \
  40. !defined(CONFIG_CPU_SUBTYPE_SH7724)
  41. /* Should be defined by processor-specific code */
  42. int arch_hwblk_init(void);
  43. int arch_hwblk_sleep_mode(void);
  44. int hwblk_register(struct hwblk_info *info);
  45. int hwblk_init(void);
  46. void hwblk_enable(struct hwblk_info *info, int hwblk);
  47. void hwblk_disable(struct hwblk_info *info, int hwblk);
  48. void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
  49. void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
  50. /* allow clocks to enable and disable hardware blocks */
  51. #define SH_HWBLK_CLK(_hwblk, _parent, _flags) \
  52. [_hwblk] = { \
  53. .parent = _parent, \
  54. .arch_flags = _hwblk, \
  55. .flags = _flags, \
  56. }
  57. int sh_hwblk_clk_register(struct clk *clks, int nr);
  58. #else
  59. #define hwblk_init() 0
  60. #endif
  61. #endif /* __ASM_SH_HWBLK_H */