cpr-regulator.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. Qualcomm CPR (Core Power Reduction) Regulator
  2. CPR regulator device is for Qualcomm RBCPR (RapidBridge CPR) on
  3. application processor core. It takes voltage corner level
  4. as input and converts it to actual voltage based on the
  5. suggestions from factory production process. When CPR is
  6. enabled for application processer core, it will suggest
  7. scaling the voltage up or down for best performance and
  8. power of the core. The scaling based on factory production
  9. process is called PVS (Process Voltage Scaling) with efuse
  10. bits to indicate what bin (and voltage range) a chip is in.
  11. Required properties:
  12. - compatible: Must be "qcom,cpr-regulator"
  13. - reg: Register addresses for RBCPR, RBCPR clock
  14. select, PVS and CPR eFuse address
  15. - reg-names: Register names. Must be "rbcpr", "rbcpr_clk",
  16. "efuse_addr"
  17. - regulator-name: A string used to describe the regulator
  18. - interrupts: Interrupt line from RBCPR to interrupt controller.
  19. - regulator-min-microvolt: Minimum corner value as min constraint, which
  20. should be 1 for SVS corner
  21. - regulator-max-microvolt: Maximum corner value as max constraint, which
  22. should be 4 for SUPER_TURBO or 3 for TURBO
  23. - qcom,pvs-voltage-table: Array of triples in which each triple indicates the initial voltage
  24. of the PVS bin in SVS, NOM and Turbo corner in microvolts.
  25. The location or 0-based index of an triple in the
  26. list corresponds to the bin number.
  27. - qcom,cpr-voltage-ceiling: Ceiling voltages of SVS, NOM and TURBO corners respectively
  28. - qcom,cpr-voltage-floor: Floor voltages of SVS, NOM and TURBO corners respectively
  29. The ceiling voltages for each of above two
  30. properties may look like this:
  31. 0 (SVS voltage): 1050000 uV
  32. 1 (NORMAL voltage): 1150000 uV
  33. 2 (TURBO voltage): 1275000 uV
  34. - vdd-apc-supply: Regulator to supply VDD APC power
  35. - qcom,vdd-apc-step-up-limit: Limit of vdd-apc-supply steps for scaling up.
  36. - qcom,vdd-apc-step-down-limit: Limit of vdd-apc-supply steps for scaling down.
  37. - qcom,cpr-ref-clk: The reference clock in kHz.
  38. - qcom,cpr-timer-delay: The delay in microseconds for the timer interval.
  39. - qcom,cpr-timer-cons-up: Consecutive number of timer interval (qcom,cpr-timer-delay)
  40. occurred before issuing UP interrupt.
  41. - qcom,cpr-timer-cons-down: Consecutive number of timer interval (qcom,cpr-timer-delay)
  42. occurred before issuing DOWN interrupt.
  43. - qcom,cpr-irq-line: Internal interrupt route signal of RBCPR, one of 0, 1 or 2.
  44. - qcom,cpr-step-quotient: Number of CPR quotient (Ring Oscillator(RO) count) per vdd-apc-supply step
  45. to issue error_steps.
  46. - qcom,cpr-up-threshold: The threshold for CPR to issue interrupt when
  47. error_steps is greater than it when stepping up.
  48. - qcom,cpr-down-threshold: The threshold for CPR to issue interrupt when
  49. error_steps is greater than it when stepping down.
  50. - qcom,cpr-idle-clocks: Idle clock cycles RO can be in.
  51. - qcom,cpr-gcnt-time: The time for gate count in microseconds.
  52. - qcom,cpr-apc-volt-step: The voltage in microvolt per CPR step, such as 5000uV.
  53. - qcom,pvs-fuse-redun-sel: Array of 5 elements to indicate where to read the bits, what value to
  54. compare with in order to decide if the redundant PVS fuse bits would be
  55. used instead of the original bits and method to read fuse row, reading
  56. register through SCM or directly. The 5 elements with index [0..4] are:
  57. [0] => the fuse row number of the selector
  58. [1] => LSB bit position of the bits
  59. [2] => number of bits
  60. [3] => the value to indicate redundant selection
  61. [4] => fuse reading method, 0 for direct reading or 1 for SCM reading
  62. When the value of the fuse bits specified by first 3 elements equals to
  63. the value in 4th element, redundant PVS fuse bits should be selected.
  64. Otherwise, the original PVS bits should be selected. If the 5th
  65. element is 0, read the fuse row from register directly. Otherwise,
  66. read it through SCM.
  67. - qcom,pvs-fuse: Array of 4 elements to indicate the bits for PVS fuse and read method.
  68. The array should have index and value like this:
  69. [0] => the PVS fuse row number
  70. [1] => LSB bit position of the bits
  71. [2] => number of bits
  72. [3] => fuse reading method, 0 for direct reading or 1 for SCM reading
  73. - qcom,pvs-fuse-redun: Array of 4 elements to indicate the bits for redundant PVS fuse.
  74. The array should have index and value like this:
  75. [0] => the redundant PVS fuse row number
  76. [1] => LSB bit position of the bits
  77. [2] => number of bits
  78. [3] => fuse reading method, 0 for direct reading or 1 for SCM reading
  79. - qcom,cpr-fuse-redun-sel: Array of 5 elements to indicate where to read the bits, what value to
  80. compare with in order to decide if the redundant CPR fuse bits would be
  81. used instead of the original bits and method to read fuse row, using SCM
  82. to read or read register directly. The 5 elements with index [0..4] are:
  83. [0] => the fuse row number of the selector
  84. [1] => LSB bit position of the bits
  85. [2] => number of bits
  86. [3] => the value to indicate redundant selection
  87. [4] => fuse reading method, 0 for direct reading or 1 for SCM reading
  88. When the value of the fuse bits specified by first 3 elements equals to
  89. the value in 4th element, redundant CPR fuse bits should be selected.
  90. Otherwise, the original CPR bits should be selected. If the 5th element
  91. is 0, read the fuse row from register directly. Otherwise, read it through
  92. SCM.
  93. - qcom,cpr-fuse-row: Array of row number of CPR fuse and method to read that row. It should have
  94. index and value like this:
  95. [0] => the fuse row number
  96. [1] => fuse reading method, 0 for direct reading or 1 for SCM reading
  97. - qcom,cpr-fuse-bp-cpr-disable: Bit position of the bit to indicate if CPR should be disable
  98. - qcom,cpr-fuse-bp-scheme: Bit position of the bit to indicate if it's a global/local scheme
  99. - qcom,cpr-fuse-target-quot: Array of bit positions in fuse for Target Quotient of all corners.
  100. It should have index and value like this:
  101. [0] => bit position of the LSB bit for SVS target quotient
  102. [1] => bit position of the LSB bit for NOMINAL target quotient
  103. [2] => bit position of the LSB bit for TURBO target quotient
  104. - qcom,cpr-fuse-ro-sel: Array of bit positions in fuse for RO select of all corners.
  105. It should have index and value like this:
  106. [0] => bit position of the LSB bit for SVS RO select bits
  107. [1] => bit position of the LSB bit for NOMINAL RO select bits
  108. [2] => bit position of the LSB bit for TURBO RO select bits
  109. - qcom,cpr-fuse-redun-row: Array of row number of redundant CPR fuse and method to read that
  110. row. It should have index and value like this:
  111. [0] => the redundant fuse row number
  112. [1] => the value to indicate reading the fuse row directly or using SCM
  113. - qcom,cpr-fuse-redun-target-quot: Array of bit positions in fuse for redundant Target Quotient of all corners.
  114. It should have index and value like this:
  115. [0] => bit position of the LSB bit for redundant SVS target quotient
  116. [1] => bit position of the LSB bit for redundant NOMINAL target quotient
  117. [2] => bit position of the LSB bit for redundant TURBO target quotient
  118. - qcom,cpr-fuse-redun-ro-sel: Array of bit positions in eFuse for redundant RO select.
  119. It should have index and value like this:
  120. [0] => bit position of the LSB bit for redundant SVS RO select bits
  121. [1] => bit position of the LSB bit for redundant NOMINAL RO select bits
  122. [2] => bit position of the LSB bit for redundant TURBO RO select bits
  123. Optional properties:
  124. - vdd-mx-supply: Regulator to supply memory power as dependency
  125. of VDD APC.
  126. - qcom,vdd-mx-vmax: The maximum voltage in uV for vdd-mx-supply. This
  127. is required when vdd-mx-supply is present.
  128. - qcom,vdd-mx-vmin-method: The method to determine the minimum voltage for
  129. vdd-mx-supply, which can be one of following
  130. choices compared with VDD APC:
  131. 0 => equal to the voltage(vmin) of VDD APC
  132. 1 => equal to PVS corner ceiling voltage
  133. 2 => equal to slow speed corner ceiling
  134. 3 => equal to qcom,vdd-mx-vmax
  135. 4 => equal to VDD_APC corner mapped vdd-mx voltage
  136. This is required when vdd-mx-supply is present.
  137. - qcom,vdd-mx-corner-map: Array of 3 elements which defines the mapping from VDD_APC
  138. fuse voltage corners to vdd-mx-supply voltages.
  139. The 3 elements with index[0..2] are:
  140. [0] => voltage to set for vdd-mx when VDD_APC is running at SVS corner
  141. [1] => voltage to set for vdd-mx when VDD_APC is running at NOM corner
  142. [2] => voltage to set for vdd-mx when VDD_APC is running at TURBO corner
  143. This is required when the qcom,vdd-mx-vmin-method property has a value of 4.
  144. - qcom,cpr-fuse-redun-bp-cpr-disable: Redundant bit position of the bit to indicate if CPR should be disable
  145. - qcom,cpr-fuse-redun-bp-scheme: Redundant bit position of the bit to indicate if it's a global/local scheme
  146. This property is required if cpr-fuse-redun-bp-cpr-disable
  147. is present, and vise versa.
  148. - qcom,cpr-enable: Present: CPR enabled by default.
  149. Not Present: CPR disable by default.
  150. - qcom,cpr-fuse-cond-min-volt-sel: Array of 5 elements to indicate where to read the bits, what value to
  151. compare with in order to decide if the conditional minimum apc voltage needs
  152. to be applied and the fuse reading method.
  153. The 5 elements with index[0..4] are:
  154. [0] => the fuse row number;
  155. [1] => LSB bit position of the bits;
  156. [2] => number of the bits;
  157. [3] => the expected data to read;
  158. [4] => fuse reading method, 0 for direct reading or 1 for SCM reading;
  159. When the value of the fuse bits specified by first 3 elements is not equal to
  160. the value in 4th element, then set the apc voltage for all parts running
  161. at each voltage corner to be not lower than the voltage defined
  162. using "qcom,cpr-cond-min-voltage".
  163. - qcom,cpr-cond-min-voltage: Minimum voltage in microvolts for SVS, NOM and TURBO mode if the fuse bits
  164. defined in qcom,cpr-fuse-cond-min-volt-sel have not been programmed with the
  165. expected data. This is required if cpr-fuse-cond-min-volt-sel is present.
  166. - qcom,cpr-fuse-uplift-sel: Array of 5 elements to indicate where to read the bits, what value to
  167. compare with in order to enable or disable the pvs voltage uplift workaround,
  168. and the fuse reading method.
  169. The 5 elements with index[0..4] are:
  170. [0]: => the fuse row number of the selector;
  171. [1]: => LSB bit position of the bits;
  172. [2]: => number of the bits;
  173. [3]: => the value to indicate if the apc pvs voltage uplift workaround will
  174. be enabled;
  175. [4]: => fuse reading method, 0 for direct reading or 1 for SCM reading.
  176. When the value of the fuse bits specified by first 3 elements equals to the
  177. value in 4th element, the pvs voltage uplift workaround will be enabled.
  178. - qcom,speed-bin-fuse-sel: Array of 4 elements to indicate where to read the speed bin of the processor,
  179. and the fuse reading method.
  180. The 4 elements with index[0..3] are:
  181. [0]: => the fuse row number of the selector;
  182. [1]: => LSB bit position of the bits;
  183. [2]: => number of the bits;
  184. [3]: => fuse reading method, 0 for direct reading or 1 for SCM reading.
  185. This is required if cpr-fuse-uplift-disable-sel is present.
  186. - qcom,cpr-uplift-voltage: Uplift in microvolts used for increasing pvs init voltage. If this property is present,
  187. This is required if cpr-fuse-uplift-disable-sel is present.
  188. - qcom,cpr-uplift-max-volt: Maximum voltage in microvolts used for pvs voltage uplift workaround to limit
  189. the maximum pvs voltage.
  190. This is required if cpr-fuse-uplift-disable-sel is present.
  191. - qcom,cpr-uplift-quotient: Three numbers used for pvs voltage uplift workaround to be added to the target
  192. quotient for each corner.
  193. The 3 quotient increment with index[0..2] are:
  194. [0]: => for SVS corner target quotient;
  195. [1]: => for NORM corner target quotient;
  196. [2]: => for TURBO corner target quotient;
  197. This is required if cpr-fuse-uplift-disable-sel is present.
  198. - qcom,cpr-uplift-speed-bin: The speed bin value corresponding to one type of processor which needs to apply the
  199. pvs voltage uplift workaround.
  200. This is required if cpr-fuse-uplift-disable-sel is present.
  201. - qcom,cpr-quotient-adjustment: Array of three elements of CPR quotient adjustments for each corner.
  202. The 3 quotient adjustments with index[0..2] are:
  203. [0] => amount to add to the SVS quotient
  204. [1] => amount to add to the NORM quotient
  205. [2] => amount to add to the TURBO quotient
  206. If this property is specified, then the quotient adjustment values are added to the target
  207. quotient values read from fuses before writing them into the CPR GCNT target control registers.
  208. This property can be used to add static margin to the voltage rail managed by the CPR controller.
  209. - vdd-apc-optional-prim-supply: Present: Regulator of highest priority to supply VDD APC power
  210. Not Present: No such regulator.
  211. - vdd-apc-optional-sec-supply: Present: Regulator of second highest priority to supply VDD APC power.
  212. Not Present: No such regulator.
  213. - qcom,cpr-speed-bin-max-corners: Array of quintuples in which each quintuple maps a CPU speed bin and PVS version to
  214. the maximum virtual voltage corner corresponding to the SVS, NORMAL and TURBO corners.
  215. The 5 elements in one quintuple are:
  216. [0]: => the speed bin of the CPU.
  217. [1]: => the PVS version of the CPU.
  218. [2]: => the max virtual voltage corner value corresponding to SVS corner for this speed bin.
  219. [3]: => the max virtual voltage corner value corresponding to NORMAL corner for this speed bin.
  220. [4]: => the max virtual voltage corner value corresponding to TURBO corner for this speed bin.
  221. No CPR target quotient scaling is applied on chips which have a speed bin + PVS version
  222. pair that does not appear in one of the quintuples in this property. If the property is
  223. specified, then quotient scaling is enabled for the TURBO corner. If this property is
  224. not specified, then no quotient scaling can take place.
  225. - qcom,cpr-corner-map: Array of elements of fuse corner value for each virtual corner.
  226. The location or 1-based index of an element in the list corresponds to
  227. the virtual corner value. For example, the first element in the list is the fuse corner
  228. value that virtual corner 1 maps to.
  229. This property is required if qcom,cpr-speed-bin-max-corners is present.
  230. - qcom,cpr-corner-frequency-map: Array of tuples in which a tuple describes a corner to application processor frequency
  231. mapping.
  232. The 2 elements in one tuple are:
  233. [0]: => a virtual voltage corner.
  234. [1]: => the application processor frequency in Hz corresponding to the virtual corner.
  235. This property is required if qcom,cpr-speed-bin-max-corners is present.
  236. - qcom,pvs-version-fuse-sel: Array of 4 elements to indicate where to read the pvs version of the processor,
  237. and the fuse reading method.
  238. The 4 elements with index[0..3] are:
  239. [0]: => the fuse row number of the selector;
  240. [1]: => LSB bit position of the bits;
  241. [2]: => the number of bits;
  242. [3]: => fuse reading method, 0 for direct reading or 1 for SCM reading.
  243. This property is required if qcom,cpr-speed-bin-max-corners is present.
  244. - qcom,cpr-quot-adjust-scaling-factor-max: The maximum allowed CPR target quotient scaling factor to use when
  245. calculating the quotient adjustment for a given virtual voltage corner. It
  246. corresponds to 'scaling' in this equation:
  247. quot_adjust = (freq_turbo - freq_corner) * scaling / 1000.
  248. This property is required if qcom,cpr-speed-bin-max-corners is present.
  249. - mem-acc-supply: Regulator to vote for the memory accelerator configuration.
  250. Not Present: memory accelerator configuration not supported.
  251. Example:
  252. apc_vreg_corner: regulator@f9018000 {
  253. status = "okay";
  254. compatible = "qcom,cpr-regulator";
  255. reg = <0xf9018000 0x1000>, <0xfc4b8000 0x1000>;
  256. reg-names = "rbcpr", "efuse_addr";
  257. interrupts = <0 15 0>;
  258. regulator-name = "apc_corner";
  259. regulator-min-microvolt = <1>;
  260. regulator-max-microvolt = <12>;
  261. qcom,pvs-fuse = <22 6 5 1>;
  262. qcom,pvs-fuse-redun-sel = <22 24 3 2 1>;
  263. qcom,pvs-fuse-redun = <22 27 5 1>;
  264. qcom,pvs-voltage-table =
  265. <1050000 1150000 1350000>,
  266. <1050000 1150000 1340000>,
  267. <1050000 1150000 1330000>,
  268. <1050000 1150000 1320000>,
  269. <1050000 1150000 1310000>,
  270. <1050000 1150000 1300000>,
  271. <1050000 1150000 1290000>,
  272. <1050000 1150000 1280000>,
  273. <1050000 1150000 1270000>,
  274. <1050000 1140000 1260000>,
  275. <1050000 1130000 1250000>,
  276. <1050000 1120000 1240000>,
  277. <1050000 1110000 1230000>,
  278. <1050000 1100000 1220000>,
  279. <1050000 1090000 1210000>,
  280. <1050000 1080000 1200000>,
  281. <1050000 1070000 1190000>,
  282. <1050000 1060000 1180000>,
  283. <1050000 1050000 1170000>,
  284. <1050000 1050000 1160000>,
  285. <1050000 1050000 1150000>,
  286. <1050000 1050000 1140000>,
  287. <1050000 1050000 1140000>,
  288. <1050000 1050000 1140000>,
  289. <1050000 1050000 1140000>,
  290. <1050000 1050000 1140000>,
  291. <1050000 1050000 1140000>,
  292. <1050000 1050000 1140000>,
  293. <1050000 1050000 1140000>,
  294. <1050000 1050000 1140000>,
  295. <1050000 1050000 1140000>,
  296. <1050000 1050000 1140000>;
  297. qcom,cpr-voltage-ceiling = <1050000 1150000 1280000>;
  298. qcom,cpr-voltage-floor = <1050000 1050000 1100000>;
  299. vdd-apc-supply = <&pm8226_s2>;
  300. vdd-apc-optional-prim-supply = <&ncp6335d>;
  301. vdd-apc-optional-sec-supply = <&fan53555>;
  302. vdd-mx-supply = <&pm8226_l3_ao>;
  303. qcom,vdd-mx-vmax = <1350000>;
  304. qcom,vdd-mx-vmin-method = <1>;
  305. qcom,vdd-apc-step-up-limit = <1>;
  306. qcom,vdd-apc-step-down-limit = <1>;
  307. qcom,cpr-ref-clk = <19200>;
  308. qcom,cpr-timer-delay = <5000>;
  309. qcom,cpr-timer-cons-up = <1>;
  310. qcom,cpr-timer-cons-down = <2>;
  311. qcom,cpr-irq-line = <0>;
  312. qcom,cpr-step-quotient = <15>;
  313. qcom,cpr-up-threshold = <1>;
  314. qcom,cpr-down-threshold = <2>;
  315. qcom,cpr-idle-clocks = <5>;
  316. qcom,cpr-gcnt-time = <1>;
  317. qcom,cpr-apc-volt-step = <5000>;
  318. qcom,cpr-fuse-row = <138 1>;
  319. qcom,cpr-fuse-bp-cpr-disable = <36>;
  320. qcom,cpr-fuse-bp-scheme = <37>;
  321. qcom,cpr-fuse-target-quot = <24 12 0>;
  322. qcom,cpr-fuse-ro-sel = <54 38 41>;
  323. qcom,cpr-fuse-redun-sel = <138 57 1 1 1>;
  324. qcom,cpr-fuse-redun-row = <139 1>;
  325. qcom,cpr-fuse-redun-target-quot = <24 12 0>;
  326. qcom,cpr-fuse-redun-ro-sel = <46 36 39>;
  327. qcom,cpr-fuse-cond-min-volt-sel = <54 42 6 7 1>;
  328. qcom,cpr-cond-min-voltage = <1140000>;
  329. qcom,cpr-fuse-uplift-sel = <22 53 1 0 0>;
  330. qcom,cpr-uplift-voltage = <50000>;
  331. qcom,cpr-uplift-quotient = <0 0 120>;
  332. qcom,cpr-uplift-max-volt = <1350000>;
  333. qcom,cpr-uplift-speed-bin = <1>;
  334. qcom,speed-bin-fuse-sel = <22 0 3 0>;
  335. qcom,cpr-corner-map = <1 1 2 2 3 3 3 3 3 3 3 3>;
  336. qcom,cpr-corner-frequency-map =
  337. <1 300000000>,
  338. <2 384000000>,
  339. <3 600000000>,
  340. <4 787200000>,
  341. <5 998400000>,
  342. <6 1094400000>,
  343. <7 1190400000>,
  344. <8 1305600000>,
  345. <9 1344000000>,
  346. <10 1401600000>,
  347. <11 1497600000>,
  348. <12 1593600000>;
  349. qcom,pvs-version-fuse-sel = <22 4 2 0>;
  350. qcom,cpr-speed-bin-max-corners =
  351. <0 1 2 4 7>,
  352. <1 1 2 4 12>,
  353. <2 1 2 4 10>,
  354. <5 1 2 4 14>;
  355. qcom,cpr-quot-adjust-scaling-factor-max = <650>;
  356. };