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