1# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/net/qcom,ipa.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm IP Accelerator (IPA)
8
9maintainers:
10  - Alex Elder <elder@kernel.org>
11
12description:
13  This binding describes the Qualcomm IPA.  The IPA is capable of offloading
14  certain network processing tasks (e.g. filtering, routing, and NAT) from
15  the main processor.
16
17  The IPA sits between multiple independent "execution environments,"
18  including the Application Processor (AP) and the modem.  The IPA presents
19  a Generic Software Interface (GSI) to each execution environment.
20  The GSI is an integral part of the IPA, but it is logically isolated
21  and has a distinct interrupt and a separately-defined address space.
22
23  See also soc/qcom/qcom,smp2p.txt and interconnect/interconnect.txt.  See
24  iommu/iommu.txt and iommu/arm,smmu.yaml for more information about SMMU
25  bindings.
26
27
28  - |
29    --------             ---------
30    |      |             |       |
31    |  AP  +<---.   .----+ Modem |
32    |      +--. |   | .->+       |
33    |      |  | |   | |  |       |
34    --------  | |   | |  ---------
35              v |   v |
36            --+-+---+-+--
37            |    GSI    |
38            |-----------|
39            |           |
40            |    IPA    |
41            |           |
42            -------------
43
44properties:
45  compatible:
46    enum:
47      - qcom,msm8998-ipa
48      - qcom,sc7180-ipa
49      - qcom,sc7280-ipa
50      - qcom,sdm845-ipa
51      - qcom,sdx55-ipa
52      - qcom,sdx65-ipa
53      - qcom,sm6350-ipa
54      - qcom,sm8350-ipa
55
56  reg:
57    items:
58      - description: IPA registers
59      - description: IPA shared memory
60      - description: GSI registers
61
62  reg-names:
63    items:
64      - const: ipa-reg
65      - const: ipa-shared
66      - const: gsi
67
68  iommus:
69    minItems: 1
70    maxItems: 2
71
72  clocks:
73    maxItems: 1
74
75  clock-names:
76    const: core
77
78  interrupts:
79    items:
80      - description: IPA interrupt (hardware IRQ)
81      - description: GSI interrupt (hardware IRQ)
82      - description: Modem clock query interrupt (smp2p interrupt)
83      - description: Modem setup ready interrupt (smp2p interrupt)
84
85  interrupt-names:
86    items:
87      - const: ipa
88      - const: gsi
89      - const: ipa-clock-query
90      - const: ipa-setup-ready
91
92  interconnects:
93    oneOf:
94      - items:
95          - description: Path leading to system memory
96          - description: Path between the AP and IPA config space
97      - items:
98          - description: Path leading to system memory
99          - description: Path leading to internal memory
100          - description: Path between the AP and IPA config space
101
102  interconnect-names:
103    oneOf:
104      - items:
105          - const: memory
106          - const: config
107      - items:
108          - const: memory
109          - const: imem
110          - const: config
111
112  qcom,qmp:
113    $ref: /schemas/types.yaml#/definitions/phandle
114    description: phandle to the AOSS side-channel message RAM
115
116  qcom,smem-states:
117    $ref: /schemas/types.yaml#/definitions/phandle-array
118    description: State bits used in by the AP to signal the modem.
119    items:
120      - description: Whether the "ipa-clock-enabled" state bit is valid
121      - description: Whether the IPA clock is enabled (if valid)
122
123  qcom,smem-state-names:
124    description: The names of the state bits used for SMP2P output
125    items:
126      - const: ipa-clock-enabled-valid
127      - const: ipa-clock-enabled
128
129  qcom,gsi-loader:
130    enum:
131      - self
132      - modem
133      - skip
134    description:
135      Indicates how GSI firmware should be loaded.  If the AP loads
136      and validates GSI firmware, this property has value "self".
137      If the modem does this, this property has value "modem".
138      Otherwise, "skip" means GSI firmware loading is not required.
139
140  modem-init:
141    deprecated: true
142    type: boolean
143    description:
144      This is the older (deprecated) way of indicating how GSI firmware
145      should be loaded.  If present, the modem loads GSI firmware; if
146      absent, the AP loads GSI firmware.
147
148  memory-region:
149    maxItems: 1
150    description:
151      If present, a phandle for a reserved memory area that holds
152      the firmware passed to Trust Zone for authentication.  Required
153      when the AP (not the modem) performs early initialization.
154
155  firmware-name:
156    $ref: /schemas/types.yaml#/definitions/string
157    description:
158      If present, name (or relative path) of the file within the
159      firmware search path containing the firmware image used when
160      initializing IPA hardware.  Optional, and only used when
161      Trust Zone performs early initialization.
162
163required:
164  - compatible
165  - iommus
166  - reg
167  - clocks
168  - interrupts
169  - interconnects
170  - qcom,smem-states
171
172allOf:
173  # If qcom,gsi-loader is present, modem-init must not be present
174  - if:
175      required:
176        - qcom,gsi-loader
177    then:
178      properties:
179        modem-init: false
180
181      # If qcom,gsi-loader is "self", the AP loads GSI firmware, and
182      # memory-region must be specified
183      if:
184        properties:
185          qcom,gsi-loader:
186            contains:
187              const: self
188      then:
189        required:
190          - memory-region
191    else:
192      # If qcom,gsi-loader is not present, we use deprecated behavior.
193      # If modem-init is not present, the AP loads GSI firmware, and
194      # memory-region must be specified.
195      if:
196        not:
197          required:
198            - modem-init
199      then:
200        required:
201          - memory-region
202
203additionalProperties: false
204
205examples:
206  - |
207        #include <dt-bindings/interrupt-controller/arm-gic.h>
208        #include <dt-bindings/clock/qcom,rpmh.h>
209        #include <dt-bindings/interconnect/qcom,sdm845.h>
210
211        smp2p-mpss {
212                compatible = "qcom,smp2p";
213                interrupts = <GIC_SPI 576 IRQ_TYPE_EDGE_RISING>;
214                mboxes = <&apss_shared 6>;
215                qcom,smem = <94>, <432>;
216                qcom,local-pid = <0>;
217                qcom,remote-pid = <5>;
218
219                ipa_smp2p_out: ipa-ap-to-modem {
220                        qcom,entry-name = "ipa";
221                        #qcom,smem-state-cells = <1>;
222                };
223
224                ipa_smp2p_in: ipa-modem-to-ap {
225                        qcom,entry-name = "ipa";
226                        interrupt-controller;
227                        #interrupt-cells = <2>;
228                };
229        };
230
231        ipa@1e40000 {
232                compatible = "qcom,sc7180-ipa";
233
234                qcom,gsi-loader = "self";
235                memory-region = <&ipa_fw_mem>;
236                firmware-name = "qcom/sc7180-trogdor/modem/modem.mdt";
237
238                iommus = <&apps_smmu 0x440 0x0>,
239                         <&apps_smmu 0x442 0x0>;
240                reg = <0x1e40000 0x7000>,
241                      <0x1e47000 0x2000>,
242                      <0x1e04000 0x2c000>;
243                reg-names = "ipa-reg",
244                            "ipa-shared",
245                            "gsi";
246
247                interrupts-extended = <&intc GIC_SPI 311 IRQ_TYPE_EDGE_RISING>,
248                                      <&intc GIC_SPI 432 IRQ_TYPE_LEVEL_HIGH>,
249                                      <&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
250                                      <&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
251                interrupt-names = "ipa",
252                                  "gsi",
253                                  "ipa-clock-query",
254                                  "ipa-setup-ready";
255
256                clocks = <&rpmhcc RPMH_IPA_CLK>;
257                clock-names = "core";
258
259                interconnects =
260                        <&aggre2_noc MASTER_IPA 0 &mc_virt SLAVE_EBI1 0>,
261                        <&aggre2_noc MASTER_IPA 0 &system_noc SLAVE_IMEM 0>,
262                        <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_IPA_CFG 0>;
263                interconnect-names = "memory",
264                                     "imem",
265                                     "config";
266
267                qcom,qmp = <&aoss_qmp>;
268
269                qcom,smem-states = <&ipa_smp2p_out 0>,
270                                   <&ipa_smp2p_out 1>;
271                qcom,smem-state-names = "ipa-clock-enabled-valid",
272                                        "ipa-clock-enabled";
273        };
274