ti-sysc.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef __TI_SYSC_DATA_H__
  2. #define __TI_SYSC_DATA_H__
  3. enum ti_sysc_module_type {
  4. TI_SYSC_OMAP2,
  5. TI_SYSC_OMAP2_TIMER,
  6. TI_SYSC_OMAP3_SHAM,
  7. TI_SYSC_OMAP3_AES,
  8. TI_SYSC_OMAP4,
  9. TI_SYSC_OMAP4_TIMER,
  10. TI_SYSC_OMAP4_SIMPLE,
  11. TI_SYSC_OMAP34XX_SR,
  12. TI_SYSC_OMAP36XX_SR,
  13. TI_SYSC_OMAP4_SR,
  14. TI_SYSC_OMAP4_MCASP,
  15. TI_SYSC_OMAP4_USB_HOST_FS,
  16. TI_SYSC_DRA7_MCAN,
  17. };
  18. struct ti_sysc_cookie {
  19. void *data;
  20. };
  21. /**
  22. * struct sysc_regbits - TI OCP_SYSCONFIG register field offsets
  23. * @midle_shift: Offset of the midle bit
  24. * @clkact_shift: Offset of the clockactivity bit
  25. * @sidle_shift: Offset of the sidle bit
  26. * @enwkup_shift: Offset of the enawakeup bit
  27. * @srst_shift: Offset of the softreset bit
  28. * @autoidle_shift: Offset of the autoidle bit
  29. * @dmadisable_shift: Offset of the dmadisable bit
  30. * @emufree_shift; Offset of the emufree bit
  31. *
  32. * Note that 0 is a valid shift, and for ti-sysc.c -ENODEV can be used if a
  33. * feature is not available.
  34. */
  35. struct sysc_regbits {
  36. s8 midle_shift;
  37. s8 clkact_shift;
  38. s8 sidle_shift;
  39. s8 enwkup_shift;
  40. s8 srst_shift;
  41. s8 autoidle_shift;
  42. s8 dmadisable_shift;
  43. s8 emufree_shift;
  44. };
  45. #define SYSC_QUIRK_RESOURCE_PROVIDER BIT(9)
  46. #define SYSC_QUIRK_LEGACY_IDLE BIT(8)
  47. #define SYSC_QUIRK_RESET_STATUS BIT(7)
  48. #define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6)
  49. #define SYSC_QUIRK_NO_RESET_ON_INIT BIT(5)
  50. #define SYSC_QUIRK_OPT_CLKS_NEEDED BIT(4)
  51. #define SYSC_QUIRK_OPT_CLKS_IN_RESET BIT(3)
  52. #define SYSC_QUIRK_16BIT BIT(2)
  53. #define SYSC_QUIRK_UNCACHED BIT(1)
  54. #define SYSC_QUIRK_USE_CLOCKACT BIT(0)
  55. #define SYSC_NR_IDLEMODES 4
  56. /**
  57. * struct sysc_capabilities - capabilities for an interconnect target module
  58. *
  59. * @sysc_mask: bitmask of supported SYSCONFIG register bits
  60. * @regbits: bitmask of SYSCONFIG register bits
  61. * @mod_quirks: bitmask of module specific quirks
  62. */
  63. struct sysc_capabilities {
  64. const enum ti_sysc_module_type type;
  65. const u32 sysc_mask;
  66. const struct sysc_regbits *regbits;
  67. const u32 mod_quirks;
  68. };
  69. /**
  70. * struct sysc_config - configuration for an interconnect target module
  71. * @sysc_val: configured value for sysc register
  72. * @midlemodes: bitmask of supported master idle modes
  73. * @sidlemodes: bitmask of supported master idle modes
  74. * @srst_udelay: optional delay needed after OCP soft reset
  75. * @quirks: bitmask of enabled quirks
  76. */
  77. struct sysc_config {
  78. u32 sysc_val;
  79. u32 syss_mask;
  80. u8 midlemodes;
  81. u8 sidlemodes;
  82. u8 srst_udelay;
  83. u32 quirks;
  84. };
  85. enum sysc_registers {
  86. SYSC_REVISION,
  87. SYSC_SYSCONFIG,
  88. SYSC_SYSSTATUS,
  89. SYSC_MAX_REGS,
  90. };
  91. /**
  92. * struct ti_sysc_module_data - ti-sysc to hwmod translation data for a module
  93. * @name: legacy "ti,hwmods" module name
  94. * @module_pa: physical address of the interconnect target module
  95. * @module_size: size of the interconnect target module
  96. * @offsets: array of register offsets as listed in enum sysc_registers
  97. * @nr_offsets: number of registers
  98. * @cap: interconnect target module capabilities
  99. * @cfg: interconnect target module configuration
  100. *
  101. * This data is enough to allocate a new struct omap_hwmod_class_sysconfig
  102. * based on device tree data parsed by ti-sysc driver.
  103. */
  104. struct ti_sysc_module_data {
  105. const char *name;
  106. u64 module_pa;
  107. u32 module_size;
  108. int *offsets;
  109. int nr_offsets;
  110. const struct sysc_capabilities *cap;
  111. struct sysc_config *cfg;
  112. };
  113. struct device;
  114. struct ti_sysc_platform_data {
  115. struct of_dev_auxdata *auxdata;
  116. int (*init_module)(struct device *dev,
  117. const struct ti_sysc_module_data *data,
  118. struct ti_sysc_cookie *cookie);
  119. int (*enable_module)(struct device *dev,
  120. const struct ti_sysc_cookie *cookie);
  121. int (*idle_module)(struct device *dev,
  122. const struct ti_sysc_cookie *cookie);
  123. int (*shutdown_module)(struct device *dev,
  124. const struct ti_sysc_cookie *cookie);
  125. };
  126. #endif /* __TI_SYSC_DATA_H__ */