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,sc7180-ipa
48      - qcom,sc7280-ipa
49      - qcom,sdm845-ipa
50      - qcom,sdx55-ipa
51      - qcom,sm8350-ipa
52
53  reg:
54    items:
55      - description: IPA registers
56      - description: IPA shared memory
57      - description: GSI registers
58
59  reg-names:
60    items:
61      - const: ipa-reg
62      - const: ipa-shared
63      - const: gsi
64
65  iommus:
66    maxItems: 1
67
68  clocks:
69    maxItems: 1
70
71  clock-names:
72    const: core
73
74  interrupts:
75    items:
76      - description: IPA interrupt (hardware IRQ)
77      - description: GSI interrupt (hardware IRQ)
78      - description: Modem clock query interrupt (smp2p interrupt)
79      - description: Modem setup ready interrupt (smp2p interrupt)
80
81  interrupt-names:
82    items:
83      - const: ipa
84      - const: gsi
85      - const: ipa-clock-query
86      - const: ipa-setup-ready
87
88  interconnects:
89    items:
90      - description: Interconnect path between IPA and main memory
91      - description: Interconnect path between IPA and internal memory
92      - description: Interconnect path between IPA and the AP subsystem
93
94  interconnect-names:
95    items:
96      - const: memory
97      - const: imem
98      - const: config
99
100  qcom,smem-states:
101    $ref: /schemas/types.yaml#/definitions/phandle-array
102    description: State bits used in by the AP to signal the modem.
103    items:
104      - description: Whether the "ipa-clock-enabled" state bit is valid
105      - description: Whether the IPA clock is enabled (if valid)
106
107  qcom,smem-state-names:
108    description: The names of the state bits used for SMP2P output
109    items:
110      - const: ipa-clock-enabled-valid
111      - const: ipa-clock-enabled
112
113  modem-init:
114    type: boolean
115    description:
116      If present, it indicates that the modem is responsible for
117      performing early IPA initialization, including loading and
118      validating firwmare used by the GSI.
119
120  memory-region:
121    maxItems: 1
122    description:
123      If present, a phandle for a reserved memory area that holds
124      the firmware passed to Trust Zone for authentication.  Required
125      when Trust Zone (not the modem) performs early initialization.
126
127  firmware-name:
128    $ref: /schemas/types.yaml#/definitions/string
129    description:
130      If present, name (or relative path) of the file within the
131      firmware search path containing the firmware image used when
132      initializing IPA hardware.  Optional, and only used when
133      Trust Zone performs early initialization.
134
135required:
136  - compatible
137  - iommus
138  - reg
139  - clocks
140  - interrupts
141  - interconnects
142  - qcom,smem-states
143
144# Either modem-init is present, or memory-region must be present.
145oneOf:
146  - required:
147      - modem-init
148  - required:
149      - memory-region
150
151# If memory-region is present, firmware-name may optionally be present.
152# But if modem-init is present, firmware-name must not be present.
153if:
154  required:
155    - modem-init
156then:
157  not:
158    required:
159      - firmware-name
160
161additionalProperties: false
162
163examples:
164  - |
165        #include <dt-bindings/interrupt-controller/arm-gic.h>
166        #include <dt-bindings/clock/qcom,rpmh.h>
167        #include <dt-bindings/interconnect/qcom,sdm845.h>
168
169        smp2p-mpss {
170                compatible = "qcom,smp2p";
171                ipa_smp2p_out: ipa-ap-to-modem {
172                        qcom,entry-name = "ipa";
173                        #qcom,smem-state-cells = <1>;
174                };
175
176                ipa_smp2p_in: ipa-modem-to-ap {
177                        qcom,entry-name = "ipa";
178                        interrupt-controller;
179                        #interrupt-cells = <2>;
180                };
181        };
182        ipa@1e40000 {
183                compatible = "qcom,sdm845-ipa";
184
185                modem-init;
186
187                iommus = <&apps_smmu 0x720 0x3>;
188                reg = <0x1e40000 0x7000>,
189                        <0x1e47000 0x2000>,
190                        <0x1e04000 0x2c000>;
191                reg-names = "ipa-reg",
192                            "ipa-shared",
193                            "gsi";
194
195                interrupts-extended = <&intc GIC_SPI 311 IRQ_TYPE_EDGE_RISING>,
196                                      <&intc GIC_SPI 432 IRQ_TYPE_LEVEL_HIGH>,
197                                      <&ipa_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
198                                      <&ipa_smp2p_in 1 IRQ_TYPE_EDGE_RISING>;
199                interrupt-names = "ipa",
200                                  "gsi",
201                                  "ipa-clock-query",
202                                  "ipa-setup-ready";
203
204                clocks = <&rpmhcc RPMH_IPA_CLK>;
205                clock-names = "core";
206
207                interconnects =
208                        <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>,
209                        <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>,
210                        <&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>;
211                interconnect-names = "memory",
212                                     "imem",
213                                     "config";
214
215                qcom,smem-states = <&ipa_smp2p_out 0>,
216                                   <&ipa_smp2p_out 1>;
217                qcom,smem-state-names = "ipa-clock-enabled-valid",
218                                        "ipa-clock-enabled";
219        };
220