opp.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. Generic OPP (Operating Performance Points) Bindings
  2. ----------------------------------------------------
  3. Devices work at voltage-current-frequency combinations and some implementations
  4. have the liberty of choosing these. These combinations are called Operating
  5. Performance Points aka OPPs. This document defines bindings for these OPPs
  6. applicable across wide range of devices. For illustration purpose, this document
  7. uses CPU as a device.
  8. This document contain multiple versions of OPP binding and only one of them
  9. should be used per device.
  10. Binding 1: operating-points
  11. ============================
  12. This binding only supports voltage-frequency pairs.
  13. Properties:
  14. - operating-points: An array of 2-tuples items, and each item consists
  15. of frequency and voltage like <freq-kHz vol-uV>.
  16. freq: clock frequency in kHz
  17. vol: voltage in microvolt
  18. Examples:
  19. cpu@0 {
  20. compatible = "arm,cortex-a9";
  21. reg = <0>;
  22. next-level-cache = <&L2>;
  23. operating-points = <
  24. /* kHz uV */
  25. 792000 1100000
  26. 396000 950000
  27. 198000 850000
  28. >;
  29. };
  30. Binding 2: operating-points-v2
  31. ============================
  32. * Property: operating-points-v2
  33. Devices supporting OPPs must set their "operating-points-v2" property with
  34. phandle to a OPP table in their DT node. The OPP core will use this phandle to
  35. find the operating points for the device.
  36. If required, this can be extended for SoC vendor specific bindings. Such bindings
  37. should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt
  38. and should have a compatible description like: "operating-points-v2-<vendor>".
  39. * OPP Table Node
  40. This describes the OPPs belonging to a device. This node can have following
  41. properties:
  42. Required properties:
  43. - compatible: Allow OPPs to express their compatibility. It should be:
  44. "operating-points-v2".
  45. - OPP nodes: One or more OPP nodes describing voltage-current-frequency
  46. combinations. Their name isn't significant but their phandle can be used to
  47. reference an OPP.
  48. Optional properties:
  49. - opp-shared: Indicates that device nodes using this OPP Table Node's phandle
  50. switch their DVFS state together, i.e. they share clock/voltage/current lines.
  51. Missing property means devices have independent clock/voltage/current lines,
  52. but they share OPP tables.
  53. - status: Marks the OPP table enabled/disabled.
  54. * OPP Node
  55. This defines voltage-current-frequency combinations along with other related
  56. properties.
  57. Required properties:
  58. - opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer.
  59. Optional properties:
  60. - opp-microvolt: voltage in micro Volts.
  61. A single regulator's voltage is specified with an array of size one or three.
  62. Single entry is for target voltage and three entries are for <target min max>
  63. voltages.
  64. Entries for multiple regulators must be present in the same order as
  65. regulators are specified in device's DT node.
  66. - opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to
  67. the above opp-microvolt property, but allows multiple voltage ranges to be
  68. provided for the same OPP. At runtime, the platform can pick a <name> and
  69. matching opp-microvolt-<name> property will be enabled for all OPPs. If the
  70. platform doesn't pick a specific <name> or the <name> doesn't match with any
  71. opp-microvolt-<name> properties, then opp-microvolt property shall be used, if
  72. present.
  73. - opp-microamp: The maximum current drawn by the device in microamperes
  74. considering system specific parameters (such as transients, process, aging,
  75. maximum operating temperature range etc.) as necessary. This may be used to
  76. set the most efficient regulator operating mode.
  77. Should only be set if opp-microvolt is set for the OPP.
  78. Entries for multiple regulators must be present in the same order as
  79. regulators are specified in device's DT node. If this property isn't required
  80. for few regulators, then this should be marked as zero for them. If it isn't
  81. required for any regulator, then this property need not be present.
  82. - opp-microamp-<name>: Named opp-microamp property. Similar to
  83. opp-microvolt-<name> property, but for microamp instead.
  84. - clock-latency-ns: Specifies the maximum possible transition latency (in
  85. nanoseconds) for switching to this OPP from any other OPP.
  86. - turbo-mode: Marks the OPP to be used only for turbo modes. Turbo mode is
  87. available on some platforms, where the device can run over its operating
  88. frequency for a short duration of time limited by the device's power, current
  89. and thermal limits.
  90. - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
  91. the table should have this.
  92. - opp-supported-hw: This enables us to select only a subset of OPPs from the
  93. larger OPP table, based on what version of the hardware we are running on. We
  94. still can't have multiple nodes with the same opp-hz value in OPP table.
  95. It's an user defined array containing a hierarchy of hardware version numbers,
  96. supported by the OPP. For example: a platform with hierarchy of three levels
  97. of versions (A, B and C), this field should be like <X Y Z>, where X
  98. corresponds to Version hierarchy A, Y corresponds to version hierarchy B and Z
  99. corresponds to version hierarchy C.
  100. Each level of hierarchy is represented by a 32 bit value, and so there can be
  101. only 32 different supported version per hierarchy. i.e. 1 bit per version. A
  102. value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
  103. level. And a value of 0x00000000 will disable the OPP completely, and so we
  104. never want that to happen.
  105. If 32 values aren't sufficient for a version hierarchy, than that version
  106. hierarchy can be contained in multiple 32 bit values. i.e. <X Y Z1 Z2> in the
  107. above example, Z1 & Z2 refer to the version hierarchy Z.
  108. - status: Marks the node enabled/disabled.
  109. Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
  110. / {
  111. cpus {
  112. #address-cells = <1>;
  113. #size-cells = <0>;
  114. cpu@0 {
  115. compatible = "arm,cortex-a9";
  116. reg = <0>;
  117. next-level-cache = <&L2>;
  118. clocks = <&clk_controller 0>;
  119. clock-names = "cpu";
  120. cpu-supply = <&cpu_supply0>;
  121. operating-points-v2 = <&cpu0_opp_table>;
  122. };
  123. cpu@1 {
  124. compatible = "arm,cortex-a9";
  125. reg = <1>;
  126. next-level-cache = <&L2>;
  127. clocks = <&clk_controller 0>;
  128. clock-names = "cpu";
  129. cpu-supply = <&cpu_supply0>;
  130. operating-points-v2 = <&cpu0_opp_table>;
  131. };
  132. };
  133. cpu0_opp_table: opp_table0 {
  134. compatible = "operating-points-v2";
  135. opp-shared;
  136. opp@1000000000 {
  137. opp-hz = /bits/ 64 <1000000000>;
  138. opp-microvolt = <970000 975000 985000>;
  139. opp-microamp = <70000>;
  140. clock-latency-ns = <300000>;
  141. opp-suspend;
  142. };
  143. opp@1100000000 {
  144. opp-hz = /bits/ 64 <1100000000>;
  145. opp-microvolt = <980000 1000000 1010000>;
  146. opp-microamp = <80000>;
  147. clock-latency-ns = <310000>;
  148. };
  149. opp@1200000000 {
  150. opp-hz = /bits/ 64 <1200000000>;
  151. opp-microvolt = <1025000>;
  152. clock-latency-ns = <290000>;
  153. turbo-mode;
  154. };
  155. };
  156. };
  157. Example 2: Single cluster, Quad-core Qualcom-krait, switches DVFS states
  158. independently.
  159. / {
  160. cpus {
  161. #address-cells = <1>;
  162. #size-cells = <0>;
  163. cpu@0 {
  164. compatible = "qcom,krait";
  165. reg = <0>;
  166. next-level-cache = <&L2>;
  167. clocks = <&clk_controller 0>;
  168. clock-names = "cpu";
  169. cpu-supply = <&cpu_supply0>;
  170. operating-points-v2 = <&cpu_opp_table>;
  171. };
  172. cpu@1 {
  173. compatible = "qcom,krait";
  174. reg = <1>;
  175. next-level-cache = <&L2>;
  176. clocks = <&clk_controller 1>;
  177. clock-names = "cpu";
  178. cpu-supply = <&cpu_supply1>;
  179. operating-points-v2 = <&cpu_opp_table>;
  180. };
  181. cpu@2 {
  182. compatible = "qcom,krait";
  183. reg = <2>;
  184. next-level-cache = <&L2>;
  185. clocks = <&clk_controller 2>;
  186. clock-names = "cpu";
  187. cpu-supply = <&cpu_supply2>;
  188. operating-points-v2 = <&cpu_opp_table>;
  189. };
  190. cpu@3 {
  191. compatible = "qcom,krait";
  192. reg = <3>;
  193. next-level-cache = <&L2>;
  194. clocks = <&clk_controller 3>;
  195. clock-names = "cpu";
  196. cpu-supply = <&cpu_supply3>;
  197. operating-points-v2 = <&cpu_opp_table>;
  198. };
  199. };
  200. cpu_opp_table: opp_table {
  201. compatible = "operating-points-v2";
  202. /*
  203. * Missing opp-shared property means CPUs switch DVFS states
  204. * independently.
  205. */
  206. opp@1000000000 {
  207. opp-hz = /bits/ 64 <1000000000>;
  208. opp-microvolt = <970000 975000 985000>;
  209. opp-microamp = <70000>;
  210. clock-latency-ns = <300000>;
  211. opp-suspend;
  212. };
  213. opp@1100000000 {
  214. opp-hz = /bits/ 64 <1100000000>;
  215. opp-microvolt = <980000 1000000 1010000>;
  216. opp-microamp = <80000>;
  217. clock-latency-ns = <310000>;
  218. };
  219. opp@1200000000 {
  220. opp-hz = /bits/ 64 <1200000000>;
  221. opp-microvolt = <1025000>;
  222. opp-microamp = <90000;
  223. lock-latency-ns = <290000>;
  224. turbo-mode;
  225. };
  226. };
  227. };
  228. Example 3: Dual-cluster, Dual-core per cluster. CPUs within a cluster switch
  229. DVFS state together.
  230. / {
  231. cpus {
  232. #address-cells = <1>;
  233. #size-cells = <0>;
  234. cpu@0 {
  235. compatible = "arm,cortex-a7";
  236. reg = <0>;
  237. next-level-cache = <&L2>;
  238. clocks = <&clk_controller 0>;
  239. clock-names = "cpu";
  240. cpu-supply = <&cpu_supply0>;
  241. operating-points-v2 = <&cluster0_opp>;
  242. };
  243. cpu@1 {
  244. compatible = "arm,cortex-a7";
  245. reg = <1>;
  246. next-level-cache = <&L2>;
  247. clocks = <&clk_controller 0>;
  248. clock-names = "cpu";
  249. cpu-supply = <&cpu_supply0>;
  250. operating-points-v2 = <&cluster0_opp>;
  251. };
  252. cpu@100 {
  253. compatible = "arm,cortex-a15";
  254. reg = <100>;
  255. next-level-cache = <&L2>;
  256. clocks = <&clk_controller 1>;
  257. clock-names = "cpu";
  258. cpu-supply = <&cpu_supply1>;
  259. operating-points-v2 = <&cluster1_opp>;
  260. };
  261. cpu@101 {
  262. compatible = "arm,cortex-a15";
  263. reg = <101>;
  264. next-level-cache = <&L2>;
  265. clocks = <&clk_controller 1>;
  266. clock-names = "cpu";
  267. cpu-supply = <&cpu_supply1>;
  268. operating-points-v2 = <&cluster1_opp>;
  269. };
  270. };
  271. cluster0_opp: opp_table0 {
  272. compatible = "operating-points-v2";
  273. opp-shared;
  274. opp@1000000000 {
  275. opp-hz = /bits/ 64 <1000000000>;
  276. opp-microvolt = <970000 975000 985000>;
  277. opp-microamp = <70000>;
  278. clock-latency-ns = <300000>;
  279. opp-suspend;
  280. };
  281. opp@1100000000 {
  282. opp-hz = /bits/ 64 <1100000000>;
  283. opp-microvolt = <980000 1000000 1010000>;
  284. opp-microamp = <80000>;
  285. clock-latency-ns = <310000>;
  286. };
  287. opp@1200000000 {
  288. opp-hz = /bits/ 64 <1200000000>;
  289. opp-microvolt = <1025000>;
  290. opp-microamp = <90000>;
  291. clock-latency-ns = <290000>;
  292. turbo-mode;
  293. };
  294. };
  295. cluster1_opp: opp_table1 {
  296. compatible = "operating-points-v2";
  297. opp-shared;
  298. opp@1300000000 {
  299. opp-hz = /bits/ 64 <1300000000>;
  300. opp-microvolt = <1045000 1050000 1055000>;
  301. opp-microamp = <95000>;
  302. clock-latency-ns = <400000>;
  303. opp-suspend;
  304. };
  305. opp@1400000000 {
  306. opp-hz = /bits/ 64 <1400000000>;
  307. opp-microvolt = <1075000>;
  308. opp-microamp = <100000>;
  309. clock-latency-ns = <400000>;
  310. };
  311. opp@1500000000 {
  312. opp-hz = /bits/ 64 <1500000000>;
  313. opp-microvolt = <1010000 1100000 1110000>;
  314. opp-microamp = <95000>;
  315. clock-latency-ns = <400000>;
  316. turbo-mode;
  317. };
  318. };
  319. };
  320. Example 4: Handling multiple regulators
  321. / {
  322. cpus {
  323. cpu@0 {
  324. compatible = "arm,cortex-a7";
  325. ...
  326. cpu-supply = <&cpu_supply0>, <&cpu_supply1>, <&cpu_supply2>;
  327. operating-points-v2 = <&cpu0_opp_table>;
  328. };
  329. };
  330. cpu0_opp_table: opp_table0 {
  331. compatible = "operating-points-v2";
  332. opp-shared;
  333. opp@1000000000 {
  334. opp-hz = /bits/ 64 <1000000000>;
  335. opp-microvolt = <970000>, /* Supply 0 */
  336. <960000>, /* Supply 1 */
  337. <960000>; /* Supply 2 */
  338. opp-microamp = <70000>, /* Supply 0 */
  339. <70000>, /* Supply 1 */
  340. <70000>; /* Supply 2 */
  341. clock-latency-ns = <300000>;
  342. };
  343. /* OR */
  344. opp@1000000000 {
  345. opp-hz = /bits/ 64 <1000000000>;
  346. opp-microvolt = <970000 975000 985000>, /* Supply 0 */
  347. <960000 965000 975000>, /* Supply 1 */
  348. <960000 965000 975000>; /* Supply 2 */
  349. opp-microamp = <70000>, /* Supply 0 */
  350. <70000>, /* Supply 1 */
  351. <70000>; /* Supply 2 */
  352. clock-latency-ns = <300000>;
  353. };
  354. /* OR */
  355. opp@1000000000 {
  356. opp-hz = /bits/ 64 <1000000000>;
  357. opp-microvolt = <970000 975000 985000>, /* Supply 0 */
  358. <960000 965000 975000>, /* Supply 1 */
  359. <960000 965000 975000>; /* Supply 2 */
  360. opp-microamp = <70000>, /* Supply 0 */
  361. <0>, /* Supply 1 doesn't need this */
  362. <70000>; /* Supply 2 */
  363. clock-latency-ns = <300000>;
  364. };
  365. };
  366. };
  367. Example 5: opp-supported-hw
  368. (example: three level hierarchy of versions: cuts, substrate and process)
  369. / {
  370. cpus {
  371. cpu@0 {
  372. compatible = "arm,cortex-a7";
  373. ...
  374. cpu-supply = <&cpu_supply>
  375. operating-points-v2 = <&cpu0_opp_table_slow>;
  376. };
  377. };
  378. opp_table {
  379. compatible = "operating-points-v2";
  380. status = "okay";
  381. opp-shared;
  382. opp@600000000 {
  383. /*
  384. * Supports all substrate and process versions for 0xF
  385. * cuts, i.e. only first four cuts.
  386. */
  387. opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
  388. opp-hz = /bits/ 64 <600000000>;
  389. opp-microvolt = <900000 915000 925000>;
  390. ...
  391. };
  392. opp@800000000 {
  393. /*
  394. * Supports:
  395. * - cuts: only one, 6th cut (represented by 6th bit).
  396. * - substrate: supports 16 different substrate versions
  397. * - process: supports 9 different process versions
  398. */
  399. opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0>
  400. opp-hz = /bits/ 64 <800000000>;
  401. opp-microvolt = <900000 915000 925000>;
  402. ...
  403. };
  404. };
  405. };
  406. Example 6: opp-microvolt-<name>, opp-microamp-<name>:
  407. (example: device with two possible microvolt ranges: slow and fast)
  408. / {
  409. cpus {
  410. cpu@0 {
  411. compatible = "arm,cortex-a7";
  412. ...
  413. operating-points-v2 = <&cpu0_opp_table>;
  414. };
  415. };
  416. cpu0_opp_table: opp_table0 {
  417. compatible = "operating-points-v2";
  418. opp-shared;
  419. opp@1000000000 {
  420. opp-hz = /bits/ 64 <1000000000>;
  421. opp-microvolt-slow = <900000 915000 925000>;
  422. opp-microvolt-fast = <970000 975000 985000>;
  423. opp-microamp-slow = <70000>;
  424. opp-microamp-fast = <71000>;
  425. };
  426. opp@1200000000 {
  427. opp-hz = /bits/ 64 <1200000000>;
  428. opp-microvolt-slow = <900000 915000 925000>, /* Supply vcc0 */
  429. <910000 925000 935000>; /* Supply vcc1 */
  430. opp-microvolt-fast = <970000 975000 985000>, /* Supply vcc0 */
  431. <960000 965000 975000>; /* Supply vcc1 */
  432. opp-microamp = <70000>; /* Will be used for both slow/fast */
  433. };
  434. };
  435. };