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    oneOf:
47      - enum:
48          - qcom,msm8998-ipa
49          - qcom,sc7180-ipa
50          - qcom,sc7280-ipa
51          - qcom,sdm845-ipa
52          - qcom,sdx55-ipa
53          - qcom,sdx65-ipa
54          - qcom,sm6350-ipa
55          - qcom,sm8350-ipa
56          - qcom,sm8550-ipa
57      - items:
58          - enum:
59              - qcom,sm8650-ipa
60          - const: qcom,sm8550-ipa
61
62  reg:
63    items:
64      - description: IPA registers
65      - description: IPA shared memory
66      - description: GSI registers
67
68  reg-names:
69    items:
70      - const: ipa-reg
71      - const: ipa-shared
72      - const: gsi
73
74  iommus:
75    minItems: 1
76    maxItems: 2
77
78  clocks:
79    maxItems: 1
80
81  clock-names:
82    const: core
83
84  interrupts:
85    items:
86      - description: IPA interrupt (hardware IRQ)
87      - description: GSI interrupt (hardware IRQ)
88      - description: Modem clock query interrupt (smp2p interrupt)
89      - description: Modem setup ready interrupt (smp2p interrupt)
90
91  interrupt-names:
92    items:
93      - const: ipa
94      - const: gsi
95      - const: ipa-clock-query
96      - const: ipa-setup-ready
97
98  interconnects:
99    oneOf:
100      - items:
101          - description: Path leading to system memory
102          - description: Path between the AP and IPA config space
103      - items:
104          - description: Path leading to system memory
105          - description: Path leading to internal memory
106          - description: Path between the AP and IPA config space
107
108  interconnect-names:
109    oneOf:
110      - items:
111          - const: memory
112          - const: config
113      - items:
114          - const: memory
115          - const: imem
116          - const: config
117
118  qcom,qmp:
119    $ref: /schemas/types.yaml#/definitions/phandle
120    description: phandle to the AOSS side-channel message RAM
121
122  qcom,smem-states:
123    $ref: /schemas/types.yaml#/definitions/phandle-array
124    description: State bits used in by the AP to signal the modem.
125    items:
126      - description: Whether the "ipa-clock-enabled" state bit is valid
127      - description: Whether the IPA clock is enabled (if valid)
128
129  qcom,smem-state-names:
130    description: The names of the state bits used for SMP2P output
131    items:
132      - const: ipa-clock-enabled-valid
133      - const: ipa-clock-enabled
134
135  qcom,gsi-loader:
136    enum:
137      - self
138      - modem
139      - skip
140    description:
141      Indicates how GSI firmware should be loaded.  If the AP loads
142      and validates GSI firmware, this property has value "self".
143      If the modem does this, this property has value "modem".
144      Otherwise, "skip" means GSI firmware loading is not required.
145
146  modem-init:
147    deprecated: true
148    type: boolean
149    description:
150      This is the older (deprecated) way of indicating how GSI firmware
151      should be loaded.  If present, the modem loads GSI firmware; if
152      absent, the AP loads GSI firmware.
153
154  memory-region:
155    maxItems: 1
156    description:
157      If present, a phandle for a reserved memory area that holds
158      the firmware passed to Trust Zone for authentication.  Required
159      when the AP (not the modem) performs early initialization.
160
161  firmware-name:
162    maxItems: 1
163    description:
164      If present, name (or relative path) of the file within the
165      firmware search path containing the firmware image used when
166      initializing IPA hardware.  Optional, and only used when
167      Trust Zone performs early initialization.
168
169required:
170  - compatible
171  - iommus
172  - reg
173  - clocks
174  - interrupts
175  - interconnects
176  - qcom,smem-states
177
178allOf:
179  # If qcom,gsi-loader is present, modem-init must not be present
180  - if:
181      required:
182        - qcom,gsi-loader
183    then:
184      properties:
185        modem-init: false
186
187      # If qcom,gsi-loader is "self", the AP loads GSI firmware, and
188      # memory-region must be specified
189      if:
190        properties:
191          qcom,gsi-loader:
192            contains:
193              const: self
194      then:
195        required:
196          - memory-region
197    else:
198      # If qcom,gsi-loader is not present, we use deprecated behavior.
199      # If modem-init is not present, the AP loads GSI firmware, and
200      # memory-region must be specified.
201      if:
202        not:
203          required:
204            - modem-init
205      then:
206        required:
207          - memory-region
208
209additionalProperties: false
210
211examples:
212  - |
213        #include <dt-bindings/interrupt-controller/arm-gic.h>
214        #include <dt-bindings/clock/qcom,rpmh.h>
215        #include <dt-bindings/interconnect/qcom,sdm845.h>
216
217        smp2p-mpss {
218                compatible = "qcom,smp2p";
219                interrupts = <GIC_SPI 576 IRQ_TYPE_EDGE_RISING>;
220                mboxes = <&apss_shared 6>;
221                qcom,smem = <94>, <432>;
222                qcom,local-pid = <0>;
223                qcom,remote-pid = <5>;
224
225                ipa_smp2p_out: ipa-ap-to-modem {
226                        qcom,entry-name = "ipa";
227                        #qcom,smem-state-cells = <1>;
228                };
229
230                ipa_smp2p_in: ipa-modem-to-ap {
231                        qcom,entry-name = "ipa";
232                        interrupt-controller;
233                        #interrupt-cells = <2>;
234                };
235        };
236
237        ipa@1e40000 {
238                compatible = "qcom,sc7180-ipa";
239
240                qcom,gsi-loader = "self";
241                memory-region = <&ipa_fw_mem>;
242                firmware-name = "qcom/sc7180-trogdor/modem/modem.mdt";
243
244                iommus = <&apps_smmu 0x440 0x0>,
245                         <&apps_smmu 0x442 0x0>;
246                reg = <0x1e40000 0x7000>,
247                      <0x1e47000 0x2000>,
248                      <0x1e04000 0x2c000>;
249                reg-names = "ipa-reg",
250                            "ipa-shared",
251                            "gsi";
252
253                interrupts-extended = <&intc GIC_SPI 311 IRQ_TYPE_EDGE_RISING>,
254                                      <&intc GIC_SPI 432 IRQ_TYPE_LEVEL_HIGH>,
255                                      <&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
256                                      <&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
257                interrupt-names = "ipa",
258                                  "gsi",
259                                  "ipa-clock-query",
260                                  "ipa-setup-ready";
261
262                clocks = <&rpmhcc RPMH_IPA_CLK>;
263                clock-names = "core";
264
265                interconnects =
266                        <&aggre2_noc MASTER_IPA 0 &mc_virt SLAVE_EBI1 0>,
267                        <&aggre2_noc MASTER_IPA 0 &system_noc SLAVE_IMEM 0>,
268                        <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_IPA_CFG 0>;
269                interconnect-names = "memory",
270                                     "imem",
271                                     "config";
272
273                qcom,qmp = <&aoss_qmp>;
274
275                qcom,smem-states = <&ipa_smp2p_out 0>,
276                                   <&ipa_smp2p_out 1>;
277                qcom,smem-state-names = "ipa-clock-enabled-valid",
278                                        "ipa-clock-enabled";
279        };
280