ti-sysc.h 5.0 KB

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