1 /* SPDX-License-Identifier: GPL-2.0 */
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2024 Linaro Ltd.
9 #include <linux/types.h>
11 #include "ipa_endpoint.h"
13 #include "ipa_version.h"
16 * DOC: IPA/GSI Configuration Data
18 * Boot-time configuration data is used to define the configuration of the
19 * IPA and GSI resources to use for a given platform. This data is supplied
20 * via the Device Tree match table, associated with a particular compatible
21 * string. The data defines information about how resources, endpoints and
22 * channels, memory, power and so on are allocated and used for the
25 * Resources are data structures used internally by the IPA hardware. The
26 * configuration data defines the number (or limits of the number) of various
27 * types of these resources.
29 * Endpoint configuration data defines properties of both IPA endpoints and
30 * GSI channels. A channel is a GSI construct, and represents a single
31 * communication path between the IPA and a particular execution environment
32 * (EE), such as the AP or Modem. Each EE has a set of channels associated
33 * with it, and each channel has an ID unique for that EE. For the most part
34 * the only GSI channels of concern to this driver belong to the AP.
36 * An endpoint is an IPA construct representing a single channel anywhere
37 * in the system. An IPA endpoint ID maps directly to an (EE, channel_id)
38 * pair. Generally, this driver is concerned with only endpoints associated
39 * with the AP, however this will change when support for routing (etc.) is
40 * added. IPA endpoint and GSI channel configuration data are defined
41 * together, establishing the endpoint_id->(EE, channel_id) mapping.
43 * Endpoint configuration data consists of three parts: properties that
44 * are common to IPA and GSI (EE ID, channel ID, endpoint ID, and direction);
45 * properties associated with the GSI channel; and properties associated with
49 /* The maximum possible number of source or destination resource groups */
50 #define IPA_RESOURCE_GROUP_MAX 8
52 /** enum ipa_qsb_master_id - array index for IPA QSB configuration data */
53 enum ipa_qsb_master_id
{
59 * struct ipa_qsb_data - Qualcomm System Bus configuration data
60 * @max_writes: Maximum outstanding write requests for this master
61 * @max_reads: Maximum outstanding read requests for this master
62 * @max_reads_beats: Max outstanding read bytes in 8-byte "beats" (if non-zero)
67 u8 max_reads_beats
; /* Not present for IPA v3.5.1 */
71 * struct gsi_channel_data - GSI channel configuration data
72 * @tre_count: number of TREs in the channel ring
73 * @event_count: number of slots in the associated event ring
74 * @tlv_count: number of entries in channel's TLV FIFO
76 * A GSI channel is a unidirectional means of transferring data to or
77 * from (and through) the IPA. A GSI channel has a ring buffer made
78 * up of "transfer ring elements" (TREs) that specify individual data
79 * transfers or IPA immediate commands. TREs are filled by the AP,
80 * and control is passed to IPA hardware by writing the last written
81 * element into a doorbell register.
83 * When data transfer commands have completed the GSI generates an
84 * event (a structure of data) and optionally signals the AP with
85 * an interrupt. Event structures are implemented by another ring
86 * buffer, directed toward the AP from the IPA.
88 * The input to a GSI channel is a FIFO of type/length/value (TLV)
89 * elements, and the size of this FIFO limits the number of TREs
90 * that can be included in a single transaction.
92 struct gsi_channel_data
{
93 u16 tre_count
; /* must be a power of 2 */
94 u16 event_count
; /* must be a power of 2 */
99 * struct ipa_endpoint_data - IPA endpoint configuration data
100 * @filter_support: whether endpoint supports filtering
101 * @config: hardware configuration
103 * Not all endpoints support the IPA filtering capability. A filter table
104 * defines the filters to apply for those endpoints that support it. The
105 * AP is responsible for initializing this table, and it must include entries
106 * for non-AP endpoints. For this reason we define *all* endpoints used
107 * in the system, and indicate whether they support filtering.
109 * The remaining endpoint configuration data specifies default hardware
110 * configuration values that apply only to AP endpoints.
112 struct ipa_endpoint_data
{
114 struct ipa_endpoint_config config
;
118 * struct ipa_gsi_endpoint_data - GSI channel/IPA endpoint data
119 * @ee_id: GSI execution environment ID
120 * @channel_id: GSI channel ID
121 * @endpoint_id: IPA endpoint ID
122 * @toward_ipa: direction of data transfer
123 * @channel: GSI channel configuration data (see above)
124 * @endpoint: IPA endpoint configuration data (see above)
126 struct ipa_gsi_endpoint_data
{
127 u8 ee_id
; /* enum gsi_ee_id */
132 struct gsi_channel_data channel
;
133 struct ipa_endpoint_data endpoint
;
137 * struct ipa_resource_limits - minimum and maximum resource counts
138 * @min: minimum number of resources of a given type
139 * @max: maximum number of resources of a given type
141 struct ipa_resource_limits
{
147 * struct ipa_resource - resource group source or destination resource usage
148 * @limits: array of resource limits, indexed by group
150 struct ipa_resource
{
151 struct ipa_resource_limits limits
[IPA_RESOURCE_GROUP_MAX
];
155 * struct ipa_resource_data - IPA resource configuration data
156 * @rsrc_group_src_count: number of source resource groups supported
157 * @rsrc_group_dst_count: number of destination resource groups supported
158 * @resource_src_count: number of entries in the resource_src array
159 * @resource_src: source endpoint group resources
160 * @resource_dst_count: number of entries in the resource_dst array
161 * @resource_dst: destination endpoint group resources
163 * In order to manage quality of service between endpoints, certain resources
164 * required for operation are allocated to groups of endpoints. Generally
165 * this information is invisible to the AP, but the AP is responsible for
166 * programming it at initialization time, so we specify it here.
168 struct ipa_resource_data
{
169 u32 rsrc_group_src_count
;
170 u32 rsrc_group_dst_count
;
171 u32 resource_src_count
;
172 const struct ipa_resource
*resource_src
;
173 u32 resource_dst_count
;
174 const struct ipa_resource
*resource_dst
;
178 * struct ipa_mem_data - description of IPA memory regions
179 * @local_count: number of regions defined in the local[] array
180 * @local: array of IPA-local memory region descriptors
181 * @imem_addr: physical address of IPA region within IMEM
182 * @imem_size: size in bytes of IPA IMEM region
183 * @smem_id: item identifier for IPA region within SMEM memory
184 * @smem_size: size in bytes of the IPA SMEM region
186 struct ipa_mem_data
{
188 const struct ipa_mem
*local
;
196 * struct ipa_interconnect_data - description of IPA interconnect bandwidths
197 * @name: Interconnect name (matches interconnect-name in DT)
198 * @peak_bandwidth: Peak interconnect bandwidth (in 1000 byte/sec units)
199 * @average_bandwidth: Average interconnect bandwidth (in 1000 byte/sec units)
201 struct ipa_interconnect_data
{
204 u32 average_bandwidth
;
208 * struct ipa_power_data - description of IPA power configuration data
209 * @core_clock_rate: Core clock rate (Hz)
210 * @interconnect_count: Number of entries in the interconnect_data array
211 * @interconnect_data: IPA interconnect configuration data
213 struct ipa_power_data
{
215 u32 interconnect_count
; /* # entries in interconnect_data[] */
216 const struct ipa_interconnect_data
*interconnect_data
;
220 * struct ipa_data - combined IPA/GSI configuration data
221 * @version: IPA hardware version
222 * @backward_compat: BCR register value (prior to IPA v4.5 only)
223 * @qsb_count: number of entries in the qsb_data array
224 * @qsb_data: Qualcomm System Bus configuration data
225 * @modem_route_count: number of modem entries in a routing table
226 * @endpoint_count: number of entries in the endpoint_data array
227 * @endpoint_data: IPA endpoint/GSI channel data
228 * @resource_data: IPA resource configuration data
229 * @mem_data: IPA memory region data
230 * @power_data: IPA power data
233 enum ipa_version version
;
235 u32 qsb_count
; /* number of entries in qsb_data[] */
236 const struct ipa_qsb_data
*qsb_data
;
237 u32 modem_route_count
;
238 u32 endpoint_count
; /* number of entries in endpoint_data[] */
239 const struct ipa_gsi_endpoint_data
*endpoint_data
;
240 const struct ipa_resource_data
*resource_data
;
241 const struct ipa_mem_data
*mem_data
;
242 const struct ipa_power_data
*power_data
;
245 extern const struct ipa_data ipa_data_v3_1
;
246 extern const struct ipa_data ipa_data_v3_5_1
;
247 extern const struct ipa_data ipa_data_v4_2
;
248 extern const struct ipa_data ipa_data_v4_5
;
249 extern const struct ipa_data ipa_data_v4_7
;
250 extern const struct ipa_data ipa_data_v4_9
;
251 extern const struct ipa_data ipa_data_v4_11
;
252 extern const struct ipa_data ipa_data_v5_0
;
253 extern const struct ipa_data ipa_data_v5_5
;
255 #endif /* _IPA_DATA_H_ */