1 /* SPDX-License-Identifier: GPL-2.0 */
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
9 #include <linux/types.h>
11 #include "ipa_version.h"
12 #include "ipa_endpoint.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 resources, endpoints, and
24 * Resources are data structures used internally by the IPA hardware. The
25 * configuration data defines the number (or limits of the number) of various
26 * types of these resources.
28 * Endpoint configuration data defines properties of both IPA endpoints and
29 * GSI channels. A channel is a GSI construct, and represents a single
30 * communication path between the IPA and a particular execution environment
31 * (EE), such as the AP or Modem. Each EE has a set of channels associated
32 * with it, and each channel has an ID unique for that EE. For the most part
33 * the only GSI channels of concern to this driver belong to the AP
35 * An endpoint is an IPA construct representing a single channel anywhere
36 * in the system. An IPA endpoint ID maps directly to an (EE, channel_id)
37 * pair. Generally, this driver is concerned with only endpoints associated
38 * with the AP, however this will change when support for routing (etc.) is
39 * added. IPA endpoint and GSI channel configuration data are defined
40 * together, establishing the endpoint_id->(EE, channel_id) mapping.
42 * Endpoint configuration data consists of three parts: properties that
43 * are common to IPA and GSI (EE ID, channel ID, endpoint ID, and direction);
44 * properties associated with the GSI channel; and properties associated with
48 /* The maximum value returned by ipa_resource_group_{src,dst}_count() */
49 #define IPA_RESOURCE_GROUP_SRC_MAX 5
50 #define IPA_RESOURCE_GROUP_DST_MAX 5
53 * struct gsi_channel_data - GSI channel configuration data
54 * @tre_count: number of TREs in the channel ring
55 * @event_count: number of slots in the associated event ring
56 * @tlv_count: number of entries in channel's TLV FIFO
58 * A GSI channel is a unidirectional means of transferring data to or
59 * from (and through) the IPA. A GSI channel has a ring buffer made
60 * up of "transfer elements" (TREs) that specify individual data transfers
61 * or IPA immediate commands. TREs are filled by the AP, and control
62 * is passed to IPA hardware by writing the last written element
63 * into a doorbell register.
65 * When data transfer commands have completed the GSI generates an
66 * event (a structure of data) and optionally signals the AP with
67 * an interrupt. Event structures are implemented by another ring
68 * buffer, directed toward the AP from the IPA.
70 * The input to a GSI channel is a FIFO of type/length/value (TLV)
71 * elements, and the size of this FIFO limits the number of TREs
72 * that can be included in a single transaction.
74 struct gsi_channel_data {
81 * struct ipa_endpoint_tx_data - configuration data for TX endpoints
82 * @status_endpoint: endpoint to which status elements are sent
84 * The @status_endpoint is only valid if the endpoint's @status_enable
87 struct ipa_endpoint_tx_data {
88 enum ipa_endpoint_name status_endpoint;
92 * struct ipa_endpoint_rx_data - configuration data for RX endpoints
93 * @pad_align: power-of-2 boundary to which packet payload is aligned
94 * @aggr_close_eof: whether aggregation closes on end-of-frame
96 * With each packet it transfers, the IPA hardware can perform certain
97 * transformations of its packet data. One of these is adding pad bytes
98 * to the end of the packet data so the result ends on a power-of-2 boundary.
100 * It is also able to aggregate multiple packets into a single receive buffer.
101 * Aggregation is "open" while a buffer is being filled, and "closes" when
102 * certain criteria are met. One of those criteria is the sender indicating
103 * a "frame" consisting of several transfers has ended.
105 struct ipa_endpoint_rx_data {
111 * struct ipa_endpoint_config_data - IPA endpoint hardware configuration
112 * @resource_group: resource group to assign endpoint to
113 * @checksum: whether checksum offload is enabled
114 * @qmap: whether endpoint uses QMAP protocol
115 * @aggregation: whether endpoint supports aggregation
116 * @status_enable: whether endpoint uses status elements
117 * @dma_mode: whether endpoint operates in DMA mode
118 * @dma_endpoint: peer endpoint, if operating in DMA mode
119 * @tx: TX-specific endpoint information (see above)
120 * @rx: RX-specific endpoint information (see above)
122 struct ipa_endpoint_config_data {
129 enum ipa_endpoint_name dma_endpoint;
131 struct ipa_endpoint_tx_data tx;
132 struct ipa_endpoint_rx_data rx;
137 * struct ipa_endpoint_data - IPA endpoint configuration data
138 * @filter_support: whether endpoint supports filtering
139 * @seq_type: hardware sequencer type used for endpoint
140 * @config: hardware configuration (see above)
142 * Not all endpoints support the IPA filtering capability. A filter table
143 * defines the filters to apply for those endpoints that support it. The
144 * AP is responsible for initializing this table, and it must include entries
145 * for non-AP endpoints. For this reason we define *all* endpoints used
146 * in the system, and indicate whether they support filtering.
148 * The remaining endpoint configuration data applies only to AP endpoints.
149 * The IPA hardware is implemented by sequencers, and the AP must program
150 * the type(s) of these sequencers at initialization time. The remaining
151 * endpoint configuration data is defined above.
153 struct ipa_endpoint_data {
155 /* The next two are specified only for AP endpoints */
156 enum ipa_seq_type seq_type;
157 struct ipa_endpoint_config_data config;
161 * struct ipa_gsi_endpoint_data - GSI channel/IPA endpoint data
162 * ee: GSI execution environment ID
163 * channel_id: GSI channel ID
164 * endpoint_id: IPA endpoint ID
165 * toward_ipa: direction of data transfer
166 * gsi: GSI channel configuration data (see above)
167 * ipa: IPA endpoint configuration data (see above)
169 struct ipa_gsi_endpoint_data {
170 u8 ee_id; /* enum gsi_ee_id */
175 struct gsi_channel_data channel;
176 struct ipa_endpoint_data endpoint;
179 /** enum ipa_resource_type_src - source resource types */
180 enum ipa_resource_type_src {
181 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS,
182 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
183 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
184 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
185 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
188 /** enum ipa_resource_type_dst - destination resource types */
189 enum ipa_resource_type_dst {
190 IPA_RESOURCE_TYPE_DST_DATA_SECTORS,
191 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
195 * struct ipa_resource_limits - minimum and maximum resource counts
196 * @min: minimum number of resources of a given type
197 * @max: maximum number of resources of a given type
199 struct ipa_resource_limits {
205 * struct ipa_resource_src - source endpoint group resource usage
206 * @type: source group resource type
207 * @limits: array of limits to use for each resource group
209 struct ipa_resource_src {
210 enum ipa_resource_type_src type;
211 struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_SRC_MAX];
215 * struct ipa_resource_dst - destination endpoint group resource usage
216 * @type: destination group resource type
217 * @limits: array of limits to use for each resource group
219 struct ipa_resource_dst {
220 enum ipa_resource_type_dst type;
221 struct ipa_resource_limits limits[IPA_RESOURCE_GROUP_DST_MAX];
225 * struct ipa_resource_data - IPA resource configuration data
226 * @resource_src_count: number of entries in the resource_src array
227 * @resource_src: source endpoint group resources
228 * @resource_dst_count: number of entries in the resource_dst array
229 * @resource_dst: destination endpoint group resources
231 * In order to manage quality of service between endpoints, certain resources
232 * required for operation are allocated to groups of endpoints. Generally
233 * this information is invisible to the AP, but the AP is responsible for
234 * programming it at initialization time, so we specify it here.
236 struct ipa_resource_data {
237 u32 resource_src_count;
238 const struct ipa_resource_src *resource_src;
239 u32 resource_dst_count;
240 const struct ipa_resource_dst *resource_dst;
244 * struct ipa_mem_data - description of IPA memory regions
245 * @local_count: number of regions defined in the local[] array
246 * @local: array of IPA-local memory region descriptors
247 * @imem_addr: physical address of IPA region within IMEM
248 * @imem_size: size in bytes of IPA IMEM region
249 * @smem_id: item identifier for IPA region within SMEM memory
250 * @imem_size: size in bytes of the IPA SMEM region
252 struct ipa_mem_data {
254 const struct ipa_mem *local;
261 /** enum ipa_interconnect_id - IPA interconnect identifier */
262 enum ipa_interconnect_id {
263 IPA_INTERCONNECT_MEMORY,
264 IPA_INTERCONNECT_IMEM,
265 IPA_INTERCONNECT_CONFIG,
266 IPA_INTERCONNECT_COUNT, /* Last; not an interconnect */
270 * struct ipa_interconnect_data - description of IPA interconnect rates
271 * @peak_rate: Peak interconnect bandwidth (in 1000 byte/sec units)
272 * @average_rate: Average interconnect bandwidth (in 1000 byte/sec units)
274 struct ipa_interconnect_data {
280 * struct ipa_clock_data - description of IPA clock and interconnect rates
281 * @core_clock_rate: Core clock rate (Hz)
282 * @interconnect: Array of interconnect bandwidth parameters
284 struct ipa_clock_data {
286 struct ipa_interconnect_data interconnect[IPA_INTERCONNECT_COUNT];
290 * struct ipa_data - combined IPA/GSI configuration data
291 * @version: IPA hardware version
292 * @endpoint_count: number of entries in endpoint_data array
293 * @endpoint_data: IPA endpoint/GSI channel data
294 * @resource_data: IPA resource configuration data
295 * @mem_count: number of entries in mem_data array
296 * @mem_data: IPA-local shared memory region data
299 enum ipa_version version;
300 u32 endpoint_count; /* # entries in endpoint_data[] */
301 const struct ipa_gsi_endpoint_data *endpoint_data;
302 const struct ipa_resource_data *resource_data;
303 const struct ipa_mem_data *mem_data;
304 const struct ipa_clock_data *clock_data;
307 extern const struct ipa_data ipa_data_sdm845;
308 extern const struct ipa_data ipa_data_sc7180;
310 #endif /* _IPA_DATA_H_ */