1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/cpufreq/qcom-cpufreq-nvmem.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm Technologies, Inc. NVMEM CPUFreq
8
9maintainers:
10  - Ilia Lin <ilia.lin@kernel.org>
11
12description: |
13  In certain Qualcomm Technologies, Inc. SoCs such as QCS404, The CPU supply
14  voltage is dynamically configured by Core Power Reduction (CPR) depending on
15  current CPU frequency and efuse values.
16  CPR provides a power domain with multiple levels that are selected depending
17  on the CPU OPP in use. The CPUFreq driver sets the CPR power domain level
18  according to the required OPPs defined in the CPU OPP tables.
19
20  For old implementation efuses are parsed to select the correct opp table and
21  voltage and CPR is not supported/used.
22
23select:
24  properties:
25    compatible:
26      contains:
27        enum:
28          - qcom,apq8064
29          - qcom,apq8096
30          - qcom,ipq8064
31          - qcom,ipq8074
32          - qcom,msm8939
33          - qcom,msm8960
34          - qcom,msm8974
35          - qcom,msm8996
36          - qcom,qcs404
37  required:
38    - compatible
39
40patternProperties:
41  '^opp-table(-[a-z0-9]+)?$':
42    allOf:
43      - if:
44          properties:
45            compatible:
46              const: operating-points-v2-kryo-cpu
47        then:
48          $ref: /schemas/opp/opp-v2-kryo-cpu.yaml#
49
50      - if:
51          properties:
52            compatible:
53              const: operating-points-v2-qcom-level
54        then:
55          $ref: /schemas/opp/opp-v2-qcom-level.yaml#
56
57    unevaluatedProperties: false
58
59allOf:
60  - if:
61      properties:
62        compatible:
63          contains:
64            enum:
65              - qcom,qcs404
66
67    then:
68      properties:
69        cpus:
70          type: object
71
72          patternProperties:
73            '^cpu@[0-9a-f]+$':
74              type: object
75
76              properties:
77                power-domains:
78                  maxItems: 1
79
80                power-domain-names:
81                  items:
82                    - const: cpr
83
84              required:
85                - power-domains
86                - power-domain-names
87
88      patternProperties:
89        '^opp-table(-[a-z0-9]+)?$':
90          if:
91            properties:
92              compatible:
93                const: operating-points-v2-kryo-cpu
94          then:
95            patternProperties:
96              '^opp-?[0-9]+$':
97                required:
98                  - required-opps
99
100additionalProperties: true
101
102examples:
103  - |
104    / {
105        model = "Qualcomm Technologies, Inc. QCS404 EVB 1000";
106        compatible = "qcom,qcs404-evb-1000", "qcom,qcs404-evb", "qcom,qcs404";
107        #address-cells = <2>;
108        #size-cells = <2>;
109
110        cpus {
111            #address-cells = <1>;
112            #size-cells = <0>;
113
114            CPU0: cpu@100 {
115                device_type = "cpu";
116                compatible = "arm,cortex-a53";
117                reg = <0x100>;
118                enable-method = "psci";
119                cpu-idle-states = <&CPU_SLEEP_0>;
120                next-level-cache = <&L2_0>;
121                #cooling-cells = <2>;
122                clocks = <&apcs_glb>;
123                operating-points-v2 = <&cpu_opp_table>;
124                power-domains = <&cpr>;
125                power-domain-names = "cpr";
126            };
127
128            CPU1: cpu@101 {
129                device_type = "cpu";
130                compatible = "arm,cortex-a53";
131                reg = <0x101>;
132                enable-method = "psci";
133                cpu-idle-states = <&CPU_SLEEP_0>;
134                next-level-cache = <&L2_0>;
135                #cooling-cells = <2>;
136                clocks = <&apcs_glb>;
137                operating-points-v2 = <&cpu_opp_table>;
138                power-domains = <&cpr>;
139                power-domain-names = "cpr";
140            };
141
142            CPU2: cpu@102 {
143                device_type = "cpu";
144                compatible = "arm,cortex-a53";
145                reg = <0x102>;
146                enable-method = "psci";
147                cpu-idle-states = <&CPU_SLEEP_0>;
148                next-level-cache = <&L2_0>;
149                #cooling-cells = <2>;
150                clocks = <&apcs_glb>;
151                operating-points-v2 = <&cpu_opp_table>;
152                power-domains = <&cpr>;
153                power-domain-names = "cpr";
154            };
155
156            CPU3: cpu@103 {
157                device_type = "cpu";
158                compatible = "arm,cortex-a53";
159                reg = <0x103>;
160                enable-method = "psci";
161                cpu-idle-states = <&CPU_SLEEP_0>;
162                next-level-cache = <&L2_0>;
163                #cooling-cells = <2>;
164                clocks = <&apcs_glb>;
165                operating-points-v2 = <&cpu_opp_table>;
166                power-domains = <&cpr>;
167                power-domain-names = "cpr";
168            };
169        };
170
171        cpu_opp_table: opp-table-cpu {
172            compatible = "operating-points-v2-kryo-cpu";
173            opp-shared;
174
175            opp-1094400000 {
176                opp-hz = /bits/ 64 <1094400000>;
177                required-opps = <&cpr_opp1>;
178            };
179            opp-1248000000 {
180                opp-hz = /bits/ 64 <1248000000>;
181                required-opps = <&cpr_opp2>;
182            };
183            opp-1401600000 {
184                opp-hz = /bits/ 64 <1401600000>;
185                required-opps = <&cpr_opp3>;
186            };
187        };
188
189        cpr_opp_table: opp-table-cpr {
190            compatible = "operating-points-v2-qcom-level";
191
192            cpr_opp1: opp1 {
193                opp-level = <1>;
194                qcom,opp-fuse-level = <1>;
195            };
196            cpr_opp2: opp2 {
197                opp-level = <2>;
198                qcom,opp-fuse-level = <2>;
199            };
200            cpr_opp3: opp3 {
201                opp-level = <3>;
202                qcom,opp-fuse-level = <3>;
203            };
204        };
205    };
206