blob: 6a5e85b63c079f823c0002fa45a6b15cdad19863 [file] [log] [blame]
Ghanim Fodi37b64952017-01-24 15:42:30 +02001/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
Amir Levy9659e592016-10-27 18:08:27 +03002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <net/ip.h>
14#include <linux/genalloc.h> /* gen_pool_alloc() */
15#include <linux/io.h>
16#include <linux/ratelimit.h>
17#include <linux/msm-bus.h>
18#include <linux/msm-bus-board.h>
19#include <linux/msm_gsi.h>
20#include <linux/elf.h>
21#include "ipa_i.h"
22#include "ipahal/ipahal.h"
23#include "ipahal/ipahal_fltrt.h"
Skylar Chang6f6e3072017-07-28 10:03:47 -070024#include "ipahal/ipahal_hw_stats.h"
Amir Levy9659e592016-10-27 18:08:27 +030025#include "../ipa_rm_i.h"
26
Skylar Chang448d8b82017-08-08 17:30:32 -070027#define IPA_V3_0_CLK_RATE_SVS2 (37.5 * 1000 * 1000UL)
Amir Levy9659e592016-10-27 18:08:27 +030028#define IPA_V3_0_CLK_RATE_SVS (75 * 1000 * 1000UL)
29#define IPA_V3_0_CLK_RATE_NOMINAL (150 * 1000 * 1000UL)
30#define IPA_V3_0_CLK_RATE_TURBO (200 * 1000 * 1000UL)
Skylar Changf88124c2017-07-18 18:11:25 -070031
Skylar Chang448d8b82017-08-08 17:30:32 -070032#define IPA_V3_5_CLK_RATE_SVS2 (100 * 1000 * 1000UL)
Skylar Changf88124c2017-07-18 18:11:25 -070033#define IPA_V3_5_CLK_RATE_SVS (200 * 1000 * 1000UL)
34#define IPA_V3_5_CLK_RATE_NOMINAL (400 * 1000 * 1000UL)
35#define IPA_V3_5_CLK_RATE_TURBO (42640 * 10 * 1000UL)
36
Skylar Chang448d8b82017-08-08 17:30:32 -070037#define IPA_V4_0_CLK_RATE_SVS2 (60 * 1000 * 1000UL)
Skylar Changf88124c2017-07-18 18:11:25 -070038#define IPA_V4_0_CLK_RATE_SVS (125 * 1000 * 1000UL)
39#define IPA_V4_0_CLK_RATE_NOMINAL (220 * 1000 * 1000UL)
40#define IPA_V4_0_CLK_RATE_TURBO (250 * 1000 * 1000UL)
41
Amir Levy9659e592016-10-27 18:08:27 +030042#define IPA_V3_0_MAX_HOLB_TMR_VAL (4294967296 - 1)
43
44#define IPA_V3_0_BW_THRESHOLD_TURBO_MBPS (1000)
45#define IPA_V3_0_BW_THRESHOLD_NOMINAL_MBPS (600)
Skylar Chang448d8b82017-08-08 17:30:32 -070046#define IPA_V3_0_BW_THRESHOLD_SVS_MBPS (310)
Amir Levy9659e592016-10-27 18:08:27 +030047
48#define IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_BMASK 0xFF0000
49#define IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT 0x10
50
51/* Max pipes + ICs for TAG process */
52#define IPA_TAG_MAX_DESC (IPA3_MAX_NUM_PIPES + 6)
53
54#define IPA_TAG_SLEEP_MIN_USEC (1000)
55#define IPA_TAG_SLEEP_MAX_USEC (2000)
56#define IPA_FORCE_CLOSE_TAG_PROCESS_TIMEOUT (10 * HZ)
57#define IPA_BCR_REG_VAL_v3_0 (0x00000001)
58#define IPA_BCR_REG_VAL_v3_5 (0x0000003B)
Michael Adisumarta891a4ff2017-05-16 16:40:06 -070059#define IPA_BCR_REG_VAL_v4_0 (0x00000039)
Michael Adisumartad68ab112017-06-14 11:40:06 -070060#define IPA_CLKON_CFG_v4_0 (0x30000000)
Amir Levy9659e592016-10-27 18:08:27 +030061#define IPA_AGGR_GRAN_MIN (1)
62#define IPA_AGGR_GRAN_MAX (32)
63#define IPA_EOT_COAL_GRAN_MIN (1)
64#define IPA_EOT_COAL_GRAN_MAX (16)
65
Gidon Studinski3021a6f2016-11-10 12:48:48 +020066#define IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC (15)
67
Amir Levy9659e592016-10-27 18:08:27 +030068#define IPA_AGGR_BYTE_LIMIT (\
69 IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_BMSK >> \
70 IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_SHFT)
71#define IPA_AGGR_PKT_LIMIT (\
72 IPA_ENDP_INIT_AGGR_n_AGGR_PKT_LIMIT_BMSK >> \
73 IPA_ENDP_INIT_AGGR_n_AGGR_PKT_LIMIT_SHFT)
74
75/* In IPAv3 only endpoints 0-3 can be configured to deaggregation */
76#define IPA_EP_SUPPORTS_DEAGGR(idx) ((idx) >= 0 && (idx) <= 3)
77
78/* configure IPA spare register 1 in order to have correct IPA version
79 * set bits 0,2,3 and 4. see SpareBits documentation.xlsx
80 */
Amir Levy9659e592016-10-27 18:08:27 +030081
82/* HPS, DPS sequencers Types*/
83#define IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY 0x00000000
84/* DMA + DECIPHER/CIPHER */
85#define IPA_DPS_HPS_SEQ_TYPE_DMA_DEC 0x00000011
86/* Packet Processing + no decipher + uCP (for Ethernet Bridging) */
87#define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP 0x00000002
88/* Packet Processing + decipher + uCP */
89#define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_DEC_UCP 0x00000013
90/* 2 Packet Processing pass + no decipher + uCP */
91#define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP 0x00000004
92/* 2 Packet Processing pass + decipher + uCP */
93#define IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_DEC_UCP 0x00000015
94/* Packet Processing + no decipher + no uCP */
95#define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_NO_UCP 0x00000006
96/* Packet Processing + no decipher + no uCP */
97#define IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_DEC_NO_UCP 0x00000017
98/* COMP/DECOMP */
99#define IPA_DPS_HPS_SEQ_TYPE_DMA_COMP_DECOMP 0x00000020
100/* Invalid sequencer type */
101#define IPA_DPS_HPS_SEQ_TYPE_INVALID 0xFFFFFFFF
102
103#define IPA_DPS_HPS_SEQ_TYPE_IS_DMA(seq_type) \
104 (seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY || \
105 seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_DEC || \
106 seq_type == IPA_DPS_HPS_SEQ_TYPE_DMA_COMP_DECOMP)
107
108#define QMB_MASTER_SELECT_DDR (0)
109#define QMB_MASTER_SELECT_PCIE (1)
110
Amir Levy9659e592016-10-27 18:08:27 +0300111/* Resource Group index*/
Amir Levy0f97a5c2016-11-22 11:13:37 +0200112#define IPA_v3_0_GROUP_UL (0)
113#define IPA_v3_0_GROUP_DL (1)
114#define IPA_v3_0_GROUP_DPL IPA_v3_0_GROUP_DL
115#define IPA_v3_0_GROUP_DIAG (2)
116#define IPA_v3_0_GROUP_DMA (3)
117#define IPA_v3_0_GROUP_IMM_CMD IPA_v3_0_GROUP_UL
118#define IPA_v3_0_GROUP_Q6ZIP (4)
119#define IPA_v3_0_GROUP_Q6ZIP_GENERAL IPA_v3_0_GROUP_Q6ZIP
120#define IPA_v3_0_GROUP_UC_RX_Q (5)
121#define IPA_v3_0_GROUP_Q6ZIP_ENGINE IPA_v3_0_GROUP_UC_RX_Q
122#define IPA_v3_0_GROUP_MAX (6)
123
Amir Levy54fe4d32017-03-16 11:21:49 +0200124#define IPA_v3_5_GROUP_LWA_DL (0) /* currently not used */
125#define IPA_v3_5_MHI_GROUP_PCIE IPA_v3_5_GROUP_LWA_DL
Amir Levy3be373c2017-03-05 16:31:30 +0200126#define IPA_v3_5_GROUP_UL_DL (1)
Amir Levy54fe4d32017-03-16 11:21:49 +0200127#define IPA_v3_5_MHI_GROUP_DDR IPA_v3_5_GROUP_UL_DL
128#define IPA_v3_5_MHI_GROUP_DMA (2)
129#define IPA_v3_5_GROUP_UC_RX_Q (3) /* currently not used */
Amir Levy3be373c2017-03-05 16:31:30 +0200130#define IPA_v3_5_SRC_GROUP_MAX (4)
131#define IPA_v3_5_DST_GROUP_MAX (3)
Amir Levy0f97a5c2016-11-22 11:13:37 +0200132
Michael Adisumarta539339d2017-05-16 14:18:23 -0700133#define IPA_v4_0_GROUP_LWA_DL (0)
134#define IPA_v4_0_MHI_GROUP_PCIE (0)
135#define IPA_v4_0_ETHERNET (0)
136#define IPA_v4_0_GROUP_UL_DL (1)
137#define IPA_v4_0_MHI_GROUP_DDR (1)
138#define IPA_v4_0_MHI_GROUP_DMA (2)
139#define IPA_v4_0_GROUP_UC_RX_Q (3)
140#define IPA_v4_0_SRC_GROUP_MAX (4)
141#define IPA_v4_0_DST_GROUP_MAX (4)
142
Amir Levy0f97a5c2016-11-22 11:13:37 +0200143#define IPA_GROUP_MAX IPA_v3_0_GROUP_MAX
Amir Levy9659e592016-10-27 18:08:27 +0300144
145enum ipa_rsrc_grp_type_src {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200146 IPA_v3_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS,
147 IPA_v3_0_RSRC_GRP_TYPE_SRC_HDR_SECTORS,
148 IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI1_BUFFER,
149 IPA_v3_0_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS,
150 IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
151 IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI2_BUFFERS,
152 IPA_v3_0_RSRC_GRP_TYPE_SRC_HPS_DMARS,
153 IPA_v3_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
154 IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX,
155
Amir Levy3be373c2017-03-05 16:31:30 +0200156 IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS = 0,
157 IPA_v3_5_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS,
158 IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
159 IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS,
160 IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
Michael Adisumarta539339d2017-05-16 14:18:23 -0700161 IPA_v3_5_RSRC_GRP_TYPE_SRC_MAX,
162
163 IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS = 0,
164 IPA_v4_0_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS,
165 IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF,
166 IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS,
167 IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES,
168 IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX
Amir Levy9659e592016-10-27 18:08:27 +0300169};
Amir Levy0f97a5c2016-11-22 11:13:37 +0200170
171#define IPA_RSRC_GRP_TYPE_SRC_MAX IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX
172
Amir Levy9659e592016-10-27 18:08:27 +0300173enum ipa_rsrc_grp_type_dst {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200174 IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTORS,
175 IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTOR_LISTS,
176 IPA_v3_0_RSRC_GRP_TYPE_DST_DPS_DMARS,
177 IPA_v3_0_RSRC_GRP_TYPE_DST_MAX,
178
Amir Levy3be373c2017-03-05 16:31:30 +0200179 IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS = 0,
180 IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS,
181 IPA_v3_5_RSRC_GRP_TYPE_DST_MAX,
Michael Adisumarta539339d2017-05-16 14:18:23 -0700182
183 IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS = 0,
184 IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS,
185 IPA_v4_0_RSRC_GRP_TYPE_DST_MAX,
Amir Levy9659e592016-10-27 18:08:27 +0300186};
Amir Levy0f97a5c2016-11-22 11:13:37 +0200187#define IPA_RSRC_GRP_TYPE_DST_MAX IPA_v3_0_RSRC_GRP_TYPE_DST_MAX
188
Amir Levy9659e592016-10-27 18:08:27 +0300189enum ipa_rsrc_grp_type_rx {
190 IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ,
191 IPA_RSRC_GRP_TYPE_RX_MAX
192};
Michael Adisumarta539339d2017-05-16 14:18:23 -0700193
194enum ipa_rsrc_grp_rx_hps_weight_config {
195 IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG,
196 IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_MAX
197};
198
Amir Levy9659e592016-10-27 18:08:27 +0300199struct rsrc_min_max {
200 u32 min;
201 u32 max;
202};
203
Amir Levy9659e592016-10-27 18:08:27 +0300204enum ipa_ver {
205 IPA_3_0,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200206 IPA_3_5,
Amir Levy54fe4d32017-03-16 11:21:49 +0200207 IPA_3_5_MHI,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200208 IPA_3_5_1,
Michael Adisumarta891a4ff2017-05-16 16:40:06 -0700209 IPA_4_0,
Michael Adisumarta539339d2017-05-16 14:18:23 -0700210 IPA_4_0_MHI,
Amir Levy9659e592016-10-27 18:08:27 +0300211 IPA_VER_MAX,
212};
213
Amir Levy0f97a5c2016-11-22 11:13:37 +0200214static const struct rsrc_min_max ipa3_rsrc_src_grp_config
215 [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_SRC_MAX][IPA_GROUP_MAX] = {
216 [IPA_3_0] = {
217 /*UL DL DIAG DMA Not Used uC Rx*/
218 [IPA_v3_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
219 {3, 255}, {3, 255}, {1, 255}, {1, 255}, {1, 255}, {2, 255} },
220 [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDR_SECTORS] = {
221 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
222 [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI1_BUFFER] = {
223 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
224 [IPA_v3_0_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
225 {14, 14}, {16, 16}, {5, 5}, {5, 5}, {0, 0}, {8, 8} },
226 [IPA_v3_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
227 {19, 19}, {26, 26}, {3, 3}, {7, 7}, {0, 0}, {8, 8} },
228 [IPA_v3_0_RSRC_GRP_TYPE_SRC_HDRI2_BUFFERS] = {
229 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
230 [IPA_v3_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
231 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
232 [IPA_v3_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
233 {14, 14}, {16, 16}, {5, 5}, {5, 5}, {0, 0}, {8, 8} },
234 },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200235 [IPA_3_5] = {
236 /* LWA_DL UL_DL not used UC_RX_Q, other are invalid */
237 [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200238 {0, 0}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
239 [IPA_v3_5_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
240 {0, 0}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
241 [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
242 {0, 0}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
243 [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
244 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
245 [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
246 {0, 0}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
247 },
248 [IPA_3_5_MHI] = {
249 /* PCIE DDR DMA not used, other are invalid */
250 [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
Amir Levy3a59dbd2017-03-15 14:30:54 +0200251 {4, 4}, {5, 5}, {1, 1}, {0, 0}, {0, 0}, {0, 0} },
252 [IPA_v3_5_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
253 {10, 10}, {10, 10}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
254 [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
255 {12, 12}, {12, 12}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
256 [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
257 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
258 [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
259 {14, 14}, {14, 14}, {14, 14}, {0, 0}, {0, 0}, {0, 0} },
260 },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200261 [IPA_3_5_1] = {
262 /* LWA_DL UL_DL not used UC_RX_Q, other are invalid */
Amir Levy3be373c2017-03-05 16:31:30 +0200263 [IPA_v3_5_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200264 {1, 255}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
Amir Levy3be373c2017-03-05 16:31:30 +0200265 [IPA_v3_5_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200266 {10, 10}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
Amir Levy3be373c2017-03-05 16:31:30 +0200267 [IPA_v3_5_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200268 {12, 12}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
Amir Levy3be373c2017-03-05 16:31:30 +0200269 [IPA_v3_5_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200270 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
Amir Levy3be373c2017-03-05 16:31:30 +0200271 [IPA_v3_5_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200272 {14, 14}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200273 },
Michael Adisumarta539339d2017-05-16 14:18:23 -0700274 [IPA_4_0] = {
275 /* LWA_DL UL_DL not used UC_RX_Q, other are invalid */
276 [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
277 {1, 255}, {1, 255}, {0, 0}, {1, 255}, {0, 0}, {0, 0} },
278 [IPA_v4_0_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
279 {10, 10}, {10, 10}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
280 [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
281 {12, 12}, {14, 14}, {0, 0}, {8, 8}, {0, 0}, {0, 0} },
282 [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
283 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
284 [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
285 {14, 14}, {20, 20}, {0, 0}, {14, 14}, {0, 0}, {0, 0} },
286 },
287 [IPA_4_0_MHI] = {
288 /* PCIE DDR DMA not used, other are invalid */
289 [IPA_v4_0_RSRC_GRP_TYPE_SRC_PKT_CONTEXTS] = {
290 {4, 4}, {5, 5}, {1, 1}, {0, 0}, {0, 0}, {0, 0} },
291 [IPA_v4_0_RSRC_GRP_TYPE_SRS_DESCRIPTOR_LISTS] = {
292 {10, 10}, {10, 10}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
293 [IPA_v4_0_RSRC_GRP_TYPE_SRC_DESCRIPTOR_BUFF] = {
294 {12, 12}, {12, 12}, {8, 8}, {0, 0}, {0, 0}, {0, 0} },
295 [IPA_v4_0_RSRC_GRP_TYPE_SRC_HPS_DMARS] = {
296 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 0}, {0, 0} },
297 [IPA_v4_0_RSRC_GRP_TYPE_SRC_ACK_ENTRIES] = {
298 {14, 14}, {14, 14}, {14, 14}, {0, 0}, {0, 0}, {0, 0} },
299 },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200300};
301
302static const struct rsrc_min_max ipa3_rsrc_dst_grp_config
303 [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_DST_MAX][IPA_GROUP_MAX] = {
304 [IPA_3_0] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200305 /* UL DL/DPL DIAG DMA Q6zip_gen Q6zip_eng */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200306 [IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
307 {2, 2}, {3, 3}, {0, 0}, {2, 2}, {3, 3}, {3, 3} },
308 [IPA_v3_0_RSRC_GRP_TYPE_DST_DATA_SECTOR_LISTS] = {
309 {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255}, {0, 255} },
310 [IPA_v3_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
311 {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {0, 0} },
312 },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200313 [IPA_3_5] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200314 /* unused UL/DL/DPL unused N/A N/A N/A */
315 [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
316 {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
317 [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
318 {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
319 },
320 [IPA_3_5_MHI] = {
321 /* PCIE DDR DMA N/A N/A N/A */
Amir Levy3be373c2017-03-05 16:31:30 +0200322 [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200323 {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
Amir Levy3be373c2017-03-05 16:31:30 +0200324 [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200325 {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200326 },
327 [IPA_3_5_1] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200328 /* LWA_DL UL/DL/DPL unused N/A N/A N/A */
Amir Levy3a59dbd2017-03-15 14:30:54 +0200329 [IPA_v3_5_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
330 {4, 4}, {4, 4}, {3, 3}, {0, 0}, {0, 0}, {0, 0} },
331 [IPA_v3_5_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
332 {2, 255}, {1, 255}, {1, 2}, {0, 0}, {0, 0}, {0, 0} },
333 },
Michael Adisumarta539339d2017-05-16 14:18:23 -0700334 [IPA_4_0] = {
335 /*LWA_DL UL/DL/DPL uC, other are invalid */
336 [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
337 {4, 4}, {4, 4}, {3, 3}, {2, 2}, {0, 0}, {0, 0} },
338 [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
339 {2, 255}, {1, 255}, {1, 2}, {0, 2}, {0, 0}, {0, 0} },
340 },
341 [IPA_4_0_MHI] = {
342 /*LWA_DL UL/DL/DPL uC, other are invalid */
343 [IPA_v4_0_RSRC_GRP_TYPE_DST_DATA_SECTORS] = {
344 {4, 4}, {4, 4}, {3, 3}, {2, 2}, {0, 0}, {0, 0} },
345 [IPA_v4_0_RSRC_GRP_TYPE_DST_DPS_DMARS] = {
346 {2, 255}, {1, 255}, {1, 2}, {0, 2}, {0, 0}, {0, 0} },
347 },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200348};
Amir Levy3a59dbd2017-03-15 14:30:54 +0200349
Amir Levy0f97a5c2016-11-22 11:13:37 +0200350static const struct rsrc_min_max ipa3_rsrc_rx_grp_config
351 [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_RX_MAX][IPA_GROUP_MAX] = {
Amir Levy3a59dbd2017-03-15 14:30:54 +0200352 [IPA_3_0] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200353 /* UL DL DIAG DMA Unused uC Rx */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200354 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
355 {16, 16}, {24, 24}, {8, 8}, {8, 8}, {0, 0}, {8, 8} },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200356 },
357 [IPA_3_5] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200358 /* unused UL_DL unused UC_RX_Q N/A N/A */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200359 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200360 {0, 0}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200361 },
Amir Levy54fe4d32017-03-16 11:21:49 +0200362 [IPA_3_5_MHI] = {
363 /* PCIE DDR DMA unused N/A N/A */
364 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
365 { 3, 3 }, { 7, 7 }, { 2, 2 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -0700366 },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200367 [IPA_3_5_1] = {
Amir Levy54fe4d32017-03-16 11:21:49 +0200368 /* LWA_DL UL_DL unused UC_RX_Q N/A N/A */
Amir Levy3a59dbd2017-03-15 14:30:54 +0200369 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
370 {3, 3}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
371 },
Michael Adisumarta539339d2017-05-16 14:18:23 -0700372 [IPA_4_0] = {
373 /* LWA_DL UL_DL not used UC_RX_Q, other are invalid */
374 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
375 {3, 3}, {7, 7}, {0, 0}, {2, 2}, {0, 0}, {0, 0} },
376 },
377 [IPA_4_0_MHI] = {
378 /* PCIE DDR DMA unused N/A N/A */
379 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ] = {
380 { 3, 3 }, { 7, 7 }, { 2, 2 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
381 },
382};
383
384static const u32 ipa3_rsrc_rx_grp_hps_weight_config
385 [IPA_VER_MAX][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_MAX][IPA_GROUP_MAX] = {
386 [IPA_3_0] = {
387 /* UL DL DIAG DMA Unused uC Rx */
388 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 0, 0, 0, 0, 0, 0 },
389 },
390 [IPA_3_5] = {
391 /* unused UL_DL unused UC_RX_Q N/A N/A */
392 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
393 },
394 [IPA_3_5_MHI] = {
395 /* PCIE DDR DMA unused N/A N/A */
396 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 3, 5, 1, 1, 0, 0 },
397 },
398 [IPA_3_5_1] = {
399 /* LWA_DL UL_DL unused UC_RX_Q N/A N/A */
400 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
401 },
402 [IPA_4_0] = {
403 /* LWA_DL UL_DL not used UC_RX_Q, other are invalid */
404 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 1, 1, 1, 1, 0, 0 },
405 },
406 [IPA_4_0_MHI] = {
407 /* PCIE DDR DMA unused N/A N/A */
408 [IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG] = { 3, 5, 1, 1, 0, 0 },
409 },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200410};
411
Amir Levy3be373c2017-03-05 16:31:30 +0200412enum ipa_ees {
413 IPA_EE_AP = 0,
414 IPA_EE_Q6 = 1,
Michael Adisumartaa7f27f32017-08-22 14:11:42 -0700415 IPA_EE_UC = 2,
Amir Levy3be373c2017-03-05 16:31:30 +0200416};
417
Amir Levy9659e592016-10-27 18:08:27 +0300418struct ipa_ep_configuration {
Skylar Changa9516582017-05-09 11:36:47 -0700419 bool valid;
Amir Levy9659e592016-10-27 18:08:27 +0300420 int group_num;
421 bool support_flt;
422 int sequencer_type;
423 u8 qmb_master_sel;
Amir Levy3be373c2017-03-05 16:31:30 +0200424 struct ipa_gsi_ep_config ipa_gsi_ep_info;
Amir Levy9659e592016-10-27 18:08:27 +0300425};
426
Skylar Changa9516582017-05-09 11:36:47 -0700427/* clients not included in the list below are considered as invalid */
Amir Levy9659e592016-10-27 18:08:27 +0300428static const struct ipa_ep_configuration ipa3_ep_mapping
429 [IPA_VER_MAX][IPA_CLIENT_MAX] = {
Amir Levy0f97a5c2016-11-22 11:13:37 +0200430 [IPA_3_0][IPA_CLIENT_WLAN1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700431 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300432 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200433 QMB_MASTER_SELECT_DDR,
434 { 10, 1, 8, 16, IPA_EE_UC } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200435 [IPA_3_0][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700436 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300437 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200438 QMB_MASTER_SELECT_DDR,
439 { 1, 3, 8, 16, IPA_EE_AP } },
Ghanim Fodic6b67492017-03-15 14:19:56 +0200440 [IPA_3_0][IPA_CLIENT_APPS_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700441 true, IPA_v3_0_GROUP_DL, false,
Ghanim Fodic6b67492017-03-15 14:19:56 +0200442 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levyd664d502017-03-22 21:24:23 +0200443 QMB_MASTER_SELECT_DDR,
444 { 14, 11, 8, 16, IPA_EE_AP } },
Ghanim Fodic6b67492017-03-15 14:19:56 +0200445 [IPA_3_0][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700446 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300447 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200448 QMB_MASTER_SELECT_DDR,
Amir Levyd664d502017-03-22 21:24:23 +0200449 { 3, 5, 16, 32, IPA_EE_AP } },
Amir Levy3be373c2017-03-05 16:31:30 +0200450 [IPA_3_0][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700451 true, IPA_v3_0_GROUP_IMM_CMD, false,
Amir Levy9659e592016-10-27 18:08:27 +0300452 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
Amir Levy3be373c2017-03-05 16:31:30 +0200453 QMB_MASTER_SELECT_DDR,
454 { 22, 6, 18, 28, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200455 [IPA_3_0][IPA_CLIENT_ODU_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700456 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300457 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200458 QMB_MASTER_SELECT_DDR,
459 { 12, 9, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200460 [IPA_3_0][IPA_CLIENT_MHI_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700461 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300462 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200463 QMB_MASTER_SELECT_PCIE,
464 { 0, 0, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200465 [IPA_3_0][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700466 true, IPA_v3_0_GROUP_UL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300467 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200468 QMB_MASTER_SELECT_DDR,
469 { 9, 4, 8, 12, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200470 [IPA_3_0][IPA_CLIENT_Q6_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700471 true, IPA_v3_0_GROUP_DL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300472 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200473 QMB_MASTER_SELECT_DDR,
474 { 5, 0, 16, 32, IPA_EE_Q6 } },
475 [IPA_3_0][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700476 true, IPA_v3_0_GROUP_IMM_CMD, false,
Amir Levy3be373c2017-03-05 16:31:30 +0200477 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
478 QMB_MASTER_SELECT_DDR,
479 { 6, 1, 18, 28, IPA_EE_Q6 } },
480 [IPA_3_0][IPA_CLIENT_Q6_DECOMP_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700481 true, IPA_v3_0_GROUP_Q6ZIP,
Amir Levy9659e592016-10-27 18:08:27 +0300482 false, IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200483 QMB_MASTER_SELECT_DDR,
484 { 7, 2, 0, 0, IPA_EE_Q6 } },
485 [IPA_3_0][IPA_CLIENT_Q6_DECOMP2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700486 true, IPA_v3_0_GROUP_Q6ZIP,
Amir Levy9659e592016-10-27 18:08:27 +0300487 false, IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200488 QMB_MASTER_SELECT_DDR,
489 { 8, 3, 0, 0, IPA_EE_Q6 } },
490 [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700491 true, IPA_v3_0_GROUP_DMA, false,
Amir Levy9659e592016-10-27 18:08:27 +0300492 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
Amir Levy3be373c2017-03-05 16:31:30 +0200493 QMB_MASTER_SELECT_PCIE,
494 { 12, 9, 8, 16, IPA_EE_AP } },
495 [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700496 true, IPA_v3_0_GROUP_DMA, false,
Amir Levy9659e592016-10-27 18:08:27 +0300497 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
Amir Levy3be373c2017-03-05 16:31:30 +0200498 QMB_MASTER_SELECT_PCIE,
499 { 13, 10, 8, 16, IPA_EE_AP } },
Sunil Paidimarri5139aa22017-02-13 11:07:32 -0800500 [IPA_3_0][IPA_CLIENT_ETHERNET_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700501 true, IPA_v3_0_GROUP_UL, true,
Sunil Paidimarri5139aa22017-02-13 11:07:32 -0800502 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
503 QMB_MASTER_SELECT_DDR,
504 {2, 0, 8, 16, IPA_EE_UC} },
Amir Levy9659e592016-10-27 18:08:27 +0300505 /* Only for test purpose */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200506 [IPA_3_0][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700507 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300508 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200509 QMB_MASTER_SELECT_DDR,
510 { 1, 3, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200511 [IPA_3_0][IPA_CLIENT_TEST1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700512 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300513 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200514 QMB_MASTER_SELECT_DDR,
515 { 1, 3, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200516 [IPA_3_0][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700517 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300518 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200519 QMB_MASTER_SELECT_DDR,
520 { 3, 5, 16, 32, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200521 [IPA_3_0][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700522 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300523 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200524 QMB_MASTER_SELECT_DDR,
525 { 12, 9, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200526 [IPA_3_0][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700527 true, IPA_v3_0_GROUP_UL, true,
Amir Levy9659e592016-10-27 18:08:27 +0300528 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200529 QMB_MASTER_SELECT_DDR,
530 { 13, 10, 8, 16, IPA_EE_AP } },
Amir Levy9659e592016-10-27 18:08:27 +0300531
Amir Levy0f97a5c2016-11-22 11:13:37 +0200532 [IPA_3_0][IPA_CLIENT_WLAN1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700533 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300534 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200535 QMB_MASTER_SELECT_DDR,
536 { 25, 4, 8, 8, IPA_EE_UC } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200537 [IPA_3_0][IPA_CLIENT_WLAN2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700538 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300539 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200540 QMB_MASTER_SELECT_DDR,
541 { 27, 4, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200542 [IPA_3_0][IPA_CLIENT_WLAN3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700543 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300544 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200545 QMB_MASTER_SELECT_DDR,
546 { 28, 13, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200547 [IPA_3_0][IPA_CLIENT_WLAN4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700548 true, IPA_v3_0_GROUP_DL, false,
Amir Levy3be373c2017-03-05 16:31:30 +0200549 IPA_DPS_HPS_SEQ_TYPE_INVALID,
550 QMB_MASTER_SELECT_DDR,
551 { 29, 14, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200552 [IPA_3_0][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700553 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300554 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200555 QMB_MASTER_SELECT_DDR,
556 { 26, 12, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200557 [IPA_3_0][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700558 true, IPA_v3_0_GROUP_DPL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300559 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200560 QMB_MASTER_SELECT_DDR,
561 { 17, 2, 8, 12, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200562 [IPA_3_0][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700563 true, IPA_v3_0_GROUP_UL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300564 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200565 QMB_MASTER_SELECT_DDR,
566 { 15, 7, 8, 12, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200567 [IPA_3_0][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700568 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300569 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200570 QMB_MASTER_SELECT_DDR,
571 { 16, 8, 8, 12, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200572 [IPA_3_0][IPA_CLIENT_ODU_EMB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700573 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300574 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200575 QMB_MASTER_SELECT_DDR,
576 { 23, 1, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200577 [IPA_3_0][IPA_CLIENT_MHI_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700578 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300579 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200580 QMB_MASTER_SELECT_PCIE,
581 { 23, 1, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200582 [IPA_3_0][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700583 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300584 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200585 QMB_MASTER_SELECT_DDR,
586 { 19, 6, 8, 12, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200587 [IPA_3_0][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700588 true, IPA_v3_0_GROUP_UL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300589 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200590 QMB_MASTER_SELECT_DDR,
591 { 18, 5, 8, 12, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200592 [IPA_3_0][IPA_CLIENT_Q6_DUN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700593 true, IPA_v3_0_GROUP_DIAG, false,
Amir Levy9659e592016-10-27 18:08:27 +0300594 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200595 QMB_MASTER_SELECT_DDR,
596 { 30, 7, 4, 4, IPA_EE_Q6 } },
597 [IPA_3_0][IPA_CLIENT_Q6_DECOMP_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700598 true, IPA_v3_0_GROUP_Q6ZIP, false,
Amir Levy9659e592016-10-27 18:08:27 +0300599 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200600 QMB_MASTER_SELECT_DDR,
601 { 21, 8, 4, 4, IPA_EE_Q6 } },
602 [IPA_3_0][IPA_CLIENT_Q6_DECOMP2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700603 true, IPA_v3_0_GROUP_Q6ZIP, false,
Amir Levy9659e592016-10-27 18:08:27 +0300604 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200605 QMB_MASTER_SELECT_DDR,
606 { 4, 9, 4, 4, IPA_EE_Q6 } },
607 [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700608 true, IPA_v3_0_GROUP_DMA, false,
Amir Levy9659e592016-10-27 18:08:27 +0300609 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200610 QMB_MASTER_SELECT_PCIE,
611 { 28, 13, 8, 8, IPA_EE_AP } },
612 [IPA_3_0][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700613 true, IPA_v3_0_GROUP_DMA, false,
Amir Levy3be373c2017-03-05 16:31:30 +0200614 IPA_DPS_HPS_SEQ_TYPE_INVALID,
615 QMB_MASTER_SELECT_PCIE,
616 { 29, 14, 8, 8, IPA_EE_AP } },
Sunil Paidimarri5139aa22017-02-13 11:07:32 -0800617 [IPA_3_0][IPA_CLIENT_ETHERNET_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700618 true, IPA_v3_0_GROUP_DL, false,
Sunil Paidimarri5139aa22017-02-13 11:07:32 -0800619 IPA_DPS_HPS_SEQ_TYPE_INVALID,
620 QMB_MASTER_SELECT_DDR,
621 {24, 3, 8, 8, IPA_EE_UC} },
Amir Levy9659e592016-10-27 18:08:27 +0300622 /* Only for test purpose */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200623 [IPA_3_0][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700624 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300625 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200626 QMB_MASTER_SELECT_DDR,
627 { 26, 12, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200628 [IPA_3_0][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700629 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300630 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200631 QMB_MASTER_SELECT_DDR,
632 { 26, 12, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200633 [IPA_3_0][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700634 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300635 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200636 QMB_MASTER_SELECT_DDR,
637 { 27, 4, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200638 [IPA_3_0][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700639 true, IPA_v3_0_GROUP_DL, false,
Amir Levy9659e592016-10-27 18:08:27 +0300640 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200641 QMB_MASTER_SELECT_DDR,
642 { 28, 13, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200643 [IPA_3_0][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700644 true, IPA_v3_0_GROUP_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200645 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +0200646 QMB_MASTER_SELECT_DDR,
647 { 29, 14, 8, 8, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -0700648 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
649 [IPA_3_0][IPA_CLIENT_DUMMY_CONS] = {
650 true, IPA_v3_0_GROUP_DL, false,
651 IPA_DPS_HPS_SEQ_TYPE_INVALID,
652 QMB_MASTER_SELECT_DDR,
653 { 31, 31, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200654
Amir Levy3a59dbd2017-03-15 14:30:54 +0200655 /* IPA_3_5 */
Amir Levy3a59dbd2017-03-15 14:30:54 +0200656 [IPA_3_5][IPA_CLIENT_WLAN1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700657 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200658 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
659 QMB_MASTER_SELECT_DDR,
Amir Levy1d68d702017-01-13 12:03:08 -0800660 { 6, 1, 8, 16, IPA_EE_UC } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200661 [IPA_3_5][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700662 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200663 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
664 QMB_MASTER_SELECT_DDR,
665 { 0, 7, 8, 16, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200666 [IPA_3_5][IPA_CLIENT_APPS_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700667 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levyd664d502017-03-22 21:24:23 +0200668 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200669 QMB_MASTER_SELECT_DDR,
670 { 8, 9, 8, 16, IPA_EE_AP } },
671 [IPA_3_5][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700672 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200673 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
674 QMB_MASTER_SELECT_DDR,
675 { 2, 3, 16, 32, IPA_EE_AP } },
676 [IPA_3_5][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700677 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200678 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
679 QMB_MASTER_SELECT_DDR,
680 { 5, 4, 20, 23, IPA_EE_AP } },
681 [IPA_3_5][IPA_CLIENT_ODU_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700682 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200683 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
684 QMB_MASTER_SELECT_DDR,
Amir Levy54fe4d32017-03-16 11:21:49 +0200685 { 1, 0, 8, 16, IPA_EE_UC } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200686 [IPA_3_5][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700687 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200688 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
689 QMB_MASTER_SELECT_DDR,
690 { 3, 0, 16, 32, IPA_EE_Q6 } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200691 [IPA_3_5][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700692 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200693 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
694 QMB_MASTER_SELECT_DDR,
695 { 4, 1, 20, 23, IPA_EE_Q6 } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200696 /* Only for test purpose */
697 [IPA_3_5][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700698 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200699 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
700 QMB_MASTER_SELECT_DDR,
701 {0, 7, 8, 16, IPA_EE_AP } },
702 [IPA_3_5][IPA_CLIENT_TEST1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700703 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200704 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
705 QMB_MASTER_SELECT_DDR,
706 {0, 7, 8, 16, IPA_EE_AP } },
707 [IPA_3_5][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700708 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200709 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
710 QMB_MASTER_SELECT_DDR,
711 { 1, 0, 8, 16, IPA_EE_AP } },
712 [IPA_3_5][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700713 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200714 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
715 QMB_MASTER_SELECT_DDR,
716 {7, 8, 8, 16, IPA_EE_AP } },
717 [IPA_3_5][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700718 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200719 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
720 QMB_MASTER_SELECT_DDR,
721 { 8, 9, 8, 16, IPA_EE_AP } },
722
Amir Levy3a59dbd2017-03-15 14:30:54 +0200723 [IPA_3_5][IPA_CLIENT_WLAN1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700724 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200725 IPA_DPS_HPS_SEQ_TYPE_INVALID,
726 QMB_MASTER_SELECT_DDR,
727 { 16, 3, 8, 8, IPA_EE_UC } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200728 [IPA_3_5][IPA_CLIENT_WLAN2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700729 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200730 IPA_DPS_HPS_SEQ_TYPE_INVALID,
731 QMB_MASTER_SELECT_DDR,
732 { 18, 12, 8, 8, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200733 [IPA_3_5][IPA_CLIENT_WLAN3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700734 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200735 IPA_DPS_HPS_SEQ_TYPE_INVALID,
736 QMB_MASTER_SELECT_DDR,
737 { 19, 13, 8, 8, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200738 [IPA_3_5][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700739 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200740 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy54fe4d32017-03-16 11:21:49 +0200741 QMB_MASTER_SELECT_PCIE,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200742 { 17, 11, 8, 8, IPA_EE_AP } },
743 [IPA_3_5][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700744 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200745 IPA_DPS_HPS_SEQ_TYPE_INVALID,
746 QMB_MASTER_SELECT_DDR,
747 { 14, 10, 4, 6, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200748 [IPA_3_5][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700749 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200750 IPA_DPS_HPS_SEQ_TYPE_INVALID,
751 QMB_MASTER_SELECT_DDR,
752 { 9, 5, 8, 12, IPA_EE_AP } },
753 [IPA_3_5][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700754 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200755 IPA_DPS_HPS_SEQ_TYPE_INVALID,
756 QMB_MASTER_SELECT_DDR,
757 { 10, 6, 8, 12, IPA_EE_AP } },
758 [IPA_3_5][IPA_CLIENT_ODU_EMB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700759 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200760 IPA_DPS_HPS_SEQ_TYPE_INVALID,
761 QMB_MASTER_SELECT_DDR,
762 { 15, 1, 8, 8, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200763 [IPA_3_5][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700764 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200765 IPA_DPS_HPS_SEQ_TYPE_INVALID,
766 QMB_MASTER_SELECT_DDR,
767 { 13, 3, 8, 12, IPA_EE_Q6 } },
768 [IPA_3_5][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700769 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200770 IPA_DPS_HPS_SEQ_TYPE_INVALID,
771 QMB_MASTER_SELECT_DDR,
772 { 12, 2, 8, 12, IPA_EE_Q6 } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200773 /* Only for test purpose */
Amir Levy54fe4d32017-03-16 11:21:49 +0200774 /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
Amir Levy3a59dbd2017-03-15 14:30:54 +0200775 [IPA_3_5][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700776 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200777 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy54fe4d32017-03-16 11:21:49 +0200778 QMB_MASTER_SELECT_PCIE,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200779 { 15, 1, 8, 8, IPA_EE_AP } },
780 [IPA_3_5][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700781 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200782 IPA_DPS_HPS_SEQ_TYPE_INVALID,
783 QMB_MASTER_SELECT_DDR,
784 { 15, 1, 8, 8, IPA_EE_AP } },
785 [IPA_3_5][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700786 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200787 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy54fe4d32017-03-16 11:21:49 +0200788 QMB_MASTER_SELECT_PCIE,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200789 { 17, 11, 8, 8, IPA_EE_AP } },
790 [IPA_3_5][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700791 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200792 IPA_DPS_HPS_SEQ_TYPE_INVALID,
793 QMB_MASTER_SELECT_DDR,
794 { 18, 12, 8, 8, IPA_EE_AP } },
795 [IPA_3_5][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700796 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200797 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy54fe4d32017-03-16 11:21:49 +0200798 QMB_MASTER_SELECT_PCIE,
Amir Levy3a59dbd2017-03-15 14:30:54 +0200799 { 19, 13, 8, 8, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -0700800 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
801 [IPA_3_5][IPA_CLIENT_DUMMY_CONS] = {
802 true, IPA_v3_5_GROUP_UL_DL, false,
803 IPA_DPS_HPS_SEQ_TYPE_INVALID,
804 QMB_MASTER_SELECT_PCIE,
805 { 31, 31, 8, 8, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200806
Amir Levy54fe4d32017-03-16 11:21:49 +0200807 /* IPA_3_5_MHI */
Amir Levy54fe4d32017-03-16 11:21:49 +0200808 [IPA_3_5_MHI][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700809 true, IPA_v3_5_MHI_GROUP_DDR, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200810 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
811 QMB_MASTER_SELECT_DDR,
812 { 0, 7, 8, 16, IPA_EE_AP } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200813 [IPA_3_5_MHI][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700814 true, IPA_v3_5_MHI_GROUP_DDR, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200815 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
816 QMB_MASTER_SELECT_DDR,
817 { 2, 3, 16, 32, IPA_EE_AP } },
818 [IPA_3_5_MHI][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700819 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200820 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
821 QMB_MASTER_SELECT_DDR,
822 { 5, 4, 20, 23, IPA_EE_AP } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200823 [IPA_3_5_MHI][IPA_CLIENT_MHI_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700824 true, IPA_v3_5_MHI_GROUP_PCIE, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200825 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
826 QMB_MASTER_SELECT_PCIE,
827 { 1, 0, 8, 16, IPA_EE_AP } },
828 [IPA_3_5_MHI][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700829 true, IPA_v3_5_MHI_GROUP_DDR, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200830 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
831 QMB_MASTER_SELECT_DDR,
832 { 3, 0, 16, 32, IPA_EE_Q6 } },
833 [IPA_3_5_MHI][IPA_CLIENT_Q6_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700834 true, IPA_v3_5_MHI_GROUP_DDR, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200835 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
836 QMB_MASTER_SELECT_DDR,
837 { 6, 4, 10, 30, IPA_EE_Q6 } },
838 [IPA_3_5_MHI][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700839 true, IPA_v3_5_MHI_GROUP_PCIE, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200840 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
841 QMB_MASTER_SELECT_DDR,
842 { 4, 1, 20, 23, IPA_EE_Q6 } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200843 [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700844 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200845 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
846 QMB_MASTER_SELECT_DDR,
847 { 7, 8, 8, 16, IPA_EE_AP } },
848 [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700849 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200850 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
851 QMB_MASTER_SELECT_DDR,
852 { 8, 9, 8, 16, IPA_EE_AP } },
853 /* Only for test purpose */
854 [IPA_3_5_MHI][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700855 true, IPA_v3_5_MHI_GROUP_DDR, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200856 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
857 QMB_MASTER_SELECT_DDR,
858 {0, 7, 8, 16, IPA_EE_AP } },
859 [IPA_3_5_MHI][IPA_CLIENT_TEST1_PROD] = {
860 0, IPA_v3_5_MHI_GROUP_DDR, true,
861 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
862 QMB_MASTER_SELECT_DDR,
863 {0, 7, 8, 16, IPA_EE_AP } },
864 [IPA_3_5_MHI][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700865 true, IPA_v3_5_MHI_GROUP_PCIE, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200866 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
867 QMB_MASTER_SELECT_PCIE,
868 { 1, 0, 8, 16, IPA_EE_AP } },
869 [IPA_3_5_MHI][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700870 true, IPA_v3_5_MHI_GROUP_DMA, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200871 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
872 QMB_MASTER_SELECT_DDR,
873 {7, 8, 8, 16, IPA_EE_AP } },
874 [IPA_3_5_MHI][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700875 true, IPA_v3_5_MHI_GROUP_DMA, true,
Amir Levy54fe4d32017-03-16 11:21:49 +0200876 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
877 QMB_MASTER_SELECT_DDR,
878 { 8, 9, 8, 16, IPA_EE_AP } },
879
Amir Levy54fe4d32017-03-16 11:21:49 +0200880 [IPA_3_5_MHI][IPA_CLIENT_WLAN1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700881 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200882 IPA_DPS_HPS_SEQ_TYPE_INVALID,
883 QMB_MASTER_SELECT_DDR,
884 { 16, 3, 8, 8, IPA_EE_UC } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200885 [IPA_3_5_MHI][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700886 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200887 IPA_DPS_HPS_SEQ_TYPE_INVALID,
888 QMB_MASTER_SELECT_DDR,
889 { 17, 11, 8, 8, IPA_EE_AP } },
890 [IPA_3_5_MHI][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700891 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200892 IPA_DPS_HPS_SEQ_TYPE_INVALID,
893 QMB_MASTER_SELECT_DDR,
894 { 14, 10, 4, 6, IPA_EE_AP } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200895 [IPA_3_5_MHI][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700896 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200897 IPA_DPS_HPS_SEQ_TYPE_INVALID,
898 QMB_MASTER_SELECT_DDR,
899 { 9, 5, 8, 12, IPA_EE_AP } },
900 [IPA_3_5_MHI][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700901 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200902 IPA_DPS_HPS_SEQ_TYPE_INVALID,
903 QMB_MASTER_SELECT_DDR,
904 { 10, 6, 8, 12, IPA_EE_AP } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200905 [IPA_3_5_MHI][IPA_CLIENT_MHI_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700906 true, IPA_v3_5_MHI_GROUP_PCIE, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200907 IPA_DPS_HPS_SEQ_TYPE_INVALID,
908 QMB_MASTER_SELECT_PCIE,
909 { 15, 1, 8, 8, IPA_EE_AP } },
910 [IPA_3_5_MHI][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700911 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200912 IPA_DPS_HPS_SEQ_TYPE_INVALID,
913 QMB_MASTER_SELECT_DDR,
914 { 13, 3, 8, 12, IPA_EE_Q6 } },
915 [IPA_3_5_MHI][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700916 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200917 IPA_DPS_HPS_SEQ_TYPE_INVALID,
918 QMB_MASTER_SELECT_DDR,
919 { 12, 2, 8, 12, IPA_EE_Q6 } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200920 [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700921 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200922 IPA_DPS_HPS_SEQ_TYPE_INVALID,
923 QMB_MASTER_SELECT_PCIE,
924 { 18, 12, 8, 8, IPA_EE_AP } },
925 [IPA_3_5_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700926 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200927 IPA_DPS_HPS_SEQ_TYPE_INVALID,
928 QMB_MASTER_SELECT_PCIE,
929 { 19, 13, 8, 8, IPA_EE_AP } },
Amir Levy54fe4d32017-03-16 11:21:49 +0200930 /* Only for test purpose */
931 [IPA_3_5_MHI][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700932 true, IPA_v3_5_MHI_GROUP_PCIE, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200933 IPA_DPS_HPS_SEQ_TYPE_INVALID,
934 QMB_MASTER_SELECT_PCIE,
935 { 15, 1, 8, 8, IPA_EE_AP } },
936 [IPA_3_5_MHI][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700937 true, IPA_v3_5_MHI_GROUP_PCIE, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200938 IPA_DPS_HPS_SEQ_TYPE_INVALID,
939 QMB_MASTER_SELECT_PCIE,
940 { 15, 1, 8, 8, IPA_EE_AP } },
941 [IPA_3_5_MHI][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700942 true, IPA_v3_5_MHI_GROUP_DDR, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200943 IPA_DPS_HPS_SEQ_TYPE_INVALID,
944 QMB_MASTER_SELECT_DDR,
945 { 17, 11, 8, 8, IPA_EE_AP } },
946 [IPA_3_5_MHI][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700947 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200948 IPA_DPS_HPS_SEQ_TYPE_INVALID,
949 QMB_MASTER_SELECT_PCIE,
950 { 18, 12, 8, 8, IPA_EE_AP } },
951 [IPA_3_5_MHI][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -0700952 true, IPA_v3_5_MHI_GROUP_DMA, false,
Amir Levy54fe4d32017-03-16 11:21:49 +0200953 IPA_DPS_HPS_SEQ_TYPE_INVALID,
954 QMB_MASTER_SELECT_PCIE,
955 { 19, 13, 8, 8, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -0700956 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
957 [IPA_3_5_MHI][IPA_CLIENT_DUMMY_CONS] = {
958 true, IPA_v3_5_MHI_GROUP_DMA, false,
959 IPA_DPS_HPS_SEQ_TYPE_INVALID,
960 QMB_MASTER_SELECT_PCIE,
961 { 31, 31, 8, 8, IPA_EE_AP } },
Amir Levy3a59dbd2017-03-15 14:30:54 +0200962
Amir Levy0f97a5c2016-11-22 11:13:37 +0200963 /* IPA_3_5_1 */
Amir Levy0f97a5c2016-11-22 11:13:37 +0200964 [IPA_3_5_1][IPA_CLIENT_WLAN1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700965 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200966 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200967 QMB_MASTER_SELECT_DDR,
968 { 7, 1, 8, 16, IPA_EE_UC } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200969 [IPA_3_5_1][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700970 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200971 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200972 QMB_MASTER_SELECT_DDR,
973 { 0, 0, 8, 16, IPA_EE_AP } },
Ghanim Fodic6b67492017-03-15 14:19:56 +0200974 [IPA_3_5_1][IPA_CLIENT_APPS_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700975 true, IPA_v3_5_GROUP_UL_DL, false,
Ghanim Fodic6b67492017-03-15 14:19:56 +0200976 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200977 QMB_MASTER_SELECT_DDR,
978 { 8, 7, 8, 16, IPA_EE_AP } },
Ghanim Fodic6b67492017-03-15 14:19:56 +0200979 [IPA_3_5_1][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700980 true, IPA_v3_5_GROUP_UL_DL, true,
Ghanim Fodic6b67492017-03-15 14:19:56 +0200981 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
982 QMB_MASTER_SELECT_DDR,
983 { 2, 3, 16, 32, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200984 [IPA_3_5_1][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700985 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200986 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
Amir Levy3be373c2017-03-05 16:31:30 +0200987 QMB_MASTER_SELECT_DDR,
988 { 5, 4, 20, 23, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +0200989 [IPA_3_5_1][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700990 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +0200991 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +0200992 QMB_MASTER_SELECT_DDR,
993 { 3, 0, 16, 32, IPA_EE_Q6 } },
994 [IPA_3_5_1][IPA_CLIENT_Q6_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -0700995 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy3be373c2017-03-05 16:31:30 +0200996 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
997 QMB_MASTER_SELECT_DDR,
998 { 6, 4, 12, 30, IPA_EE_Q6 } },
999 [IPA_3_5_1][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001000 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy3be373c2017-03-05 16:31:30 +02001001 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
1002 QMB_MASTER_SELECT_DDR,
1003 { 4, 1, 20, 23, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001004 /* Only for test purpose */
1005 [IPA_3_5_1][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001006 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001007 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +02001008 QMB_MASTER_SELECT_DDR,
1009 { 0, 0, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001010 [IPA_3_5_1][IPA_CLIENT_TEST1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001011 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001012 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +02001013 QMB_MASTER_SELECT_DDR,
1014 { 0, 0, 8, 16, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001015 [IPA_3_5_1][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001016 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001017 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +02001018 QMB_MASTER_SELECT_DDR,
1019 { 2, 3, 16, 32, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001020 [IPA_3_5_1][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001021 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001022 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +02001023 QMB_MASTER_SELECT_DDR,
1024 { 4, 1, 20, 23, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001025 [IPA_3_5_1][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001026 true, IPA_v3_5_GROUP_UL_DL, true,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001027 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Amir Levy3be373c2017-03-05 16:31:30 +02001028 QMB_MASTER_SELECT_DDR,
1029 { 1, 0, 8, 16, IPA_EE_UC } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001030
Amir Levy0f97a5c2016-11-22 11:13:37 +02001031 [IPA_3_5_1][IPA_CLIENT_WLAN1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001032 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001033 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001034 QMB_MASTER_SELECT_DDR,
1035 { 16, 3, 8, 8, IPA_EE_UC } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001036 [IPA_3_5_1][IPA_CLIENT_WLAN2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001037 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001038 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001039 QMB_MASTER_SELECT_DDR,
1040 { 18, 9, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001041 [IPA_3_5_1][IPA_CLIENT_WLAN3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001042 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001043 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001044 QMB_MASTER_SELECT_DDR,
1045 { 19, 10, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001046 [IPA_3_5_1][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001047 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001048 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001049 QMB_MASTER_SELECT_DDR,
1050 { 17, 8, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001051 [IPA_3_5_1][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001052 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001053 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001054 QMB_MASTER_SELECT_DDR,
1055 { 11, 2, 4, 6, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001056 [IPA_3_5_1][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001057 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001058 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001059 QMB_MASTER_SELECT_DDR,
1060 { 9, 5, 8, 12, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001061 [IPA_3_5_1][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001062 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001063 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001064 QMB_MASTER_SELECT_DDR,
1065 { 10, 6, 8, 12, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001066 [IPA_3_5_1][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001067 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001068 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001069 QMB_MASTER_SELECT_DDR,
1070 { 13, 3, 8, 12, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001071 [IPA_3_5_1][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001072 true, IPA_v3_5_GROUP_UL_DL, false,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001073 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001074 QMB_MASTER_SELECT_DDR,
1075 { 12, 2, 8, 12, IPA_EE_Q6 } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001076 /* Only for test purpose */
1077 [IPA_3_5_1][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001078 true, IPA_v3_5_GROUP_UL_DL,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001079 false,
1080 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001081 QMB_MASTER_SELECT_DDR,
1082 { 17, 8, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001083 [IPA_3_5_1][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001084 true, IPA_v3_5_GROUP_UL_DL,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001085 false,
1086 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001087 QMB_MASTER_SELECT_DDR,
1088 { 17, 8, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001089 [IPA_3_5_1][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001090 true, IPA_v3_5_GROUP_UL_DL,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001091 false,
1092 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001093 QMB_MASTER_SELECT_DDR,
1094 { 18, 9, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001095 [IPA_3_5_1][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001096 true, IPA_v3_5_GROUP_UL_DL,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001097 false,
1098 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001099 QMB_MASTER_SELECT_DDR,
1100 { 19, 10, 8, 8, IPA_EE_AP } },
Amir Levy0f97a5c2016-11-22 11:13:37 +02001101 [IPA_3_5_1][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001102 true, IPA_v3_5_GROUP_UL_DL,
Amir Levy0f97a5c2016-11-22 11:13:37 +02001103 false,
Amir Levy9659e592016-10-27 18:08:27 +03001104 IPA_DPS_HPS_SEQ_TYPE_INVALID,
Amir Levy3be373c2017-03-05 16:31:30 +02001105 QMB_MASTER_SELECT_DDR,
1106 { 11, 2, 4, 6, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -07001107 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
1108 [IPA_3_5_1][IPA_CLIENT_DUMMY_CONS] = {
1109 true, IPA_v3_5_GROUP_UL_DL,
1110 false,
1111 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1112 QMB_MASTER_SELECT_DDR,
1113 { 31, 31, 8, 8, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001114
1115 /* IPA_4_0 */
Michael Adisumarta539339d2017-05-16 14:18:23 -07001116 [IPA_4_0][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001117 true, IPA_v4_0_GROUP_UL_DL,
1118 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001119 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1120 QMB_MASTER_SELECT_DDR,
1121 { 0, 8, 8, 16, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001122 [IPA_4_0][IPA_CLIENT_APPS_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001123 true, IPA_v4_0_GROUP_UL_DL,
1124 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001125 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1126 QMB_MASTER_SELECT_DDR,
1127 { 8, 10, 8, 16, IPA_EE_AP } },
1128 [IPA_4_0][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001129 true, IPA_v4_0_GROUP_UL_DL,
1130 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001131 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1132 QMB_MASTER_SELECT_DDR,
1133 { 2, 3, 16, 32, IPA_EE_AP } },
1134 [IPA_4_0][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001135 true, IPA_v4_0_GROUP_UL_DL,
1136 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001137 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
1138 QMB_MASTER_SELECT_DDR,
1139 { 5, 4, 20, 24, IPA_EE_AP } },
1140 [IPA_4_0][IPA_CLIENT_ODU_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001141 true, IPA_v4_0_GROUP_UL_DL,
1142 true,
Skylar Chang6f6e3072017-07-28 10:03:47 -07001143 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001144 QMB_MASTER_SELECT_DDR,
Michael Adisumarta22b17212017-05-31 10:41:12 -07001145 { 1, 0, 8, 16, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001146 [IPA_4_0][IPA_CLIENT_ETHERNET_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001147 true, IPA_v4_0_GROUP_UL_DL,
1148 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001149 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1150 QMB_MASTER_SELECT_DDR,
1151 { 9, 0, 8, 16, IPA_EE_UC } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001152 [IPA_4_0][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001153 true, IPA_v4_0_GROUP_UL_DL,
1154 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001155 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
1156 QMB_MASTER_SELECT_DDR,
1157 { 6, 2, 12, 24, IPA_EE_Q6 } },
1158 [IPA_4_0][IPA_CLIENT_Q6_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001159 true, IPA_v4_0_GROUP_UL_DL,
1160 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001161 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1162 QMB_MASTER_SELECT_DDR,
1163 { 3, 0, 16, 32, IPA_EE_Q6 } },
1164 [IPA_4_0][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001165 true, IPA_v4_0_GROUP_UL_DL,
1166 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001167 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
1168 QMB_MASTER_SELECT_DDR,
1169 { 4, 1, 20, 24, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001170 /* Only for test purpose */
1171 [IPA_4_0][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001172 true, IPA_v4_0_GROUP_UL_DL,
1173 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001174 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1175 QMB_MASTER_SELECT_DDR,
1176 {0, 8, 8, 16, IPA_EE_AP } },
1177 [IPA_4_0][IPA_CLIENT_TEST1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001178 true, IPA_v4_0_GROUP_UL_DL,
1179 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001180 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1181 QMB_MASTER_SELECT_DDR,
1182 {0, 8, 8, 16, IPA_EE_AP } },
1183 [IPA_4_0][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001184 true, IPA_v4_0_GROUP_UL_DL,
1185 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001186 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1187 QMB_MASTER_SELECT_DDR,
1188 { 1, 0, 8, 16, IPA_EE_AP } },
1189 [IPA_4_0][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001190 true, IPA_v4_0_GROUP_UL_DL,
1191 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001192 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1193 QMB_MASTER_SELECT_DDR,
1194 {7, 9, 8, 16, IPA_EE_AP } },
1195 [IPA_4_0][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001196 true, IPA_v4_0_GROUP_UL_DL,
1197 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001198 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1199 QMB_MASTER_SELECT_DDR,
1200 { 8, 10, 8, 16, IPA_EE_AP } },
1201
1202
Michael Adisumarta539339d2017-05-16 14:18:23 -07001203 [IPA_4_0][IPA_CLIENT_WLAN1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001204 true, IPA_v4_0_GROUP_UL_DL,
1205 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001206 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1207 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001208 { 18, 11, 6, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001209 [IPA_4_0][IPA_CLIENT_WLAN2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001210 true, IPA_v4_0_GROUP_UL_DL,
1211 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001212 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1213 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001214 { 20, 13, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001215 [IPA_4_0][IPA_CLIENT_WLAN3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001216 true, IPA_v4_0_GROUP_UL_DL,
1217 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001218 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1219 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001220 { 21, 14, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001221 [IPA_4_0][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001222 true, IPA_v4_0_GROUP_UL_DL,
1223 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001224 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1225 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001226 { 19, 12, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001227 [IPA_4_0][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001228 true, IPA_v4_0_GROUP_UL_DL,
1229 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001230 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1231 QMB_MASTER_SELECT_DDR,
1232 { 15, 7, 5, 5, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001233 [IPA_4_0][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001234 true, IPA_v4_0_GROUP_UL_DL,
1235 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001236 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1237 QMB_MASTER_SELECT_DDR,
1238 { 10, 5, 9, 9, IPA_EE_AP } },
1239 [IPA_4_0][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001240 true, IPA_v4_0_GROUP_UL_DL,
1241 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001242 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1243 QMB_MASTER_SELECT_DDR,
1244 { 11, 6, 9, 9, IPA_EE_AP } },
1245 [IPA_4_0][IPA_CLIENT_ODU_EMB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001246 true, IPA_v4_0_GROUP_UL_DL,
1247 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001248 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1249 QMB_MASTER_SELECT_DDR,
1250 { 17, 1, 17, 17, IPA_EE_AP } },
1251 [IPA_4_0][IPA_CLIENT_ETHERNET_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001252 true, IPA_v4_0_GROUP_UL_DL,
1253 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001254 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1255 QMB_MASTER_SELECT_DDR,
1256 { 22, 1, 17, 17, IPA_EE_UC } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001257 [IPA_4_0][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001258 true, IPA_v4_0_GROUP_UL_DL,
1259 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001260 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1261 QMB_MASTER_SELECT_DDR,
1262 { 14, 4, 9, 9, IPA_EE_Q6 } },
1263 [IPA_4_0][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001264 true, IPA_v4_0_GROUP_UL_DL,
1265 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001266 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1267 QMB_MASTER_SELECT_DDR,
1268 { 13, 3, 9, 9, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001269 [IPA_4_0][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001270 true, IPA_v4_0_GROUP_UL_DL,
1271 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001272 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1273 QMB_MASTER_SELECT_DDR,
1274 { 16, 5, 9, 9, IPA_EE_Q6 } },
1275 /* Only for test purpose */
1276 /* MBIM aggregation test pipes should have the same QMB as USB_CONS */
1277 [IPA_4_0][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001278 true, IPA_v4_0_GROUP_UL_DL,
1279 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001280 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1281 QMB_MASTER_SELECT_PCIE,
1282 { 12, 2, 5, 5, IPA_EE_AP } },
1283 [IPA_4_0][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001284 true, IPA_v4_0_GROUP_UL_DL,
1285 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001286 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1287 QMB_MASTER_SELECT_DDR,
1288 { 12, 2, 5, 5, IPA_EE_AP } },
1289 [IPA_4_0][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001290 true, IPA_v4_0_GROUP_UL_DL,
1291 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001292 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1293 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001294 { 18, 11, 6, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001295 [IPA_4_0][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001296 true, IPA_v4_0_GROUP_UL_DL,
1297 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001298 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1299 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001300 { 20, 13, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001301 [IPA_4_0][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001302 true, IPA_v4_0_GROUP_UL_DL,
1303 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001304 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1305 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001306 { 21, 14, 9, 9, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -07001307 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
1308 [IPA_4_0][IPA_CLIENT_DUMMY_CONS] = {
1309 true, IPA_v4_0_GROUP_UL_DL,
1310 false,
1311 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1312 QMB_MASTER_SELECT_DDR,
1313 { 31, 31, 8, 8, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001314
1315 /* IPA_4_0_MHI */
Michael Adisumarta539339d2017-05-16 14:18:23 -07001316 [IPA_4_0_MHI][IPA_CLIENT_USB_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001317 true, IPA_v4_0_MHI_GROUP_DDR,
1318 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001319 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1320 QMB_MASTER_SELECT_DDR,
1321 { 0, 8, 8, 16, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001322 [IPA_4_0_MHI][IPA_CLIENT_APPS_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001323 true, IPA_v4_0_MHI_GROUP_DDR,
1324 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001325 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1326 QMB_MASTER_SELECT_DDR,
1327 { 2, 3, 16, 32, IPA_EE_AP } },
1328 [IPA_4_0_MHI][IPA_CLIENT_APPS_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001329 true, IPA_v4_0_MHI_GROUP_DDR,
1330 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001331 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
1332 QMB_MASTER_SELECT_DDR,
1333 { 5, 4, 20, 24, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001334 [IPA_4_0_MHI][IPA_CLIENT_MHI_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001335 true, IPA_v4_0_MHI_GROUP_PCIE,
1336 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001337 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1338 QMB_MASTER_SELECT_PCIE,
1339 { 1, 0, 8, 16, IPA_EE_AP } },
1340 [IPA_4_0_MHI][IPA_CLIENT_Q6_LAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001341 true, IPA_v4_0_MHI_GROUP_DDR,
1342 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001343 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1344 QMB_MASTER_SELECT_DDR,
Michael Adisumarta4556fbe2017-11-16 14:29:00 -08001345 { 6, 2, 12, 24, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001346 [IPA_4_0_MHI][IPA_CLIENT_Q6_WAN_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001347 true, IPA_v4_0_GROUP_UL_DL,
1348 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001349 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
1350 QMB_MASTER_SELECT_DDR,
Michael Adisumarta4556fbe2017-11-16 14:29:00 -08001351 { 3, 0, 16, 32, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001352 [IPA_4_0_MHI][IPA_CLIENT_Q6_CMD_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001353 true, IPA_v4_0_MHI_GROUP_PCIE,
1354 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001355 IPA_DPS_HPS_SEQ_TYPE_PKT_PROCESS_NO_DEC_UCP,
1356 QMB_MASTER_SELECT_DDR,
1357 { 4, 1, 20, 24, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001358 [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001359 true, IPA_v4_0_MHI_GROUP_DMA,
1360 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001361 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
1362 QMB_MASTER_SELECT_DDR,
1363 { 7, 9, 8, 16, IPA_EE_AP } },
1364 [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001365 true, IPA_v4_0_MHI_GROUP_DMA,
1366 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001367 IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY,
1368 QMB_MASTER_SELECT_DDR,
1369 { 8, 10, 8, 16, IPA_EE_AP } },
1370 /* Only for test purpose */
1371 [IPA_4_0_MHI][IPA_CLIENT_TEST_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001372 true, IPA_v4_0_GROUP_UL_DL,
1373 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001374 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1375 QMB_MASTER_SELECT_DDR,
1376 {0, 8, 8, 16, IPA_EE_AP } },
1377 [IPA_4_0][IPA_CLIENT_TEST1_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001378 true, IPA_v4_0_GROUP_UL_DL,
1379 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001380 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1381 QMB_MASTER_SELECT_DDR,
1382 {0, 8, 8, 16, IPA_EE_AP } },
1383 [IPA_4_0_MHI][IPA_CLIENT_TEST2_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001384 true, IPA_v4_0_GROUP_UL_DL,
1385 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001386 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1387 QMB_MASTER_SELECT_DDR,
1388 { 1, 0, 8, 16, IPA_EE_AP } },
1389 [IPA_4_0_MHI][IPA_CLIENT_TEST3_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001390 true, IPA_v4_0_GROUP_UL_DL,
1391 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001392 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1393 QMB_MASTER_SELECT_DDR,
1394 {7, 9, 8, 16, IPA_EE_AP } },
1395 [IPA_4_0_MHI][IPA_CLIENT_TEST4_PROD] = {
Skylar Changa9516582017-05-09 11:36:47 -07001396 true, IPA_v4_0_GROUP_UL_DL,
1397 true,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001398 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP,
1399 QMB_MASTER_SELECT_DDR,
1400 { 8, 10, 8, 16, IPA_EE_AP } },
1401
Michael Adisumarta539339d2017-05-16 14:18:23 -07001402 [IPA_4_0_MHI][IPA_CLIENT_USB_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001403 true, IPA_v4_0_MHI_GROUP_DDR,
1404 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001405 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1406 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001407 { 19, 12, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001408 [IPA_4_0_MHI][IPA_CLIENT_USB_DPL_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001409 true, IPA_v4_0_MHI_GROUP_DDR,
1410 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001411 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1412 QMB_MASTER_SELECT_DDR,
1413 { 15, 7, 5, 5, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001414 [IPA_4_0_MHI][IPA_CLIENT_APPS_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001415 true, IPA_v4_0_MHI_GROUP_DDR,
1416 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001417 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1418 QMB_MASTER_SELECT_DDR,
1419 { 10, 5, 9, 9, IPA_EE_AP } },
1420 [IPA_4_0_MHI][IPA_CLIENT_APPS_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001421 true, IPA_v4_0_MHI_GROUP_DDR,
1422 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001423 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1424 QMB_MASTER_SELECT_DDR,
1425 { 11, 6, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001426 [IPA_4_0_MHI][IPA_CLIENT_MHI_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001427 true, IPA_v4_0_MHI_GROUP_PCIE,
1428 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001429 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1430 QMB_MASTER_SELECT_PCIE,
1431 { 17, 1, 17, 17, IPA_EE_AP } },
1432 [IPA_4_0_MHI][IPA_CLIENT_Q6_LAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001433 true, IPA_v4_0_MHI_GROUP_DDR,
1434 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001435 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1436 QMB_MASTER_SELECT_DDR,
1437 { 14, 4, 9, 9, IPA_EE_Q6 } },
1438 [IPA_4_0_MHI][IPA_CLIENT_Q6_WAN_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001439 true, IPA_v4_0_MHI_GROUP_DDR,
1440 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001441 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1442 QMB_MASTER_SELECT_DDR,
1443 { 13, 3, 9, 9, IPA_EE_Q6 } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001444 [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_SYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001445 true, IPA_v4_0_MHI_GROUP_DMA,
1446 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001447 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1448 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001449 { 20, 13, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001450 [IPA_4_0_MHI][IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001451 true, IPA_v4_0_MHI_GROUP_DMA,
1452 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001453 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1454 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001455 { 21, 14, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001456 [IPA_4_0_MHI][IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001457 true, IPA_v4_0_GROUP_UL_DL,
1458 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001459 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1460 QMB_MASTER_SELECT_DDR,
1461 { 16, 5, 9, 9, IPA_EE_Q6 } },
1462 /* Only for test purpose */
1463 [IPA_4_0_MHI][IPA_CLIENT_TEST_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001464 true, IPA_v4_0_GROUP_UL_DL,
1465 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001466 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1467 QMB_MASTER_SELECT_PCIE,
1468 { 12, 2, 5, 5, IPA_EE_AP } },
1469 [IPA_4_0_MHI][IPA_CLIENT_TEST1_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001470 true, IPA_v4_0_GROUP_UL_DL,
1471 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001472 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1473 QMB_MASTER_SELECT_DDR,
1474 { 12, 2, 5, 5, IPA_EE_AP } },
1475 [IPA_4_0_MHI][IPA_CLIENT_TEST2_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001476 true, IPA_v4_0_GROUP_UL_DL,
1477 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001478 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1479 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001480 { 18, 11, 6, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001481 [IPA_4_0_MHI][IPA_CLIENT_TEST3_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001482 true, IPA_v4_0_GROUP_UL_DL,
1483 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001484 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1485 QMB_MASTER_SELECT_DDR,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001486 { 20, 13, 9, 9, IPA_EE_AP } },
Michael Adisumarta539339d2017-05-16 14:18:23 -07001487 [IPA_4_0_MHI][IPA_CLIENT_TEST4_CONS] = {
Skylar Changa9516582017-05-09 11:36:47 -07001488 true, IPA_v4_0_GROUP_UL_DL,
1489 false,
Michael Adisumarta539339d2017-05-16 14:18:23 -07001490 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1491 QMB_MASTER_SELECT_PCIE,
Michael Adisumartad96ccf52017-12-04 17:38:41 -08001492 { 21, 14, 9, 9, IPA_EE_AP } },
Skylar Chang7fa22712017-04-03 18:29:21 -07001493 /* Dummy consumer (pipe 31) is used in L2TP rt rule */
1494 [IPA_4_0_MHI][IPA_CLIENT_DUMMY_CONS] = {
1495 true, IPA_v4_0_GROUP_UL_DL,
1496 false,
1497 IPA_DPS_HPS_SEQ_TYPE_INVALID,
1498 QMB_MASTER_SELECT_DDR,
1499 { 31, 31, 8, 8, IPA_EE_AP } },
Amir Levy9659e592016-10-27 18:08:27 +03001500};
1501
1502static struct msm_bus_vectors ipa_init_vectors_v3_0[] = {
1503 {
1504 .src = MSM_BUS_MASTER_IPA,
1505 .dst = MSM_BUS_SLAVE_EBI_CH0,
1506 .ab = 0,
1507 .ib = 0,
1508 },
1509 {
1510 .src = MSM_BUS_MASTER_IPA,
1511 .dst = MSM_BUS_SLAVE_OCIMEM,
1512 .ab = 0,
1513 .ib = 0,
1514 },
1515};
1516
1517static struct msm_bus_vectors ipa_nominal_perf_vectors_v3_0[] = {
1518 {
1519 .src = MSM_BUS_MASTER_IPA,
1520 .dst = MSM_BUS_SLAVE_EBI_CH0,
1521 .ab = 100000000,
1522 .ib = 1300000000,
1523 },
1524 {
1525 .src = MSM_BUS_MASTER_IPA,
1526 .dst = MSM_BUS_SLAVE_OCIMEM,
1527 .ab = 100000000,
1528 .ib = 1300000000,
1529 },
1530};
1531
1532static struct msm_bus_paths ipa_usecases_v3_0[] = {
1533 {
Ghanim Fodi651854c2017-04-13 17:16:39 -07001534 .num_paths = ARRAY_SIZE(ipa_init_vectors_v3_0),
1535 .vectors = ipa_init_vectors_v3_0,
Amir Levy9659e592016-10-27 18:08:27 +03001536 },
1537 {
Ghanim Fodi651854c2017-04-13 17:16:39 -07001538 .num_paths = ARRAY_SIZE(ipa_nominal_perf_vectors_v3_0),
1539 .vectors = ipa_nominal_perf_vectors_v3_0,
Amir Levy9659e592016-10-27 18:08:27 +03001540 },
1541};
1542
1543static struct msm_bus_scale_pdata ipa_bus_client_pdata_v3_0 = {
Ghanim Fodi651854c2017-04-13 17:16:39 -07001544 .usecase = ipa_usecases_v3_0,
1545 .num_usecases = ARRAY_SIZE(ipa_usecases_v3_0),
Amir Levy9659e592016-10-27 18:08:27 +03001546 .name = "ipa",
1547};
1548
Amir Levy9659e592016-10-27 18:08:27 +03001549/**
1550 * ipa3_get_clients_from_rm_resource() - get IPA clients which are related to an
1551 * IPA_RM resource
1552 *
1553 * @resource: [IN] IPA Resource Manager resource
1554 * @clients: [OUT] Empty array which will contain the list of clients. The
1555 * caller must initialize this array.
1556 *
1557 * Return codes: 0 on success, negative on failure.
1558 */
1559int ipa3_get_clients_from_rm_resource(
1560 enum ipa_rm_resource_name resource,
1561 struct ipa3_client_names *clients)
1562{
1563 int i = 0;
1564
1565 if (resource < 0 ||
1566 resource >= IPA_RM_RESOURCE_MAX ||
1567 !clients) {
1568 IPAERR("Bad parameters\n");
1569 return -EINVAL;
1570 }
1571
1572 switch (resource) {
1573 case IPA_RM_RESOURCE_USB_CONS:
1574 clients->names[i++] = IPA_CLIENT_USB_CONS;
1575 break;
1576 case IPA_RM_RESOURCE_USB_DPL_CONS:
1577 clients->names[i++] = IPA_CLIENT_USB_DPL_CONS;
1578 break;
1579 case IPA_RM_RESOURCE_HSIC_CONS:
1580 clients->names[i++] = IPA_CLIENT_HSIC1_CONS;
1581 break;
1582 case IPA_RM_RESOURCE_WLAN_CONS:
1583 clients->names[i++] = IPA_CLIENT_WLAN1_CONS;
1584 clients->names[i++] = IPA_CLIENT_WLAN2_CONS;
1585 clients->names[i++] = IPA_CLIENT_WLAN3_CONS;
1586 clients->names[i++] = IPA_CLIENT_WLAN4_CONS;
1587 break;
1588 case IPA_RM_RESOURCE_MHI_CONS:
1589 clients->names[i++] = IPA_CLIENT_MHI_CONS;
1590 break;
Skylar Chang79699ec2016-11-18 10:21:33 -08001591 case IPA_RM_RESOURCE_ODU_ADAPT_CONS:
1592 clients->names[i++] = IPA_CLIENT_ODU_EMB_CONS;
1593 clients->names[i++] = IPA_CLIENT_ODU_TETH_CONS;
1594 break;
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001595 case IPA_RM_RESOURCE_ETHERNET_CONS:
1596 clients->names[i++] = IPA_CLIENT_ETHERNET_CONS;
1597 break;
Amir Levy9659e592016-10-27 18:08:27 +03001598 case IPA_RM_RESOURCE_USB_PROD:
1599 clients->names[i++] = IPA_CLIENT_USB_PROD;
1600 break;
1601 case IPA_RM_RESOURCE_HSIC_PROD:
1602 clients->names[i++] = IPA_CLIENT_HSIC1_PROD;
1603 break;
1604 case IPA_RM_RESOURCE_MHI_PROD:
1605 clients->names[i++] = IPA_CLIENT_MHI_PROD;
1606 break;
Skylar Chang79699ec2016-11-18 10:21:33 -08001607 case IPA_RM_RESOURCE_ODU_ADAPT_PROD:
1608 clients->names[i++] = IPA_CLIENT_ODU_PROD;
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001609 break;
1610 case IPA_RM_RESOURCE_ETHERNET_PROD:
1611 clients->names[i++] = IPA_CLIENT_ETHERNET_PROD;
1612 break;
Amir Levy9659e592016-10-27 18:08:27 +03001613 default:
1614 break;
1615 }
1616 clients->length = i;
1617
1618 return 0;
1619}
1620
1621/**
1622 * ipa3_should_pipe_be_suspended() - returns true when the client's pipe should
1623 * be suspended during a power save scenario. False otherwise.
1624 *
1625 * @client: [IN] IPA client
1626 */
1627bool ipa3_should_pipe_be_suspended(enum ipa_client_type client)
1628{
1629 struct ipa3_ep_context *ep;
1630 int ipa_ep_idx;
1631
1632 ipa_ep_idx = ipa3_get_ep_mapping(client);
1633 if (ipa_ep_idx == -1) {
1634 IPAERR("Invalid client.\n");
1635 WARN_ON(1);
1636 return false;
1637 }
1638
1639 ep = &ipa3_ctx->ep[ipa_ep_idx];
1640
Skylar Changa699afd2017-06-06 10:06:21 -07001641 /*
1642 * starting IPA 4.0 pipe no longer can be suspended. Instead,
1643 * the corresponding GSI channel should be stopped. Usually client
1644 * driver will take care of stopping the channel. For client drivers
1645 * that are not stopping the channel, IPA RM will do that based on
1646 * ipa3_should_pipe_channel_be_stopped().
1647 */
1648 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
1649 return false;
1650
Amir Levy9659e592016-10-27 18:08:27 +03001651 if (ep->keep_ipa_awake)
1652 return false;
1653
1654 if (client == IPA_CLIENT_USB_CONS ||
1655 client == IPA_CLIENT_USB_DPL_CONS ||
1656 client == IPA_CLIENT_MHI_CONS ||
1657 client == IPA_CLIENT_HSIC1_CONS ||
1658 client == IPA_CLIENT_WLAN1_CONS ||
1659 client == IPA_CLIENT_WLAN2_CONS ||
1660 client == IPA_CLIENT_WLAN3_CONS ||
Skylar Chang79699ec2016-11-18 10:21:33 -08001661 client == IPA_CLIENT_WLAN4_CONS ||
1662 client == IPA_CLIENT_ODU_EMB_CONS ||
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001663 client == IPA_CLIENT_ODU_TETH_CONS ||
1664 client == IPA_CLIENT_ETHERNET_CONS)
Amir Levy9659e592016-10-27 18:08:27 +03001665 return true;
1666
1667 return false;
1668}
1669
1670/**
Skylar Changa699afd2017-06-06 10:06:21 -07001671 * ipa3_should_pipe_channel_be_stopped() - returns true when the client's
1672 * channel should be stopped during a power save scenario. False otherwise.
1673 * Most client already stops the GSI channel on suspend, and are not included
1674 * in the list below.
1675 *
1676 * @client: [IN] IPA client
1677 */
1678static bool ipa3_should_pipe_channel_be_stopped(enum ipa_client_type client)
1679{
1680 struct ipa3_ep_context *ep;
1681 int ipa_ep_idx;
1682
1683 if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
1684 return false;
1685
1686 ipa_ep_idx = ipa3_get_ep_mapping(client);
1687 if (ipa_ep_idx == -1) {
1688 IPAERR("Invalid client.\n");
1689 WARN_ON(1);
1690 return false;
1691 }
1692
1693 ep = &ipa3_ctx->ep[ipa_ep_idx];
1694
1695 if (ep->keep_ipa_awake)
1696 return false;
1697
1698 if (client == IPA_CLIENT_ODU_EMB_CONS ||
1699 client == IPA_CLIENT_ODU_TETH_CONS)
1700 return true;
1701
1702 return false;
1703}
1704
1705/**
Amir Levy9659e592016-10-27 18:08:27 +03001706 * ipa3_suspend_resource_sync() - suspend client endpoints related to the IPA_RM
1707 * resource and decrement active clients counter, which may result in clock
1708 * gating of IPA clocks.
1709 *
1710 * @resource: [IN] IPA Resource Manager resource
1711 *
1712 * Return codes: 0 on success, negative on failure.
1713 */
1714int ipa3_suspend_resource_sync(enum ipa_rm_resource_name resource)
1715{
1716 struct ipa3_client_names clients;
1717 int res;
1718 int index;
1719 struct ipa_ep_cfg_ctrl suspend;
1720 enum ipa_client_type client;
1721 int ipa_ep_idx;
1722 bool pipe_suspended = false;
1723
1724 memset(&clients, 0, sizeof(clients));
1725 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1726 if (res) {
1727 IPAERR("Bad params.\n");
1728 return res;
1729 }
1730
1731 for (index = 0; index < clients.length; index++) {
1732 client = clients.names[index];
1733 ipa_ep_idx = ipa3_get_ep_mapping(client);
1734 if (ipa_ep_idx == -1) {
1735 IPAERR("Invalid client.\n");
1736 res = -EINVAL;
1737 continue;
1738 }
1739 ipa3_ctx->resume_on_connect[client] = false;
1740 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1741 ipa3_should_pipe_be_suspended(client)) {
1742 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1743 /* suspend endpoint */
1744 memset(&suspend, 0, sizeof(suspend));
1745 suspend.ipa_ep_suspend = true;
1746 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1747 pipe_suspended = true;
1748 }
1749 }
Skylar Changa699afd2017-06-06 10:06:21 -07001750
1751 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1752 ipa3_should_pipe_channel_be_stopped(client)) {
1753 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1754 /* Stop GSI channel */
1755 res = ipa3_stop_gsi_channel(ipa_ep_idx);
1756 if (res) {
1757 IPAERR("failed stop gsi ch %lu\n",
1758 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1759 return res;
1760 }
1761 }
1762 }
Amir Levy9659e592016-10-27 18:08:27 +03001763 }
1764 /* Sleep ~1 msec */
1765 if (pipe_suspended)
1766 usleep_range(1000, 2000);
1767
1768 /* before gating IPA clocks do TAG process */
1769 ipa3_ctx->tag_process_before_gating = true;
1770 IPA_ACTIVE_CLIENTS_DEC_RESOURCE(ipa_rm_resource_str(resource));
1771
1772 return 0;
1773}
1774
1775/**
1776 * ipa3_suspend_resource_no_block() - suspend client endpoints related to the
1777 * IPA_RM resource and decrement active clients counter. This function is
1778 * guaranteed to avoid sleeping.
1779 *
1780 * @resource: [IN] IPA Resource Manager resource
1781 *
1782 * Return codes: 0 on success, negative on failure.
1783 */
1784int ipa3_suspend_resource_no_block(enum ipa_rm_resource_name resource)
1785{
1786 int res;
1787 struct ipa3_client_names clients;
1788 int index;
1789 enum ipa_client_type client;
1790 struct ipa_ep_cfg_ctrl suspend;
1791 int ipa_ep_idx;
Amir Levy9659e592016-10-27 18:08:27 +03001792 struct ipa_active_client_logging_info log_info;
1793
Amir Levy9659e592016-10-27 18:08:27 +03001794 memset(&clients, 0, sizeof(clients));
1795 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1796 if (res) {
1797 IPAERR(
1798 "ipa3_get_clients_from_rm_resource() failed, name = %d.\n",
1799 resource);
1800 goto bail;
1801 }
1802
1803 for (index = 0; index < clients.length; index++) {
1804 client = clients.names[index];
1805 ipa_ep_idx = ipa3_get_ep_mapping(client);
1806 if (ipa_ep_idx == -1) {
1807 IPAERR("Invalid client.\n");
1808 res = -EINVAL;
1809 continue;
1810 }
1811 ipa3_ctx->resume_on_connect[client] = false;
1812 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1813 ipa3_should_pipe_be_suspended(client)) {
1814 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1815 /* suspend endpoint */
1816 memset(&suspend, 0, sizeof(suspend));
1817 suspend.ipa_ep_suspend = true;
1818 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1819 }
1820 }
Skylar Changa699afd2017-06-06 10:06:21 -07001821
1822 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1823 ipa3_should_pipe_channel_be_stopped(client)) {
1824 res = -EPERM;
1825 goto bail;
1826 }
Amir Levy9659e592016-10-27 18:08:27 +03001827 }
1828
1829 if (res == 0) {
1830 IPA_ACTIVE_CLIENTS_PREP_RESOURCE(log_info,
1831 ipa_rm_resource_str(resource));
Skylar Chang242952b2017-07-20 15:04:05 -07001832 /* before gating IPA clocks do TAG process */
1833 ipa3_ctx->tag_process_before_gating = true;
1834 ipa3_dec_client_disable_clks_no_block(&log_info);
Amir Levy9659e592016-10-27 18:08:27 +03001835 }
1836bail:
Amir Levy9659e592016-10-27 18:08:27 +03001837 return res;
1838}
1839
1840/**
1841 * ipa3_resume_resource() - resume client endpoints related to the IPA_RM
1842 * resource.
1843 *
1844 * @resource: [IN] IPA Resource Manager resource
1845 *
1846 * Return codes: 0 on success, negative on failure.
1847 */
1848int ipa3_resume_resource(enum ipa_rm_resource_name resource)
1849{
1850
1851 struct ipa3_client_names clients;
1852 int res;
1853 int index;
1854 struct ipa_ep_cfg_ctrl suspend;
1855 enum ipa_client_type client;
1856 int ipa_ep_idx;
1857
1858 memset(&clients, 0, sizeof(clients));
1859 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1860 if (res) {
1861 IPAERR("ipa3_get_clients_from_rm_resource() failed.\n");
1862 return res;
1863 }
1864
1865 for (index = 0; index < clients.length; index++) {
1866 client = clients.names[index];
1867 ipa_ep_idx = ipa3_get_ep_mapping(client);
1868 if (ipa_ep_idx == -1) {
1869 IPAERR("Invalid client.\n");
1870 res = -EINVAL;
1871 continue;
1872 }
1873 /*
1874 * The related ep, will be resumed on connect
1875 * while its resource is granted
1876 */
1877 ipa3_ctx->resume_on_connect[client] = true;
1878 IPADBG("%d will be resumed on connect.\n", client);
1879 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1880 ipa3_should_pipe_be_suspended(client)) {
1881 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1882 memset(&suspend, 0, sizeof(suspend));
1883 suspend.ipa_ep_suspend = false;
1884 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1885 }
1886 }
Skylar Changa699afd2017-06-06 10:06:21 -07001887
1888 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1889 ipa3_should_pipe_channel_be_stopped(client)) {
1890 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1891 res = gsi_start_channel(
1892 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1893 if (res) {
1894 IPAERR("failed to start gsi ch %lu\n",
1895 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1896 return res;
1897 }
1898 }
1899 }
Amir Levy9659e592016-10-27 18:08:27 +03001900 }
1901
1902 return res;
1903}
1904
1905/**
1906 * _ipa_sram_settings_read_v3_0() - Read SRAM settings from HW
1907 *
1908 * Returns: None
1909 */
1910void _ipa_sram_settings_read_v3_0(void)
1911{
1912 struct ipahal_reg_shared_mem_size smem_sz;
1913
1914 memset(&smem_sz, 0, sizeof(smem_sz));
1915
1916 ipahal_read_reg_fields(IPA_SHARED_MEM_SIZE, &smem_sz);
1917
1918 ipa3_ctx->smem_restricted_bytes = smem_sz.shared_mem_baddr;
1919 ipa3_ctx->smem_sz = smem_sz.shared_mem_sz;
1920
1921 /* reg fields are in 8B units */
1922 ipa3_ctx->smem_restricted_bytes *= 8;
1923 ipa3_ctx->smem_sz *= 8;
1924 ipa3_ctx->smem_reqd_sz = IPA_MEM_PART(end_ofst);
1925 ipa3_ctx->hdr_tbl_lcl = 0;
1926 ipa3_ctx->hdr_proc_ctx_tbl_lcl = 1;
1927
1928 /*
1929 * when proc ctx table is located in internal memory,
1930 * modem entries resides first.
1931 */
1932 if (ipa3_ctx->hdr_proc_ctx_tbl_lcl) {
1933 ipa3_ctx->hdr_proc_ctx_tbl.start_offset =
1934 IPA_MEM_PART(modem_hdr_proc_ctx_size);
1935 }
1936 ipa3_ctx->ip4_rt_tbl_hash_lcl = 0;
1937 ipa3_ctx->ip4_rt_tbl_nhash_lcl = 0;
1938 ipa3_ctx->ip6_rt_tbl_hash_lcl = 0;
1939 ipa3_ctx->ip6_rt_tbl_nhash_lcl = 0;
1940 ipa3_ctx->ip4_flt_tbl_hash_lcl = 0;
1941 ipa3_ctx->ip4_flt_tbl_nhash_lcl = 0;
1942 ipa3_ctx->ip6_flt_tbl_hash_lcl = 0;
1943 ipa3_ctx->ip6_flt_tbl_nhash_lcl = 0;
1944}
1945
1946/**
1947 * ipa3_cfg_route() - configure IPA route
1948 * @route: IPA route
1949 *
1950 * Return codes:
1951 * 0: success
1952 */
1953int ipa3_cfg_route(struct ipahal_reg_route *route)
1954{
1955
1956 IPADBG("disable_route_block=%d, default_pipe=%d, default_hdr_tbl=%d\n",
1957 route->route_dis,
1958 route->route_def_pipe,
1959 route->route_def_hdr_table);
1960 IPADBG("default_hdr_ofst=%d, default_frag_pipe=%d\n",
1961 route->route_def_hdr_ofst,
1962 route->route_frag_def_pipe);
1963
1964 IPADBG("default_retain_hdr=%d\n",
1965 route->route_def_retain_hdr);
1966
1967 if (route->route_dis) {
1968 IPAERR("Route disable is not supported!\n");
1969 return -EPERM;
1970 }
1971
1972 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
1973
1974 ipahal_write_reg_fields(IPA_ROUTE, route);
1975
1976 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
1977
1978 return 0;
1979}
1980
1981/**
1982 * ipa3_cfg_filter() - configure filter
1983 * @disable: disable value
1984 *
1985 * Return codes:
1986 * 0: success
1987 */
1988int ipa3_cfg_filter(u32 disable)
1989{
Utkarsh Saxenae9782812017-05-26 17:20:32 +05301990 IPAERR_RL("Filter disable is not supported!\n");
Amir Levy9659e592016-10-27 18:08:27 +03001991 return -EPERM;
1992}
1993
1994/**
1995 * ipa3_cfg_qsb() - Configure IPA QSB maximal reads and writes
1996 *
1997 * Returns: None
1998 */
1999void ipa3_cfg_qsb(void)
2000{
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002001 struct ipahal_reg_qsb_max_reads max_reads = { 0 };
2002 struct ipahal_reg_qsb_max_writes max_writes = { 0 };
2003
2004 max_reads.qmb_0_max_reads = 8,
2005 max_reads.qmb_1_max_reads = 8,
2006
2007 max_writes.qmb_0_max_writes = 8;
2008 max_writes.qmb_1_max_writes = 2;
Amir Levy9659e592016-10-27 18:08:27 +03002009
Amir Levy54fe4d32017-03-16 11:21:49 +02002010 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5) {
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002011 max_writes.qmb_1_max_writes = 4;
2012 max_reads.qmb_1_max_reads = 12;
Amir Levy54fe4d32017-03-16 11:21:49 +02002013 }
2014
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002015 ipahal_write_reg_fields(IPA_QSB_MAX_WRITES, &max_writes);
2016 ipahal_write_reg_fields(IPA_QSB_MAX_READS, &max_reads);
Amir Levy9659e592016-10-27 18:08:27 +03002017}
2018
2019/**
2020 * ipa3_init_hw() - initialize HW
2021 *
2022 * Return codes:
2023 * 0: success
2024 */
2025int ipa3_init_hw(void)
2026{
2027 u32 ipa_version = 0;
2028 u32 val;
2029
2030 /* Read IPA version and make sure we have access to the registers */
2031 ipa_version = ipahal_read_reg(IPA_VERSION);
2032 if (ipa_version == 0)
2033 return -EFAULT;
2034
2035 switch (ipa3_ctx->ipa_hw_type) {
2036 case IPA_HW_v3_0:
2037 case IPA_HW_v3_1:
2038 val = IPA_BCR_REG_VAL_v3_0;
2039 break;
2040 case IPA_HW_v3_5:
2041 case IPA_HW_v3_5_1:
2042 val = IPA_BCR_REG_VAL_v3_5;
2043 break;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002044 case IPA_HW_v4_0:
2045 val = IPA_BCR_REG_VAL_v4_0;
2046 break;
Amir Levy9659e592016-10-27 18:08:27 +03002047 default:
2048 IPAERR("unknown HW type in dts\n");
2049 return -EFAULT;
2050 }
2051
2052 ipahal_write_reg(IPA_BCR, val);
2053
Skylar Changf0772872017-07-06 16:11:01 -07002054 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
2055 struct ipahal_reg_tx_cfg cfg;
2056
Michael Adisumartad68ab112017-06-14 11:40:06 -07002057 ipahal_write_reg(IPA_CLKON_CFG, IPA_CLKON_CFG_v4_0);
Skylar Changf0772872017-07-06 16:11:01 -07002058 ipahal_read_reg_fields(IPA_TX_CFG, &cfg);
2059 /* disable PA_MASK_EN to allow holb drop */
2060 cfg.pa_mask_en = 0;
2061 ipahal_write_reg_fields(IPA_TX_CFG, &cfg);
2062 }
Michael Adisumartad68ab112017-06-14 11:40:06 -07002063
Amir Levy9659e592016-10-27 18:08:27 +03002064 ipa3_cfg_qsb();
2065
2066 return 0;
2067}
2068
2069/**
2070 * ipa3_get_hw_type_index() - Get HW type index which is used as the entry index
Amir Levy0f97a5c2016-11-22 11:13:37 +02002071 * for ep\resource groups related arrays .
Amir Levy9659e592016-10-27 18:08:27 +03002072 *
2073 * Return value: HW type index
2074 */
2075u8 ipa3_get_hw_type_index(void)
2076{
2077 u8 hw_type_index;
2078
2079 switch (ipa3_ctx->ipa_hw_type) {
2080 case IPA_HW_v3_0:
2081 case IPA_HW_v3_1:
2082 hw_type_index = IPA_3_0;
2083 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02002084 case IPA_HW_v3_5:
2085 hw_type_index = IPA_3_5;
Amir Levy54fe4d32017-03-16 11:21:49 +02002086 /*
2087 *this flag is initialized only after fw load trigger from
2088 * user space (ipa3_write)
2089 */
2090 if (ipa3_ctx->ipa_config_is_mhi)
2091 hw_type_index = IPA_3_5_MHI;
Amir Levy0f97a5c2016-11-22 11:13:37 +02002092 break;
2093 case IPA_HW_v3_5_1:
2094 hw_type_index = IPA_3_5_1;
2095 break;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002096 case IPA_HW_v4_0:
2097 hw_type_index = IPA_4_0;
Michael Adisumarta539339d2017-05-16 14:18:23 -07002098 /*
2099 *this flag is initialized only after fw load trigger from
2100 * user space (ipa3_write)
2101 */
2102 if (ipa3_ctx->ipa_config_is_mhi)
2103 hw_type_index = IPA_4_0_MHI;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002104 break;
Amir Levy9659e592016-10-27 18:08:27 +03002105 default:
2106 IPAERR("Incorrect IPA version %d\n", ipa3_ctx->ipa_hw_type);
2107 hw_type_index = IPA_3_0;
2108 break;
2109 }
2110
2111 return hw_type_index;
2112}
2113
2114/**
2115 * ipa3_get_ep_mapping() - provide endpoint mapping
2116 * @client: client type
2117 *
2118 * Return value: endpoint mapping
2119 */
2120int ipa3_get_ep_mapping(enum ipa_client_type client)
2121{
Skylar Chang652ee8e2017-02-10 11:40:30 -08002122 int ipa_ep_idx;
2123
Amir Levy9659e592016-10-27 18:08:27 +03002124 if (client >= IPA_CLIENT_MAX || client < 0) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05302125 IPAERR_RL("Bad client number! client =%d\n", client);
Ghanim Fodi79ee8d82017-02-27 16:39:25 +02002126 return IPA_EP_NOT_ALLOCATED;
Amir Levy9659e592016-10-27 18:08:27 +03002127 }
2128
Skylar Changa9516582017-05-09 11:36:47 -07002129 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2130 return IPA_EP_NOT_ALLOCATED;
2131
2132 ipa_ep_idx = ipa3_ep_mapping[ipa3_get_hw_type_index()][client].
2133 ipa_gsi_ep_info.ipa_ep_num;
Skylar Chang7fa22712017-04-03 18:29:21 -07002134 if (ipa_ep_idx < 0 || (ipa_ep_idx >= IPA3_MAX_NUM_PIPES
2135 && client != IPA_CLIENT_DUMMY_CONS))
Skylar Chang652ee8e2017-02-10 11:40:30 -08002136 return IPA_EP_NOT_ALLOCATED;
2137
2138 return ipa_ep_idx;
Amir Levy9659e592016-10-27 18:08:27 +03002139}
2140
2141/**
2142 * ipa3_get_gsi_ep_info() - provide gsi ep information
Amir Levy3be373c2017-03-05 16:31:30 +02002143 * @client: IPA client value
Amir Levy9659e592016-10-27 18:08:27 +03002144 *
2145 * Return value: pointer to ipa_gsi_ep_info
2146 */
Amir Levy3be373c2017-03-05 16:31:30 +02002147const struct ipa_gsi_ep_config *ipa3_get_gsi_ep_info
2148 (enum ipa_client_type client)
Amir Levy9659e592016-10-27 18:08:27 +03002149{
Skylar Changc1f15312017-05-09 14:14:32 -07002150 int ep_idx;
2151
2152 ep_idx = ipa3_get_ep_mapping(client);
2153 if (ep_idx == IPA_EP_NOT_ALLOCATED)
Amir Levy3be373c2017-03-05 16:31:30 +02002154 return NULL;
Amir Levy9659e592016-10-27 18:08:27 +03002155
Skylar Changa9516582017-05-09 11:36:47 -07002156 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2157 return NULL;
2158
Amir Levy3be373c2017-03-05 16:31:30 +02002159 return &(ipa3_ep_mapping[ipa3_get_hw_type_index()]
2160 [client].ipa_gsi_ep_info);
Amir Levy9659e592016-10-27 18:08:27 +03002161}
2162
2163/**
2164 * ipa_get_ep_group() - provide endpoint group by client
2165 * @client: client type
2166 *
2167 * Return value: endpoint group
2168 */
2169int ipa_get_ep_group(enum ipa_client_type client)
2170{
2171 if (client >= IPA_CLIENT_MAX || client < 0) {
2172 IPAERR("Bad client number! client =%d\n", client);
2173 return -EINVAL;
2174 }
2175
Skylar Changa9516582017-05-09 11:36:47 -07002176 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2177 return -EINVAL;
2178
Amir Levy9659e592016-10-27 18:08:27 +03002179 return ipa3_ep_mapping[ipa3_get_hw_type_index()][client].group_num;
2180}
2181
2182/**
2183 * ipa3_get_qmb_master_sel() - provide QMB master selection for the client
2184 * @client: client type
2185 *
2186 * Return value: QMB master index
2187 */
2188u8 ipa3_get_qmb_master_sel(enum ipa_client_type client)
2189{
2190 if (client >= IPA_CLIENT_MAX || client < 0) {
2191 IPAERR("Bad client number! client =%d\n", client);
2192 return -EINVAL;
2193 }
2194
Skylar Changa9516582017-05-09 11:36:47 -07002195 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2196 return -EINVAL;
2197
Amir Levy9659e592016-10-27 18:08:27 +03002198 return ipa3_ep_mapping[ipa3_get_hw_type_index()]
2199 [client].qmb_master_sel;
2200}
2201
2202/* ipa3_set_client() - provide client mapping
2203 * @client: client type
2204 *
2205 * Return value: none
2206 */
2207
2208void ipa3_set_client(int index, enum ipacm_client_enum client, bool uplink)
2209{
Skylar Chang09e0e252017-03-20 14:51:29 -07002210 if (client > IPACM_CLIENT_MAX || client < IPACM_CLIENT_USB) {
Amir Levy9659e592016-10-27 18:08:27 +03002211 IPAERR("Bad client number! client =%d\n", client);
2212 } else if (index >= IPA3_MAX_NUM_PIPES || index < 0) {
2213 IPAERR("Bad pipe index! index =%d\n", index);
2214 } else {
2215 ipa3_ctx->ipacm_client[index].client_enum = client;
2216 ipa3_ctx->ipacm_client[index].uplink = uplink;
2217 }
2218}
2219
Skylar Chang6b41f8d2016-11-01 12:50:11 -07002220/* ipa3_get_wlan_stats() - get ipa wifi stats
2221 *
2222 * Return value: success or failure
2223 */
2224int ipa3_get_wlan_stats(struct ipa_get_wdi_sap_stats *wdi_sap_stats)
2225{
2226 if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
2227 ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_GET_WDI_SAP_STATS,
2228 wdi_sap_stats);
2229 } else {
2230 IPAERR("uc_wdi_ctx.stats_notify NULL\n");
2231 return -EFAULT;
2232 }
2233 return 0;
2234}
2235
2236int ipa3_set_wlan_quota(struct ipa_set_wifi_quota *wdi_quota)
2237{
2238 if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
2239 ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_SET_WIFI_QUOTA,
2240 wdi_quota);
2241 } else {
2242 IPAERR("uc_wdi_ctx.stats_notify NULL\n");
2243 return -EFAULT;
2244 }
2245 return 0;
2246}
2247
Amir Levy9659e592016-10-27 18:08:27 +03002248/**
2249 * ipa3_get_client() - provide client mapping
2250 * @client: client type
2251 *
Skylar Chang6b41f8d2016-11-01 12:50:11 -07002252 * Return value: client mapping enum
Amir Levy9659e592016-10-27 18:08:27 +03002253 */
2254enum ipacm_client_enum ipa3_get_client(int pipe_idx)
2255{
2256 if (pipe_idx >= IPA3_MAX_NUM_PIPES || pipe_idx < 0) {
2257 IPAERR("Bad pipe index! pipe_idx =%d\n", pipe_idx);
2258 return IPACM_CLIENT_MAX;
2259 } else {
2260 return ipa3_ctx->ipacm_client[pipe_idx].client_enum;
2261 }
2262}
2263
2264/**
2265 * ipa2_get_client_uplink() - provide client mapping
2266 * @client: client type
2267 *
2268 * Return value: none
2269 */
2270bool ipa3_get_client_uplink(int pipe_idx)
2271{
Skylar Chang53f855e2017-06-12 10:50:12 -07002272 if (pipe_idx < 0 || pipe_idx >= IPA3_MAX_NUM_PIPES) {
2273 IPAERR("invalid pipe idx %d\n", pipe_idx);
2274 return false;
2275 }
2276
Amir Levy9659e592016-10-27 18:08:27 +03002277 return ipa3_ctx->ipacm_client[pipe_idx].uplink;
2278}
2279
2280/**
2281 * ipa3_get_rm_resource_from_ep() - get the IPA_RM resource which is related to
2282 * the supplied pipe index.
2283 *
2284 * @pipe_idx:
2285 *
2286 * Return value: IPA_RM resource related to the pipe, -1 if a resource was not
2287 * found.
2288 */
2289enum ipa_rm_resource_name ipa3_get_rm_resource_from_ep(int pipe_idx)
2290{
2291 int i;
2292 int j;
2293 enum ipa_client_type client;
2294 struct ipa3_client_names clients;
2295 bool found = false;
2296
2297 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2298 IPAERR("Bad pipe index!\n");
2299 return -EINVAL;
2300 }
2301
2302 client = ipa3_ctx->ep[pipe_idx].client;
2303
2304 for (i = 0; i < IPA_RM_RESOURCE_MAX; i++) {
2305 memset(&clients, 0, sizeof(clients));
2306 ipa3_get_clients_from_rm_resource(i, &clients);
2307 for (j = 0; j < clients.length; j++) {
2308 if (clients.names[j] == client) {
2309 found = true;
2310 break;
2311 }
2312 }
2313 if (found)
2314 break;
2315 }
2316
2317 if (!found)
2318 return -EFAULT;
2319
2320 return i;
2321}
2322
2323/**
2324 * ipa3_get_client_mapping() - provide client mapping
2325 * @pipe_idx: IPA end-point number
2326 *
2327 * Return value: client mapping
2328 */
2329enum ipa_client_type ipa3_get_client_mapping(int pipe_idx)
2330{
2331 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2332 IPAERR("Bad pipe index!\n");
2333 return -EINVAL;
2334 }
2335
2336 return ipa3_ctx->ep[pipe_idx].client;
2337}
2338
2339/**
2340 * ipa_init_ep_flt_bitmap() - Initialize the bitmap
2341 * that represents the End-points that supports filtering
2342 */
2343void ipa_init_ep_flt_bitmap(void)
2344{
2345 enum ipa_client_type cl;
2346 u8 hw_type_idx = ipa3_get_hw_type_index();
2347 u32 bitmap;
Skylar Changa9516582017-05-09 11:36:47 -07002348 u32 pipe_num;
Amir Levy9659e592016-10-27 18:08:27 +03002349
2350 bitmap = 0;
2351
2352 BUG_ON(ipa3_ctx->ep_flt_bitmap);
2353
2354 for (cl = 0; cl < IPA_CLIENT_MAX ; cl++) {
2355 if (ipa3_ep_mapping[hw_type_idx][cl].support_flt) {
Skylar Changa9516582017-05-09 11:36:47 -07002356 pipe_num = ipa3_ep_mapping[hw_type_idx][cl].
2357 ipa_gsi_ep_info.ipa_ep_num;
2358 bitmap |= (1U << pipe_num);
Amir Levy9659e592016-10-27 18:08:27 +03002359 if (bitmap != ipa3_ctx->ep_flt_bitmap) {
2360 ipa3_ctx->ep_flt_bitmap = bitmap;
2361 ipa3_ctx->ep_flt_num++;
2362 }
2363 }
2364 }
2365}
2366
2367/**
2368 * ipa_is_ep_support_flt() - Given an End-point check
2369 * whether it supports filtering or not.
2370 *
2371 * @pipe_idx:
2372 *
2373 * Return values:
2374 * true if supports and false if not
2375 */
2376bool ipa_is_ep_support_flt(int pipe_idx)
2377{
2378 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2379 IPAERR("Bad pipe index!\n");
2380 return false;
2381 }
2382
2383 return ipa3_ctx->ep_flt_bitmap & (1U<<pipe_idx);
2384}
2385
2386/**
2387 * ipa3_cfg_ep_seq() - IPA end-point HPS/DPS sequencer type configuration
2388 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2389 *
2390 * Returns: 0 on success, negative on failure
2391 *
2392 * Note: Should not be called from atomic context
2393 */
2394int ipa3_cfg_ep_seq(u32 clnt_hdl, const struct ipa_ep_cfg_seq *seq_cfg)
2395{
2396 int type;
2397
2398 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2399 ipa3_ctx->ep[clnt_hdl].valid == 0) {
2400 IPAERR("bad param, clnt_hdl = %d", clnt_hdl);
2401 return -EINVAL;
2402 }
2403
2404 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2405 IPAERR("SEQ does not apply to IPA consumer EP %d\n", clnt_hdl);
2406 return -EINVAL;
2407 }
2408
2409 /*
2410 * Skip Configure sequencers type for test clients.
2411 * These are configured dynamically in ipa3_cfg_ep_mode
2412 */
2413 if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
2414 IPADBG("Skip sequencers configuration for test clients\n");
2415 return 0;
2416 }
2417
2418 if (seq_cfg->set_dynamic)
2419 type = seq_cfg->seq_type;
2420 else
2421 type = ipa3_ep_mapping[ipa3_get_hw_type_index()]
2422 [ipa3_ctx->ep[clnt_hdl].client].sequencer_type;
2423
2424 if (type != IPA_DPS_HPS_SEQ_TYPE_INVALID) {
2425 if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA &&
2426 !IPA_DPS_HPS_SEQ_TYPE_IS_DMA(type)) {
2427 IPAERR("Configuring non-DMA SEQ type to DMA pipe\n");
2428 BUG();
2429 }
2430 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2431 /* Configure sequencers type*/
2432
2433 IPADBG("set sequencers to sequence 0x%x, ep = %d\n", type,
2434 clnt_hdl);
2435 ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
2436
2437 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2438 } else {
2439 IPADBG("should not set sequencer type of ep = %d\n", clnt_hdl);
2440 }
2441
2442 return 0;
2443}
2444
2445/**
2446 * ipa3_cfg_ep - IPA end-point configuration
2447 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2448 * @ipa_ep_cfg: [in] IPA end-point configuration params
2449 *
Amir Levydc65f4c2017-07-06 09:49:50 +03002450 * This includes nat, IPv6CT, header, mode, aggregation and route settings and
2451 * is a one shot API to configure the IPA end-point fully
Amir Levy9659e592016-10-27 18:08:27 +03002452 *
2453 * Returns: 0 on success, negative on failure
2454 *
2455 * Note: Should not be called from atomic context
2456 */
2457int ipa3_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg)
2458{
2459 int result = -EINVAL;
2460
2461 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2462 ipa3_ctx->ep[clnt_hdl].valid == 0 || ipa_ep_cfg == NULL) {
2463 IPAERR("bad parm.\n");
2464 return -EINVAL;
2465 }
2466
2467 result = ipa3_cfg_ep_hdr(clnt_hdl, &ipa_ep_cfg->hdr);
2468 if (result)
2469 return result;
2470
2471 result = ipa3_cfg_ep_hdr_ext(clnt_hdl, &ipa_ep_cfg->hdr_ext);
2472 if (result)
2473 return result;
2474
2475 result = ipa3_cfg_ep_aggr(clnt_hdl, &ipa_ep_cfg->aggr);
2476 if (result)
2477 return result;
2478
2479 result = ipa3_cfg_ep_cfg(clnt_hdl, &ipa_ep_cfg->cfg);
2480 if (result)
2481 return result;
2482
2483 if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
2484 result = ipa3_cfg_ep_nat(clnt_hdl, &ipa_ep_cfg->nat);
2485 if (result)
2486 return result;
2487
Amir Levydc65f4c2017-07-06 09:49:50 +03002488 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
2489 result = ipa3_cfg_ep_conn_track(clnt_hdl,
2490 &ipa_ep_cfg->conn_track);
2491 if (result)
2492 return result;
2493 }
2494
Amir Levy9659e592016-10-27 18:08:27 +03002495 result = ipa3_cfg_ep_mode(clnt_hdl, &ipa_ep_cfg->mode);
2496 if (result)
2497 return result;
2498
2499 result = ipa3_cfg_ep_seq(clnt_hdl, &ipa_ep_cfg->seq);
2500 if (result)
2501 return result;
2502
2503 result = ipa3_cfg_ep_route(clnt_hdl, &ipa_ep_cfg->route);
2504 if (result)
2505 return result;
2506
2507 result = ipa3_cfg_ep_deaggr(clnt_hdl, &ipa_ep_cfg->deaggr);
2508 if (result)
2509 return result;
2510 } else {
2511 result = ipa3_cfg_ep_metadata_mask(clnt_hdl,
2512 &ipa_ep_cfg->metadata_mask);
2513 if (result)
2514 return result;
2515 }
2516
2517 return 0;
2518}
2519
Amir Levydc65f4c2017-07-06 09:49:50 +03002520static const char *ipa3_get_nat_en_str(enum ipa_nat_en_type nat_en)
Amir Levy9659e592016-10-27 18:08:27 +03002521{
2522 switch (nat_en) {
2523 case (IPA_BYPASS_NAT):
2524 return "NAT disabled";
2525 case (IPA_SRC_NAT):
2526 return "Source NAT";
2527 case (IPA_DST_NAT):
2528 return "Dst NAT";
2529 }
2530
2531 return "undefined";
2532}
2533
Amir Levydc65f4c2017-07-06 09:49:50 +03002534static const char *ipa3_get_ipv6ct_en_str(enum ipa_ipv6ct_en_type ipv6ct_en)
2535{
2536 switch (ipv6ct_en) {
2537 case (IPA_BYPASS_IPV6CT):
2538 return "ipv6ct disabled";
2539 case (IPA_ENABLE_IPV6CT):
2540 return "ipv6ct enabled";
2541 }
2542
2543 return "undefined";
2544}
2545
Amir Levy9659e592016-10-27 18:08:27 +03002546/**
2547 * ipa3_cfg_ep_nat() - IPA end-point NAT configuration
2548 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
Amir Levydc65f4c2017-07-06 09:49:50 +03002549 * @ep_nat: [in] IPA NAT end-point configuration params
Amir Levy9659e592016-10-27 18:08:27 +03002550 *
2551 * Returns: 0 on success, negative on failure
2552 *
2553 * Note: Should not be called from atomic context
2554 */
2555int ipa3_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ep_nat)
2556{
2557 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2558 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_nat == NULL) {
2559 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2560 clnt_hdl,
2561 ipa3_ctx->ep[clnt_hdl].valid);
2562 return -EINVAL;
2563 }
2564
2565 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2566 IPAERR("NAT does not apply to IPA out EP %d\n", clnt_hdl);
2567 return -EINVAL;
2568 }
2569
2570 IPADBG("pipe=%d, nat_en=%d(%s)\n",
2571 clnt_hdl,
2572 ep_nat->nat_en,
2573 ipa3_get_nat_en_str(ep_nat->nat_en));
2574
2575 /* copy over EP cfg */
2576 ipa3_ctx->ep[clnt_hdl].cfg.nat = *ep_nat;
2577
2578 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2579
2580 ipahal_write_reg_n_fields(IPA_ENDP_INIT_NAT_n, clnt_hdl, ep_nat);
2581
2582 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2583
2584 return 0;
2585}
2586
Amir Levydc65f4c2017-07-06 09:49:50 +03002587/**
2588 * ipa3_cfg_ep_conn_track() - IPA end-point IPv6CT configuration
2589 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2590 * @ep_conn_track: [in] IPA IPv6CT end-point configuration params
2591 *
2592 * Returns: 0 on success, negative on failure
2593 *
2594 * Note: Should not be called from atomic context
2595 */
2596int ipa3_cfg_ep_conn_track(u32 clnt_hdl,
2597 const struct ipa_ep_cfg_conn_track *ep_conn_track)
2598{
2599 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2600 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_conn_track == NULL) {
2601 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2602 clnt_hdl,
2603 ipa3_ctx->ep[clnt_hdl].valid);
2604 return -EINVAL;
2605 }
2606
2607 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2608 IPAERR("IPv6CT does not apply to IPA out EP %d\n", clnt_hdl);
2609 return -EINVAL;
2610 }
2611
2612 IPADBG("pipe=%d, conn_track_en=%d(%s)\n",
2613 clnt_hdl,
2614 ep_conn_track->conn_track_en,
2615 ipa3_get_ipv6ct_en_str(ep_conn_track->conn_track_en));
2616
2617 /* copy over EP cfg */
2618 ipa3_ctx->ep[clnt_hdl].cfg.conn_track = *ep_conn_track;
2619
2620 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2621
2622 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CONN_TRACK_n, clnt_hdl,
2623 ep_conn_track);
2624
2625 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2626
2627 return 0;
2628}
2629
Amir Levy9659e592016-10-27 18:08:27 +03002630
2631/**
2632 * ipa3_cfg_ep_status() - IPA end-point status configuration
2633 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2634 * @ipa_ep_cfg: [in] IPA end-point configuration params
2635 *
2636 * Returns: 0 on success, negative on failure
2637 *
2638 * Note: Should not be called from atomic context
2639 */
2640int ipa3_cfg_ep_status(u32 clnt_hdl,
2641 const struct ipahal_reg_ep_cfg_status *ep_status)
2642{
2643 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2644 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_status == NULL) {
2645 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2646 clnt_hdl,
2647 ipa3_ctx->ep[clnt_hdl].valid);
2648 return -EINVAL;
2649 }
2650
2651 IPADBG("pipe=%d, status_en=%d status_ep=%d status_location=%d\n",
2652 clnt_hdl,
2653 ep_status->status_en,
2654 ep_status->status_ep,
2655 ep_status->status_location);
2656
2657 /* copy over EP cfg */
2658 ipa3_ctx->ep[clnt_hdl].status = *ep_status;
2659
2660 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2661
2662 ipahal_write_reg_n_fields(IPA_ENDP_STATUS_n, clnt_hdl, ep_status);
2663
2664 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2665
2666 return 0;
2667}
2668
2669/**
2670 * ipa3_cfg_ep_cfg() - IPA end-point cfg configuration
2671 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2672 * @ipa_ep_cfg: [in] IPA end-point configuration params
2673 *
2674 * Returns: 0 on success, negative on failure
2675 *
2676 * Note: Should not be called from atomic context
2677 */
2678int ipa3_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *cfg)
2679{
2680 u8 qmb_master_sel;
2681
2682 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2683 ipa3_ctx->ep[clnt_hdl].valid == 0 || cfg == NULL) {
2684 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2685 clnt_hdl,
2686 ipa3_ctx->ep[clnt_hdl].valid);
2687 return -EINVAL;
2688 }
2689
2690 /* copy over EP cfg */
2691 ipa3_ctx->ep[clnt_hdl].cfg.cfg = *cfg;
2692
2693 /* Override QMB master selection */
2694 qmb_master_sel = ipa3_get_qmb_master_sel(ipa3_ctx->ep[clnt_hdl].client);
2695 ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel = qmb_master_sel;
2696 IPADBG(
2697 "pipe=%d, frag_ofld_en=%d cs_ofld_en=%d mdata_hdr_ofst=%d gen_qmb_master_sel=%d\n",
2698 clnt_hdl,
2699 ipa3_ctx->ep[clnt_hdl].cfg.cfg.frag_offload_en,
2700 ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_offload_en,
2701 ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_metadata_hdr_offset,
2702 ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel);
2703
2704 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2705
2706 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CFG_n, clnt_hdl,
2707 &ipa3_ctx->ep[clnt_hdl].cfg.cfg);
2708
2709 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2710
2711 return 0;
2712}
2713
2714/**
2715 * ipa3_cfg_ep_metadata_mask() - IPA end-point meta-data mask configuration
2716 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2717 * @ipa_ep_cfg: [in] IPA end-point configuration params
2718 *
2719 * Returns: 0 on success, negative on failure
2720 *
2721 * Note: Should not be called from atomic context
2722 */
2723int ipa3_cfg_ep_metadata_mask(u32 clnt_hdl,
2724 const struct ipa_ep_cfg_metadata_mask
2725 *metadata_mask)
2726{
2727 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2728 ipa3_ctx->ep[clnt_hdl].valid == 0 || metadata_mask == NULL) {
2729 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2730 clnt_hdl,
2731 ipa3_ctx->ep[clnt_hdl].valid);
2732 return -EINVAL;
2733 }
2734
2735 IPADBG("pipe=%d, metadata_mask=0x%x\n",
2736 clnt_hdl,
2737 metadata_mask->metadata_mask);
2738
2739 /* copy over EP cfg */
2740 ipa3_ctx->ep[clnt_hdl].cfg.metadata_mask = *metadata_mask;
2741
2742 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2743
2744 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_MASK_n,
2745 clnt_hdl, metadata_mask);
2746
2747 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2748
2749 return 0;
2750}
2751
2752/**
2753 * ipa3_cfg_ep_hdr() - IPA end-point header configuration
2754 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2755 * @ipa_ep_cfg: [in] IPA end-point configuration params
2756 *
2757 * Returns: 0 on success, negative on failure
2758 *
2759 * Note: Should not be called from atomic context
2760 */
2761int ipa3_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ep_hdr)
2762{
2763 struct ipa3_ep_context *ep;
2764
2765 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2766 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr == NULL) {
2767 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2768 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
2769 return -EINVAL;
2770 }
2771 IPADBG("pipe=%d metadata_reg_valid=%d\n",
2772 clnt_hdl,
2773 ep_hdr->hdr_metadata_reg_valid);
2774
2775 IPADBG("remove_additional=%d, a5_mux=%d, ofst_pkt_size=0x%x\n",
2776 ep_hdr->hdr_remove_additional,
2777 ep_hdr->hdr_a5_mux,
2778 ep_hdr->hdr_ofst_pkt_size);
2779
2780 IPADBG("ofst_pkt_size_valid=%d, additional_const_len=0x%x\n",
2781 ep_hdr->hdr_ofst_pkt_size_valid,
2782 ep_hdr->hdr_additional_const_len);
2783
Amir Levy479cfdd2017-10-26 12:23:14 +03002784 IPADBG("ofst_metadata=0x%x, ofst_metadata_valid=%d, len=0x%x\n",
Amir Levy9659e592016-10-27 18:08:27 +03002785 ep_hdr->hdr_ofst_metadata,
2786 ep_hdr->hdr_ofst_metadata_valid,
2787 ep_hdr->hdr_len);
2788
2789 ep = &ipa3_ctx->ep[clnt_hdl];
2790
2791 /* copy over EP cfg */
2792 ep->cfg.hdr = *ep_hdr;
2793
2794 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2795
2796 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl, &ep->cfg.hdr);
2797
2798 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2799
2800 return 0;
2801}
2802
2803/**
2804 * ipa3_cfg_ep_hdr_ext() - IPA end-point extended header configuration
2805 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2806 * @ep_hdr_ext: [in] IPA end-point configuration params
2807 *
2808 * Returns: 0 on success, negative on failure
2809 *
2810 * Note: Should not be called from atomic context
2811 */
2812int ipa3_cfg_ep_hdr_ext(u32 clnt_hdl,
2813 const struct ipa_ep_cfg_hdr_ext *ep_hdr_ext)
2814{
2815 struct ipa3_ep_context *ep;
2816
2817 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2818 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr_ext == NULL) {
2819 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2820 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
2821 return -EINVAL;
2822 }
2823
2824 IPADBG("pipe=%d hdr_pad_to_alignment=%d\n",
2825 clnt_hdl,
2826 ep_hdr_ext->hdr_pad_to_alignment);
2827
2828 IPADBG("hdr_total_len_or_pad_offset=%d\n",
2829 ep_hdr_ext->hdr_total_len_or_pad_offset);
2830
2831 IPADBG("hdr_payload_len_inc_padding=%d hdr_total_len_or_pad=%d\n",
2832 ep_hdr_ext->hdr_payload_len_inc_padding,
2833 ep_hdr_ext->hdr_total_len_or_pad);
2834
2835 IPADBG("hdr_total_len_or_pad_valid=%d hdr_little_endian=%d\n",
2836 ep_hdr_ext->hdr_total_len_or_pad_valid,
2837 ep_hdr_ext->hdr_little_endian);
2838
2839 ep = &ipa3_ctx->ep[clnt_hdl];
2840
2841 /* copy over EP cfg */
2842 ep->cfg.hdr_ext = *ep_hdr_ext;
2843
2844 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2845
2846 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_EXT_n, clnt_hdl,
2847 &ep->cfg.hdr_ext);
2848
2849 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2850
2851 return 0;
2852}
2853
2854/**
2855 * ipa3_cfg_ep_ctrl() - IPA end-point Control configuration
2856 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2857 * @ipa_ep_cfg_ctrl: [in] IPA end-point configuration params
2858 *
2859 * Returns: 0 on success, negative on failure
2860 */
2861int ipa3_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl)
2862{
2863 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes || ep_ctrl == NULL) {
2864 IPAERR("bad parm, clnt_hdl = %d\n", clnt_hdl);
2865 return -EINVAL;
2866 }
2867
Skylar Changa699afd2017-06-06 10:06:21 -07002868 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0 && ep_ctrl->ipa_ep_suspend) {
2869 IPAERR("pipe suspend is not supported\n");
2870 WARN_ON(1);
2871 return -EPERM;
2872 }
2873
Amir Levy9659e592016-10-27 18:08:27 +03002874 IPADBG("pipe=%d ep_suspend=%d, ep_delay=%d\n",
2875 clnt_hdl,
2876 ep_ctrl->ipa_ep_suspend,
2877 ep_ctrl->ipa_ep_delay);
2878
2879 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CTRL_n, clnt_hdl, ep_ctrl);
2880
2881 if (ep_ctrl->ipa_ep_suspend == true &&
2882 IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client))
2883 ipa3_suspend_active_aggr_wa(clnt_hdl);
2884
2885 return 0;
2886}
2887
2888const char *ipa3_get_mode_type_str(enum ipa_mode_type mode)
2889{
2890 switch (mode) {
2891 case (IPA_BASIC):
2892 return "Basic";
2893 case (IPA_ENABLE_FRAMING_HDLC):
2894 return "HDLC framing";
2895 case (IPA_ENABLE_DEFRAMING_HDLC):
2896 return "HDLC de-framing";
2897 case (IPA_DMA):
2898 return "DMA";
2899 }
2900
2901 return "undefined";
2902}
2903
2904/**
2905 * ipa3_cfg_ep_mode() - IPA end-point mode configuration
2906 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2907 * @ipa_ep_cfg: [in] IPA end-point configuration params
2908 *
2909 * Returns: 0 on success, negative on failure
2910 *
2911 * Note: Should not be called from atomic context
2912 */
2913int ipa3_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ep_mode)
2914{
2915 int ep;
2916 int type;
2917 struct ipahal_reg_endp_init_mode init_mode;
2918
2919 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2920 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_mode == NULL) {
2921 IPAERR("bad params clnt_hdl=%d , ep_valid=%d ep_mode=%p\n",
2922 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid,
2923 ep_mode);
2924 return -EINVAL;
2925 }
2926
2927 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2928 IPAERR("MODE does not apply to IPA out EP %d\n", clnt_hdl);
2929 return -EINVAL;
2930 }
2931
2932 ep = ipa3_get_ep_mapping(ep_mode->dst);
2933 if (ep == -1 && ep_mode->mode == IPA_DMA) {
2934 IPAERR("dst %d does not exist in DMA mode\n", ep_mode->dst);
2935 return -EINVAL;
2936 }
2937
2938 WARN_ON(ep_mode->mode == IPA_DMA && IPA_CLIENT_IS_PROD(ep_mode->dst));
2939
2940 if (!IPA_CLIENT_IS_CONS(ep_mode->dst))
2941 ep = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
2942
Amir Levy479cfdd2017-10-26 12:23:14 +03002943 IPADBG("pipe=%d mode=%d(%s), dst_client_number=%d\n",
Amir Levy9659e592016-10-27 18:08:27 +03002944 clnt_hdl,
2945 ep_mode->mode,
2946 ipa3_get_mode_type_str(ep_mode->mode),
2947 ep_mode->dst);
2948
2949 /* copy over EP cfg */
2950 ipa3_ctx->ep[clnt_hdl].cfg.mode = *ep_mode;
2951 ipa3_ctx->ep[clnt_hdl].dst_pipe_index = ep;
2952
2953 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2954
2955 init_mode.dst_pipe_number = ipa3_ctx->ep[clnt_hdl].dst_pipe_index;
2956 init_mode.ep_mode = *ep_mode;
2957 ipahal_write_reg_n_fields(IPA_ENDP_INIT_MODE_n, clnt_hdl, &init_mode);
2958
2959 /* Configure sequencers type for test clients*/
2960 if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
2961 if (ep_mode->mode == IPA_DMA)
2962 type = IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY;
2963 else
Skylar Chang7fa22712017-04-03 18:29:21 -07002964 type =
2965 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP;
Amir Levy9659e592016-10-27 18:08:27 +03002966
2967 IPADBG(" set sequencers to sequance 0x%x, ep = %d\n", type,
2968 clnt_hdl);
2969 ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
2970 }
2971 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2972
2973 return 0;
2974}
2975
2976const char *ipa3_get_aggr_enable_str(enum ipa_aggr_en_type aggr_en)
2977{
2978 switch (aggr_en) {
2979 case (IPA_BYPASS_AGGR):
2980 return "no aggregation";
2981 case (IPA_ENABLE_AGGR):
2982 return "aggregation enabled";
2983 case (IPA_ENABLE_DEAGGR):
2984 return "de-aggregation enabled";
2985 }
2986
2987 return "undefined";
2988}
2989
2990const char *ipa3_get_aggr_type_str(enum ipa_aggr_type aggr_type)
2991{
2992 switch (aggr_type) {
2993 case (IPA_MBIM_16):
2994 return "MBIM_16";
2995 case (IPA_HDLC):
2996 return "HDLC";
2997 case (IPA_TLP):
2998 return "TLP";
2999 case (IPA_RNDIS):
3000 return "RNDIS";
3001 case (IPA_GENERIC):
3002 return "GENERIC";
3003 case (IPA_QCMAP):
3004 return "QCMAP";
3005 }
3006 return "undefined";
3007}
3008
3009/**
3010 * ipa3_cfg_ep_aggr() - IPA end-point aggregation configuration
3011 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3012 * @ipa_ep_cfg: [in] IPA end-point configuration params
3013 *
3014 * Returns: 0 on success, negative on failure
3015 *
3016 * Note: Should not be called from atomic context
3017 */
3018int ipa3_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ep_aggr)
3019{
3020 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3021 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_aggr == NULL) {
3022 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3023 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3024 return -EINVAL;
3025 }
3026
3027 if (ep_aggr->aggr_en == IPA_ENABLE_DEAGGR &&
3028 !IPA_EP_SUPPORTS_DEAGGR(clnt_hdl)) {
3029 IPAERR("pipe=%d cannot be configured to DEAGGR\n", clnt_hdl);
3030 WARN_ON(1);
3031 return -EINVAL;
3032 }
3033
3034 IPADBG("pipe=%d en=%d(%s), type=%d(%s), byte_limit=%d, time_limit=%d\n",
3035 clnt_hdl,
3036 ep_aggr->aggr_en,
3037 ipa3_get_aggr_enable_str(ep_aggr->aggr_en),
3038 ep_aggr->aggr,
3039 ipa3_get_aggr_type_str(ep_aggr->aggr),
3040 ep_aggr->aggr_byte_limit,
3041 ep_aggr->aggr_time_limit);
3042 IPADBG("hard_byte_limit_en=%d aggr_sw_eof_active=%d\n",
3043 ep_aggr->aggr_hard_byte_limit_en,
3044 ep_aggr->aggr_sw_eof_active);
3045
3046 /* copy over EP cfg */
3047 ipa3_ctx->ep[clnt_hdl].cfg.aggr = *ep_aggr;
3048
3049 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3050
3051 ipahal_write_reg_n_fields(IPA_ENDP_INIT_AGGR_n, clnt_hdl, ep_aggr);
3052
3053 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3054
3055 return 0;
3056}
3057
3058/**
3059 * ipa3_cfg_ep_route() - IPA end-point routing configuration
3060 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3061 * @ipa_ep_cfg: [in] IPA end-point configuration params
3062 *
3063 * Returns: 0 on success, negative on failure
3064 *
3065 * Note: Should not be called from atomic context
3066 */
3067int ipa3_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ep_route)
3068{
3069 struct ipahal_reg_endp_init_route init_rt;
3070
3071 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3072 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_route == NULL) {
3073 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3074 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3075 return -EINVAL;
3076 }
3077
3078 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
3079 IPAERR("ROUTE does not apply to IPA out EP %d\n",
3080 clnt_hdl);
3081 return -EINVAL;
3082 }
3083
3084 /*
3085 * if DMA mode was configured previously for this EP, return with
3086 * success
3087 */
3088 if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA) {
3089 IPADBG("DMA enabled for ep %d, dst pipe is part of DMA\n",
3090 clnt_hdl);
3091 return 0;
3092 }
3093
3094 if (ep_route->rt_tbl_hdl)
3095 IPAERR("client specified non-zero RT TBL hdl - ignore it\n");
3096
3097 IPADBG("pipe=%d, rt_tbl_hdl=%d\n",
3098 clnt_hdl,
3099 ep_route->rt_tbl_hdl);
3100
3101 /* always use "default" routing table when programming EP ROUTE reg */
3102 ipa3_ctx->ep[clnt_hdl].rt_tbl_idx =
3103 IPA_MEM_PART(v4_apps_rt_index_lo);
3104
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003105 if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) {
3106 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
Amir Levy9659e592016-10-27 18:08:27 +03003107
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003108 init_rt.route_table_index = ipa3_ctx->ep[clnt_hdl].rt_tbl_idx;
3109 ipahal_write_reg_n_fields(IPA_ENDP_INIT_ROUTE_n,
3110 clnt_hdl, &init_rt);
Amir Levy9659e592016-10-27 18:08:27 +03003111
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003112 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3113 }
Amir Levy9659e592016-10-27 18:08:27 +03003114
3115 return 0;
3116}
3117
3118/**
3119 * ipa3_cfg_ep_holb() - IPA end-point holb configuration
3120 *
3121 * If an IPA producer pipe is full, IPA HW by default will block
3122 * indefinitely till space opens up. During this time no packets
3123 * including those from unrelated pipes will be processed. Enabling
3124 * HOLB means IPA HW will be allowed to drop packets as/when needed
3125 * and indefinite blocking is avoided.
3126 *
3127 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3128 * @ipa_ep_cfg: [in] IPA end-point configuration params
3129 *
3130 * Returns: 0 on success, negative on failure
3131 */
3132int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb)
3133{
3134 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3135 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_holb == NULL ||
3136 ep_holb->tmr_val > ipa3_ctx->ctrl->max_holb_tmr_val ||
3137 ep_holb->en > 1) {
3138 IPAERR("bad parm.\n");
3139 return -EINVAL;
3140 }
3141
3142 if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
3143 IPAERR("HOLB does not apply to IPA in EP %d\n", clnt_hdl);
3144 return -EINVAL;
3145 }
3146
3147 ipa3_ctx->ep[clnt_hdl].holb = *ep_holb;
3148
3149 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3150
3151 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, clnt_hdl,
3152 ep_holb);
3153
3154 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_TIMER_n, clnt_hdl,
3155 ep_holb);
3156
3157 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3158
3159 IPADBG("cfg holb %u ep=%d tmr=%d\n", ep_holb->en, clnt_hdl,
3160 ep_holb->tmr_val);
3161
3162 return 0;
3163}
3164
3165/**
3166 * ipa3_cfg_ep_holb_by_client() - IPA end-point holb configuration
3167 *
3168 * Wrapper function for ipa3_cfg_ep_holb() with client name instead of
3169 * client handle. This function is used for clients that does not have
3170 * client handle.
3171 *
3172 * @client: [in] client name
3173 * @ipa_ep_cfg: [in] IPA end-point configuration params
3174 *
3175 * Returns: 0 on success, negative on failure
3176 */
3177int ipa3_cfg_ep_holb_by_client(enum ipa_client_type client,
3178 const struct ipa_ep_cfg_holb *ep_holb)
3179{
3180 return ipa3_cfg_ep_holb(ipa3_get_ep_mapping(client), ep_holb);
3181}
3182
3183/**
3184 * ipa3_cfg_ep_deaggr() - IPA end-point deaggregation configuration
3185 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3186 * @ep_deaggr: [in] IPA end-point configuration params
3187 *
3188 * Returns: 0 on success, negative on failure
3189 *
3190 * Note: Should not be called from atomic context
3191 */
3192int ipa3_cfg_ep_deaggr(u32 clnt_hdl,
3193 const struct ipa_ep_cfg_deaggr *ep_deaggr)
3194{
3195 struct ipa3_ep_context *ep;
3196
3197 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3198 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_deaggr == NULL) {
3199 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3200 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3201 return -EINVAL;
3202 }
3203
3204 IPADBG("pipe=%d deaggr_hdr_len=%d\n",
3205 clnt_hdl,
3206 ep_deaggr->deaggr_hdr_len);
3207
3208 IPADBG("packet_offset_valid=%d\n",
3209 ep_deaggr->packet_offset_valid);
3210
3211 IPADBG("packet_offset_location=%d max_packet_len=%d\n",
3212 ep_deaggr->packet_offset_location,
3213 ep_deaggr->max_packet_len);
3214
3215 ep = &ipa3_ctx->ep[clnt_hdl];
3216
3217 /* copy over EP cfg */
3218 ep->cfg.deaggr = *ep_deaggr;
3219
3220 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3221
3222 ipahal_write_reg_n_fields(IPA_ENDP_INIT_DEAGGR_n, clnt_hdl,
3223 &ep->cfg.deaggr);
3224
3225 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3226
3227 return 0;
3228}
3229
3230/**
3231 * ipa3_cfg_ep_metadata() - IPA end-point metadata configuration
3232 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3233 * @ipa_ep_cfg: [in] IPA end-point configuration params
3234 *
3235 * Returns: 0 on success, negative on failure
3236 *
3237 * Note: Should not be called from atomic context
3238 */
3239int ipa3_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
3240{
3241 u32 qmap_id = 0;
3242 struct ipa_ep_cfg_metadata ep_md_reg_wrt;
3243
3244 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3245 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_md == NULL) {
3246 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3247 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3248 return -EINVAL;
3249 }
3250
3251 IPADBG("pipe=%d, mux id=%d\n", clnt_hdl, ep_md->qmap_id);
3252
3253 /* copy over EP cfg */
3254 ipa3_ctx->ep[clnt_hdl].cfg.meta = *ep_md;
3255
3256 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3257
3258 ep_md_reg_wrt = *ep_md;
3259 qmap_id = (ep_md->qmap_id <<
3260 IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT) &
3261 IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_BMASK;
3262
3263 ep_md_reg_wrt.qmap_id = qmap_id;
3264 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_n, clnt_hdl,
3265 &ep_md_reg_wrt);
3266 ipa3_ctx->ep[clnt_hdl].cfg.hdr.hdr_metadata_reg_valid = 1;
3267 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl,
3268 &ipa3_ctx->ep[clnt_hdl].cfg.hdr);
3269
3270 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3271
3272 return 0;
3273}
3274
3275int ipa3_write_qmap_id(struct ipa_ioc_write_qmapid *param_in)
3276{
3277 struct ipa_ep_cfg_metadata meta;
3278 struct ipa3_ep_context *ep;
3279 int ipa_ep_idx;
3280 int result = -EINVAL;
3281
3282 if (param_in->client >= IPA_CLIENT_MAX) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303283 IPAERR_RL("bad parm client:%d\n", param_in->client);
Amir Levy9659e592016-10-27 18:08:27 +03003284 goto fail;
3285 }
3286
3287 ipa_ep_idx = ipa3_get_ep_mapping(param_in->client);
3288 if (ipa_ep_idx == -1) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303289 IPAERR_RL("Invalid client.\n");
Amir Levy9659e592016-10-27 18:08:27 +03003290 goto fail;
3291 }
3292
3293 ep = &ipa3_ctx->ep[ipa_ep_idx];
3294 if (!ep->valid) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303295 IPAERR_RL("EP not allocated.\n");
Amir Levy9659e592016-10-27 18:08:27 +03003296 goto fail;
3297 }
3298
3299 meta.qmap_id = param_in->qmap_id;
3300 if (param_in->client == IPA_CLIENT_USB_PROD ||
3301 param_in->client == IPA_CLIENT_HSIC1_PROD ||
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08003302 param_in->client == IPA_CLIENT_ODU_PROD ||
3303 param_in->client == IPA_CLIENT_ETHERNET_PROD) {
Amir Levy9659e592016-10-27 18:08:27 +03003304 result = ipa3_cfg_ep_metadata(ipa_ep_idx, &meta);
3305 } else if (param_in->client == IPA_CLIENT_WLAN1_PROD) {
3306 ipa3_ctx->ep[ipa_ep_idx].cfg.meta = meta;
3307 result = ipa3_write_qmapid_wdi_pipe(ipa_ep_idx, meta.qmap_id);
3308 if (result)
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303309 IPAERR_RL("qmap_id %d write failed on ep=%d\n",
Amir Levy9659e592016-10-27 18:08:27 +03003310 meta.qmap_id, ipa_ep_idx);
3311 result = 0;
3312 }
3313
3314fail:
3315 return result;
3316}
3317
3318/**
3319 * ipa3_dump_buff_internal() - dumps buffer for debug purposes
3320 * @base: buffer base address
3321 * @phy_base: buffer physical base address
3322 * @size: size of the buffer
3323 */
3324void ipa3_dump_buff_internal(void *base, dma_addr_t phy_base, u32 size)
3325{
3326 int i;
3327 u32 *cur = (u32 *)base;
3328 u8 *byt;
3329
3330 IPADBG("system phys addr=%pa len=%u\n", &phy_base, size);
3331 for (i = 0; i < size / 4; i++) {
3332 byt = (u8 *)(cur + i);
3333 IPADBG("%2d %08x %02x %02x %02x %02x\n", i, *(cur + i),
3334 byt[0], byt[1], byt[2], byt[3]);
3335 }
3336 IPADBG("END\n");
3337}
3338
3339/**
Amir Levy9659e592016-10-27 18:08:27 +03003340 * ipa3_set_aggr_mode() - Set the aggregation mode which is a global setting
3341 * @mode: [in] the desired aggregation mode for e.g. straight MBIM, QCNCM,
3342 * etc
3343 *
3344 * Returns: 0 on success
3345 */
3346int ipa3_set_aggr_mode(enum ipa_aggr_mode mode)
3347{
3348 struct ipahal_reg_qcncm qcncm;
3349
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003350 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3351 if (mode != IPA_MBIM_AGGR) {
3352 IPAERR("Only MBIM mode is supported staring 4.0\n");
3353 return -EPERM;
3354 }
3355 } else {
3356 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3357 ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
3358 qcncm.mode_en = mode;
3359 ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
3360 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3361 }
Amir Levy9659e592016-10-27 18:08:27 +03003362
3363 return 0;
3364}
3365
3366/**
3367 * ipa3_set_qcncm_ndp_sig() - Set the NDP signature used for QCNCM aggregation
3368 * mode
3369 * @sig: [in] the first 3 bytes of QCNCM NDP signature (expected to be
3370 * "QND")
3371 *
3372 * Set the NDP signature used for QCNCM aggregation mode. The fourth byte
3373 * (expected to be 'P') needs to be set using the header addition mechanism
3374 *
3375 * Returns: 0 on success, negative on failure
3376 */
3377int ipa3_set_qcncm_ndp_sig(char sig[3])
3378{
3379 struct ipahal_reg_qcncm qcncm;
3380
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003381 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3382 IPAERR("QCNCM mode is not supported staring 4.0\n");
3383 return -EPERM;
3384 }
3385
Amir Levy9659e592016-10-27 18:08:27 +03003386 if (sig == NULL) {
3387 IPAERR("bad argument for ipa3_set_qcncm_ndp_sig/n");
3388 return -EINVAL;
3389 }
3390 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3391 ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
3392 qcncm.mode_val = ((sig[0] << 16) | (sig[1] << 8) | sig[2]);
3393 ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
3394 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3395
3396 return 0;
3397}
3398
3399/**
3400 * ipa3_set_single_ndp_per_mbim() - Enable/disable single NDP per MBIM frame
3401 * configuration
3402 * @enable: [in] true for single NDP/MBIM; false otherwise
3403 *
3404 * Returns: 0 on success
3405 */
3406int ipa3_set_single_ndp_per_mbim(bool enable)
3407{
3408 struct ipahal_reg_single_ndp_mode mode;
3409
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003410 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3411 IPAERR("QCNCM mode is not supported staring 4.0\n");
3412 return -EPERM;
3413 }
3414
Amir Levy9659e592016-10-27 18:08:27 +03003415 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3416 ipahal_read_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
3417 mode.single_ndp_en = enable;
3418 ipahal_write_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
3419 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3420
3421 return 0;
3422}
3423
3424/**
3425 * ipa3_straddle_boundary() - Checks whether a memory buffer straddles a
3426 * boundary
3427 * @start: start address of the memory buffer
3428 * @end: end address of the memory buffer
3429 * @boundary: boundary
3430 *
3431 * Return value:
3432 * 1: if the interval [start, end] straddles boundary
3433 * 0: otherwise
3434 */
3435int ipa3_straddle_boundary(u32 start, u32 end, u32 boundary)
3436{
3437 u32 next_start;
3438 u32 prev_end;
3439
3440 IPADBG("start=%u end=%u boundary=%u\n", start, end, boundary);
3441
3442 next_start = (start + (boundary - 1)) & ~(boundary - 1);
3443 prev_end = ((end + (boundary - 1)) & ~(boundary - 1)) - boundary;
3444
3445 while (next_start < prev_end)
3446 next_start += boundary;
3447
3448 if (next_start == prev_end)
3449 return 1;
3450 else
3451 return 0;
3452}
3453
3454/**
Amir Levy9659e592016-10-27 18:08:27 +03003455 * ipa3_init_mem_partition() - Reads IPA memory map from DTS, performs alignment
3456 * checks and logs the fetched values.
3457 *
3458 * Returns: 0 on success
3459 */
3460int ipa3_init_mem_partition(struct device_node *node)
3461{
Amir Levy9fadeca2017-04-25 10:18:32 +03003462 const size_t ram_mmap_current_version_size =
3463 sizeof(ipa3_ctx->ctrl->mem_partition) / sizeof(u32);
Amir Levy9659e592016-10-27 18:08:27 +03003464 int result;
3465
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003466 memset(&ipa3_ctx->ctrl->mem_partition, 0,
3467 sizeof(ipa3_ctx->ctrl->mem_partition));
3468
Amir Levy9659e592016-10-27 18:08:27 +03003469 IPADBG("Reading from DTS as u32 array\n");
Amir Levy9659e592016-10-27 18:08:27 +03003470
Amir Levy9fadeca2017-04-25 10:18:32 +03003471 /*
3472 * The size of ipa-ram-mmap array depends on the IPA version. The
3473 * actual size can't be assumed because of possible DTS versions
3474 * mismatch. The size of the array monotonically increasing because the
3475 * obsolete entries are set to zero rather than deleted, so the
3476 * possible sizes are in range
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003477 * [1, ram_mmap_current_version_size]
Amir Levy9fadeca2017-04-25 10:18:32 +03003478 */
3479 result = of_property_read_variable_u32_array(node, "qcom,ipa-ram-mmap",
3480 (u32 *)&ipa3_ctx->ctrl->mem_partition,
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003481 1, ram_mmap_current_version_size);
Amir Levy9fadeca2017-04-25 10:18:32 +03003482
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003483 if (IPA_MEM_PART(uc_event_ring_ofst) & 1023) {
3484 IPAERR("UC EVENT RING OFST 0x%x is unaligned\n",
3485 IPA_MEM_PART(uc_event_ring_ofst));
Amir Levy9659e592016-10-27 18:08:27 +03003486 return -ENODEV;
3487 }
Amir Levy9fadeca2017-04-25 10:18:32 +03003488
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003489 IPADBG("UC EVENT RING OFST 0x%x SIZE 0x%x\n",
3490 IPA_MEM_PART(uc_event_ring_ofst),
3491 IPA_MEM_PART(uc_event_ring_size));
Amir Levy9659e592016-10-27 18:08:27 +03003492
3493 IPADBG("NAT OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(nat_ofst),
3494 IPA_MEM_PART(nat_size));
3495
3496 if (IPA_MEM_PART(uc_info_ofst) & 3) {
3497 IPAERR("UC INFO OFST 0x%x is unaligned\n",
3498 IPA_MEM_PART(uc_info_ofst));
3499 return -ENODEV;
3500 }
3501
3502 IPADBG("UC INFO OFST 0x%x SIZE 0x%x\n",
3503 IPA_MEM_PART(uc_info_ofst), IPA_MEM_PART(uc_info_size));
3504
3505 IPADBG("RAM OFST 0x%x\n", IPA_MEM_PART(ofst_start));
3506
3507 if (IPA_MEM_PART(v4_flt_hash_ofst) & 7) {
3508 IPAERR("V4 FLT HASHABLE OFST 0x%x is unaligned\n",
3509 IPA_MEM_PART(v4_flt_hash_ofst));
3510 return -ENODEV;
3511 }
3512
3513 IPADBG("V4 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3514 IPA_MEM_PART(v4_flt_hash_ofst),
3515 IPA_MEM_PART(v4_flt_hash_size),
3516 IPA_MEM_PART(v4_flt_hash_size_ddr));
3517
3518 if (IPA_MEM_PART(v4_flt_nhash_ofst) & 7) {
3519 IPAERR("V4 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
3520 IPA_MEM_PART(v4_flt_nhash_ofst));
3521 return -ENODEV;
3522 }
3523
3524 IPADBG("V4 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3525 IPA_MEM_PART(v4_flt_nhash_ofst),
3526 IPA_MEM_PART(v4_flt_nhash_size),
3527 IPA_MEM_PART(v4_flt_nhash_size_ddr));
3528
3529 if (IPA_MEM_PART(v6_flt_hash_ofst) & 7) {
3530 IPAERR("V6 FLT HASHABLE OFST 0x%x is unaligned\n",
3531 IPA_MEM_PART(v6_flt_hash_ofst));
3532 return -ENODEV;
3533 }
3534
3535 IPADBG("V6 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3536 IPA_MEM_PART(v6_flt_hash_ofst), IPA_MEM_PART(v6_flt_hash_size),
3537 IPA_MEM_PART(v6_flt_hash_size_ddr));
3538
3539 if (IPA_MEM_PART(v6_flt_nhash_ofst) & 7) {
3540 IPAERR("V6 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
3541 IPA_MEM_PART(v6_flt_nhash_ofst));
3542 return -ENODEV;
3543 }
3544
3545 IPADBG("V6 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3546 IPA_MEM_PART(v6_flt_nhash_ofst),
3547 IPA_MEM_PART(v6_flt_nhash_size),
3548 IPA_MEM_PART(v6_flt_nhash_size_ddr));
3549
3550 IPADBG("V4 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v4_rt_num_index));
3551
3552 IPADBG("V4 RT MODEM INDEXES 0x%x - 0x%x\n",
3553 IPA_MEM_PART(v4_modem_rt_index_lo),
3554 IPA_MEM_PART(v4_modem_rt_index_hi));
3555
3556 IPADBG("V4 RT APPS INDEXES 0x%x - 0x%x\n",
3557 IPA_MEM_PART(v4_apps_rt_index_lo),
3558 IPA_MEM_PART(v4_apps_rt_index_hi));
3559
3560 if (IPA_MEM_PART(v4_rt_hash_ofst) & 7) {
3561 IPAERR("V4 RT HASHABLE OFST 0x%x is unaligned\n",
3562 IPA_MEM_PART(v4_rt_hash_ofst));
3563 return -ENODEV;
3564 }
3565
3566 IPADBG("V4 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v4_rt_hash_ofst));
3567
3568 IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3569 IPA_MEM_PART(v4_rt_hash_size),
3570 IPA_MEM_PART(v4_rt_hash_size_ddr));
3571
3572 if (IPA_MEM_PART(v4_rt_nhash_ofst) & 7) {
3573 IPAERR("V4 RT NON-HASHABLE OFST 0x%x is unaligned\n",
3574 IPA_MEM_PART(v4_rt_nhash_ofst));
3575 return -ENODEV;
3576 }
3577
3578 IPADBG("V4 RT NON-HASHABLE OFST 0x%x\n",
3579 IPA_MEM_PART(v4_rt_nhash_ofst));
3580
3581 IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3582 IPA_MEM_PART(v4_rt_nhash_size),
3583 IPA_MEM_PART(v4_rt_nhash_size_ddr));
3584
3585 IPADBG("V6 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v6_rt_num_index));
3586
3587 IPADBG("V6 RT MODEM INDEXES 0x%x - 0x%x\n",
3588 IPA_MEM_PART(v6_modem_rt_index_lo),
3589 IPA_MEM_PART(v6_modem_rt_index_hi));
3590
3591 IPADBG("V6 RT APPS INDEXES 0x%x - 0x%x\n",
3592 IPA_MEM_PART(v6_apps_rt_index_lo),
3593 IPA_MEM_PART(v6_apps_rt_index_hi));
3594
3595 if (IPA_MEM_PART(v6_rt_hash_ofst) & 7) {
3596 IPAERR("V6 RT HASHABLE OFST 0x%x is unaligned\n",
3597 IPA_MEM_PART(v6_rt_hash_ofst));
3598 return -ENODEV;
3599 }
3600
3601 IPADBG("V6 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v6_rt_hash_ofst));
3602
3603 IPADBG("V6 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3604 IPA_MEM_PART(v6_rt_hash_size),
3605 IPA_MEM_PART(v6_rt_hash_size_ddr));
3606
3607 if (IPA_MEM_PART(v6_rt_nhash_ofst) & 7) {
3608 IPAERR("V6 RT NON-HASHABLE OFST 0x%x is unaligned\n",
3609 IPA_MEM_PART(v6_rt_nhash_ofst));
3610 return -ENODEV;
3611 }
3612
3613 IPADBG("V6 RT NON-HASHABLE OFST 0x%x\n",
3614 IPA_MEM_PART(v6_rt_nhash_ofst));
3615
3616 IPADBG("V6 RT NON-HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3617 IPA_MEM_PART(v6_rt_nhash_size),
3618 IPA_MEM_PART(v6_rt_nhash_size_ddr));
3619
3620 if (IPA_MEM_PART(modem_hdr_ofst) & 7) {
3621 IPAERR("MODEM HDR OFST 0x%x is unaligned\n",
3622 IPA_MEM_PART(modem_hdr_ofst));
3623 return -ENODEV;
3624 }
3625
3626 IPADBG("MODEM HDR OFST 0x%x SIZE 0x%x\n",
3627 IPA_MEM_PART(modem_hdr_ofst), IPA_MEM_PART(modem_hdr_size));
3628
3629 if (IPA_MEM_PART(apps_hdr_ofst) & 7) {
3630 IPAERR("APPS HDR OFST 0x%x is unaligned\n",
3631 IPA_MEM_PART(apps_hdr_ofst));
3632 return -ENODEV;
3633 }
3634
3635 IPADBG("APPS HDR OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3636 IPA_MEM_PART(apps_hdr_ofst), IPA_MEM_PART(apps_hdr_size),
3637 IPA_MEM_PART(apps_hdr_size_ddr));
3638
3639 if (IPA_MEM_PART(modem_hdr_proc_ctx_ofst) & 7) {
3640 IPAERR("MODEM HDR PROC CTX OFST 0x%x is unaligned\n",
3641 IPA_MEM_PART(modem_hdr_proc_ctx_ofst));
3642 return -ENODEV;
3643 }
3644
3645 IPADBG("MODEM HDR PROC CTX OFST 0x%x SIZE 0x%x\n",
3646 IPA_MEM_PART(modem_hdr_proc_ctx_ofst),
3647 IPA_MEM_PART(modem_hdr_proc_ctx_size));
3648
3649 if (IPA_MEM_PART(apps_hdr_proc_ctx_ofst) & 7) {
3650 IPAERR("APPS HDR PROC CTX OFST 0x%x is unaligned\n",
3651 IPA_MEM_PART(apps_hdr_proc_ctx_ofst));
3652 return -ENODEV;
3653 }
3654
3655 IPADBG("APPS HDR PROC CTX OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3656 IPA_MEM_PART(apps_hdr_proc_ctx_ofst),
3657 IPA_MEM_PART(apps_hdr_proc_ctx_size),
3658 IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr));
3659
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003660 if (IPA_MEM_PART(pdn_config_ofst) & 7) {
3661 IPAERR("PDN CONFIG OFST 0x%x is unaligned\n",
3662 IPA_MEM_PART(pdn_config_ofst));
3663 return -ENODEV;
3664 }
3665
3666 IPADBG("PDN CONFIG OFST 0x%x SIZE 0x%x\n",
3667 IPA_MEM_PART(pdn_config_ofst),
3668 IPA_MEM_PART(pdn_config_size));
3669
Amir Levy9659e592016-10-27 18:08:27 +03003670 if (IPA_MEM_PART(modem_ofst) & 7) {
3671 IPAERR("MODEM OFST 0x%x is unaligned\n",
3672 IPA_MEM_PART(modem_ofst));
3673 return -ENODEV;
3674 }
3675
3676 IPADBG("MODEM OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(modem_ofst),
3677 IPA_MEM_PART(modem_size));
3678
3679 IPADBG("V4 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3680 IPA_MEM_PART(apps_v4_flt_hash_ofst),
3681 IPA_MEM_PART(apps_v4_flt_hash_size));
3682
3683 IPADBG("V4 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3684 IPA_MEM_PART(apps_v4_flt_nhash_ofst),
3685 IPA_MEM_PART(apps_v4_flt_nhash_size));
3686
3687 IPADBG("V6 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3688 IPA_MEM_PART(apps_v6_flt_hash_ofst),
3689 IPA_MEM_PART(apps_v6_flt_hash_size));
3690
3691 IPADBG("V6 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3692 IPA_MEM_PART(apps_v6_flt_nhash_ofst),
3693 IPA_MEM_PART(apps_v6_flt_nhash_size));
3694
3695 IPADBG("RAM END OFST 0x%x\n",
3696 IPA_MEM_PART(end_ofst));
3697
3698 IPADBG("V4 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3699 IPA_MEM_PART(apps_v4_rt_hash_ofst),
3700 IPA_MEM_PART(apps_v4_rt_hash_size));
3701
3702 IPADBG("V4 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3703 IPA_MEM_PART(apps_v4_rt_nhash_ofst),
3704 IPA_MEM_PART(apps_v4_rt_nhash_size));
3705
3706 IPADBG("V6 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3707 IPA_MEM_PART(apps_v6_rt_hash_ofst),
3708 IPA_MEM_PART(apps_v6_rt_hash_size));
3709
3710 IPADBG("V6 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3711 IPA_MEM_PART(apps_v6_rt_nhash_ofst),
3712 IPA_MEM_PART(apps_v6_rt_nhash_size));
3713
3714 return 0;
3715}
3716
3717/**
3718 * ipa_ctrl_static_bind() - set the appropriate methods for
3719 * IPA Driver based on the HW version
3720 *
3721 * @ctrl: data structure which holds the function pointers
3722 * @hw_type: the HW type in use
3723 *
3724 * This function can avoid the runtime assignment by using C99 special
3725 * struct initialization - hard decision... time.vs.mem
3726 */
3727int ipa3_controller_static_bind(struct ipa3_controller *ctrl,
3728 enum ipa_hw_type hw_type)
3729{
Skylar Changf88124c2017-07-18 18:11:25 -07003730 if (hw_type >= IPA_HW_v4_0) {
3731 ctrl->ipa_clk_rate_turbo = IPA_V4_0_CLK_RATE_TURBO;
3732 ctrl->ipa_clk_rate_nominal = IPA_V4_0_CLK_RATE_NOMINAL;
3733 ctrl->ipa_clk_rate_svs = IPA_V4_0_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003734 ctrl->ipa_clk_rate_svs2 = IPA_V4_0_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003735 } else if (hw_type >= IPA_HW_v3_5) {
3736 ctrl->ipa_clk_rate_turbo = IPA_V3_5_CLK_RATE_TURBO;
3737 ctrl->ipa_clk_rate_nominal = IPA_V3_5_CLK_RATE_NOMINAL;
3738 ctrl->ipa_clk_rate_svs = IPA_V3_5_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003739 ctrl->ipa_clk_rate_svs2 = IPA_V3_5_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003740 } else {
3741 ctrl->ipa_clk_rate_turbo = IPA_V3_0_CLK_RATE_TURBO;
3742 ctrl->ipa_clk_rate_nominal = IPA_V3_0_CLK_RATE_NOMINAL;
3743 ctrl->ipa_clk_rate_svs = IPA_V3_0_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003744 ctrl->ipa_clk_rate_svs2 = IPA_V3_0_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003745 }
3746
Amir Levy9659e592016-10-27 18:08:27 +03003747 ctrl->ipa_init_rt4 = _ipa_init_rt4_v3;
3748 ctrl->ipa_init_rt6 = _ipa_init_rt6_v3;
3749 ctrl->ipa_init_flt4 = _ipa_init_flt4_v3;
3750 ctrl->ipa_init_flt6 = _ipa_init_flt6_v3;
Amir Levy9659e592016-10-27 18:08:27 +03003751 ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v3_0;
3752 ctrl->ipa3_commit_flt = __ipa_commit_flt_v3;
3753 ctrl->ipa3_commit_rt = __ipa_commit_rt_v3;
3754 ctrl->ipa3_commit_hdr = __ipa_commit_hdr_v3_0;
3755 ctrl->ipa3_enable_clks = _ipa_enable_clks_v3_0;
3756 ctrl->ipa3_disable_clks = _ipa_disable_clks_v3_0;
3757 ctrl->msm_bus_data_ptr = &ipa_bus_client_pdata_v3_0;
Skylar Chang448d8b82017-08-08 17:30:32 -07003758 ctrl->clock_scaling_bw_threshold_svs =
3759 IPA_V3_0_BW_THRESHOLD_SVS_MBPS;
Amir Levy9659e592016-10-27 18:08:27 +03003760 ctrl->clock_scaling_bw_threshold_nominal =
3761 IPA_V3_0_BW_THRESHOLD_NOMINAL_MBPS;
3762 ctrl->clock_scaling_bw_threshold_turbo =
3763 IPA_V3_0_BW_THRESHOLD_TURBO_MBPS;
3764 ctrl->ipa_reg_base_ofst = ipahal_get_reg_base();
Amir Levy9fadeca2017-04-25 10:18:32 +03003765 ctrl->ipa_init_sram = _ipa_init_sram_v3;
Amir Levy9659e592016-10-27 18:08:27 +03003766 ctrl->ipa_sram_read_settings = _ipa_sram_settings_read_v3_0;
Amir Levy9659e592016-10-27 18:08:27 +03003767 ctrl->ipa_init_hdr = _ipa_init_hdr_v3_0;
3768
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003769 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
3770 ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v4_0;
3771
Amir Levy9659e592016-10-27 18:08:27 +03003772 return 0;
3773}
3774
3775void ipa3_skb_recycle(struct sk_buff *skb)
3776{
3777 struct skb_shared_info *shinfo;
3778
3779 shinfo = skb_shinfo(skb);
3780 memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
3781 atomic_set(&shinfo->dataref, 1);
3782
3783 memset(skb, 0, offsetof(struct sk_buff, tail));
3784 skb->data = skb->head + NET_SKB_PAD;
3785 skb_reset_tail_pointer(skb);
3786}
3787
3788int ipa3_alloc_rule_id(struct idr *rule_ids)
3789{
3790 /* There is two groups of rule-Ids, Modem ones and Apps ones.
3791 * Distinction by high bit: Modem Ids are high bit asserted.
3792 */
3793 return idr_alloc(rule_ids, NULL,
3794 ipahal_get_low_rule_id(), ipahal_get_rule_id_hi_bit(),
3795 GFP_KERNEL);
3796}
3797
3798int ipa3_id_alloc(void *ptr)
3799{
3800 int id;
3801
3802 idr_preload(GFP_KERNEL);
3803 spin_lock(&ipa3_ctx->idr_lock);
3804 id = idr_alloc(&ipa3_ctx->ipa_idr, ptr, 0, 0, GFP_NOWAIT);
3805 spin_unlock(&ipa3_ctx->idr_lock);
3806 idr_preload_end();
3807
3808 return id;
3809}
3810
3811void *ipa3_id_find(u32 id)
3812{
3813 void *ptr;
3814
3815 spin_lock(&ipa3_ctx->idr_lock);
3816 ptr = idr_find(&ipa3_ctx->ipa_idr, id);
3817 spin_unlock(&ipa3_ctx->idr_lock);
3818
3819 return ptr;
3820}
3821
3822void ipa3_id_remove(u32 id)
3823{
3824 spin_lock(&ipa3_ctx->idr_lock);
3825 idr_remove(&ipa3_ctx->ipa_idr, id);
3826 spin_unlock(&ipa3_ctx->idr_lock);
3827}
3828
3829void ipa3_tag_destroy_imm(void *user1, int user2)
3830{
3831 ipahal_destroy_imm_cmd(user1);
3832}
3833
3834static void ipa3_tag_free_skb(void *user1, int user2)
3835{
3836 dev_kfree_skb_any((struct sk_buff *)user1);
3837}
3838
3839#define REQUIRED_TAG_PROCESS_DESCRIPTORS 4
3840
3841/* ipa3_tag_process() - Initiates a tag process. Incorporates the input
3842 * descriptors
3843 *
3844 * @desc: descriptors with commands for IC
3845 * @desc_size: amount of descriptors in the above variable
3846 *
3847 * Note: The descriptors are copied (if there's room), the client needs to
3848 * free his descriptors afterwards
3849 *
3850 * Return: 0 or negative in case of failure
3851 */
3852int ipa3_tag_process(struct ipa3_desc desc[],
3853 int descs_num,
3854 unsigned long timeout)
3855{
3856 struct ipa3_sys_context *sys;
3857 struct ipa3_desc *tag_desc;
3858 int desc_idx = 0;
3859 struct ipahal_imm_cmd_ip_packet_init pktinit_cmd;
3860 struct ipahal_imm_cmd_pyld *cmd_pyld = NULL;
3861 struct ipahal_imm_cmd_ip_packet_tag_status status;
3862 int i;
3863 struct sk_buff *dummy_skb;
3864 int res;
3865 struct ipa3_tag_completion *comp;
3866 int ep_idx;
3867
3868 /* Not enough room for the required descriptors for the tag process */
3869 if (IPA_TAG_MAX_DESC - descs_num < REQUIRED_TAG_PROCESS_DESCRIPTORS) {
3870 IPAERR("up to %d descriptors are allowed (received %d)\n",
3871 IPA_TAG_MAX_DESC - REQUIRED_TAG_PROCESS_DESCRIPTORS,
3872 descs_num);
3873 return -ENOMEM;
3874 }
3875
3876 ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD);
3877 if (-1 == ep_idx) {
3878 IPAERR("Client %u is not mapped\n",
3879 IPA_CLIENT_APPS_CMD_PROD);
3880 return -EFAULT;
3881 }
3882 sys = ipa3_ctx->ep[ep_idx].sys;
3883
3884 tag_desc = kzalloc(sizeof(*tag_desc) * IPA_TAG_MAX_DESC, GFP_KERNEL);
3885 if (!tag_desc) {
3886 IPAERR("failed to allocate memory\n");
3887 return -ENOMEM;
3888 }
3889
3890 /* Copy the required descriptors from the client now */
3891 if (desc) {
3892 memcpy(&(tag_desc[0]), desc, descs_num *
3893 sizeof(tag_desc[0]));
3894 desc_idx += descs_num;
3895 }
3896
3897 /* NO-OP IC for ensuring that IPA pipeline is empty */
3898 cmd_pyld = ipahal_construct_nop_imm_cmd(
3899 false, IPAHAL_FULL_PIPELINE_CLEAR, false);
3900 if (!cmd_pyld) {
3901 IPAERR("failed to construct NOP imm cmd\n");
3902 res = -ENOMEM;
3903 goto fail_free_tag_desc;
3904 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003905 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003906 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3907 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003908 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003909
3910 /* IP_PACKET_INIT IC for tag status to be sent to apps */
3911 pktinit_cmd.destination_pipe_index =
3912 ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
3913 cmd_pyld = ipahal_construct_imm_cmd(
3914 IPA_IMM_CMD_IP_PACKET_INIT, &pktinit_cmd, false);
3915 if (!cmd_pyld) {
3916 IPAERR("failed to construct ip_packet_init imm cmd\n");
3917 res = -ENOMEM;
3918 goto fail_free_desc;
3919 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003920 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003921 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3922 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003923 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003924
3925 /* status IC */
3926 status.tag = IPA_COOKIE;
3927 cmd_pyld = ipahal_construct_imm_cmd(
3928 IPA_IMM_CMD_IP_PACKET_TAG_STATUS, &status, false);
3929 if (!cmd_pyld) {
3930 IPAERR("failed to construct ip_packet_tag_status imm cmd\n");
3931 res = -ENOMEM;
3932 goto fail_free_desc;
3933 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003934 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003935 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3936 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003937 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003938
3939 comp = kzalloc(sizeof(*comp), GFP_KERNEL);
3940 if (!comp) {
3941 IPAERR("no mem\n");
3942 res = -ENOMEM;
3943 goto fail_free_desc;
3944 }
3945 init_completion(&comp->comp);
3946
3947 /* completion needs to be released from both here and rx handler */
3948 atomic_set(&comp->cnt, 2);
3949
3950 /* dummy packet to send to IPA. packet payload is a completion object */
3951 dummy_skb = alloc_skb(sizeof(comp), GFP_KERNEL);
3952 if (!dummy_skb) {
3953 IPAERR("failed to allocate memory\n");
3954 res = -ENOMEM;
3955 goto fail_free_comp;
3956 }
3957
3958 memcpy(skb_put(dummy_skb, sizeof(comp)), &comp, sizeof(comp));
3959
Amir Levy479cfdd2017-10-26 12:23:14 +03003960 if (desc_idx >= IPA_TAG_MAX_DESC) {
3961 IPAERR("number of commands is out of range\n");
3962 res = -ENOBUFS;
3963 goto fail_free_skb;
3964 }
3965
Amir Levy9659e592016-10-27 18:08:27 +03003966 tag_desc[desc_idx].pyld = dummy_skb->data;
3967 tag_desc[desc_idx].len = dummy_skb->len;
3968 tag_desc[desc_idx].type = IPA_DATA_DESC_SKB;
3969 tag_desc[desc_idx].callback = ipa3_tag_free_skb;
3970 tag_desc[desc_idx].user1 = dummy_skb;
3971 desc_idx++;
3972
3973 /* send all descriptors to IPA with single EOT */
3974 res = ipa3_send(sys, desc_idx, tag_desc, true);
3975 if (res) {
3976 IPAERR("failed to send TAG packets %d\n", res);
3977 res = -ENOMEM;
Amir Levy479cfdd2017-10-26 12:23:14 +03003978 goto fail_free_skb;
Amir Levy9659e592016-10-27 18:08:27 +03003979 }
3980 kfree(tag_desc);
3981 tag_desc = NULL;
3982
3983 IPADBG("waiting for TAG response\n");
3984 res = wait_for_completion_timeout(&comp->comp, timeout);
3985 if (res == 0) {
3986 IPAERR("timeout (%lu msec) on waiting for TAG response\n",
3987 timeout);
3988 WARN_ON(1);
3989 if (atomic_dec_return(&comp->cnt) == 0)
3990 kfree(comp);
3991 return -ETIME;
3992 }
3993
3994 IPADBG("TAG response arrived!\n");
3995 if (atomic_dec_return(&comp->cnt) == 0)
3996 kfree(comp);
3997
Amir Levya59ed3f2017-03-05 17:30:55 +02003998 /*
3999 * sleep for short period to ensure IPA wrote all packets to
4000 * the transport
4001 */
Amir Levy9659e592016-10-27 18:08:27 +03004002 usleep_range(IPA_TAG_SLEEP_MIN_USEC, IPA_TAG_SLEEP_MAX_USEC);
4003
4004 return 0;
4005
Amir Levy479cfdd2017-10-26 12:23:14 +03004006fail_free_skb:
4007 kfree_skb(dummy_skb);
Amir Levy9659e592016-10-27 18:08:27 +03004008fail_free_comp:
4009 kfree(comp);
4010fail_free_desc:
4011 /*
4012 * Free only the first descriptors allocated here.
4013 * [nop, pkt_init, status, dummy_skb]
4014 * The user is responsible to free his allocations
4015 * in case of failure.
4016 * The min is required because we may fail during
4017 * of the initial allocations above
4018 */
4019 for (i = descs_num;
4020 i < min(REQUIRED_TAG_PROCESS_DESCRIPTORS, desc_idx); i++)
4021 if (tag_desc[i].callback)
4022 tag_desc[i].callback(tag_desc[i].user1,
4023 tag_desc[i].user2);
4024fail_free_tag_desc:
4025 kfree(tag_desc);
4026 return res;
4027}
4028
4029/**
4030 * ipa3_tag_generate_force_close_desc() - generate descriptors for force close
4031 * immediate command
4032 *
4033 * @desc: descriptors for IC
4034 * @desc_size: desc array size
4035 * @start_pipe: first pipe to close aggregation
4036 * @end_pipe: last (non-inclusive) pipe to close aggregation
4037 *
4038 * Return: number of descriptors written or negative in case of failure
4039 */
4040static int ipa3_tag_generate_force_close_desc(struct ipa3_desc desc[],
4041 int desc_size, int start_pipe, int end_pipe)
4042{
4043 int i;
4044 struct ipa_ep_cfg_aggr ep_aggr;
4045 int desc_idx = 0;
4046 int res;
4047 struct ipahal_imm_cmd_register_write reg_write_agg_close;
4048 struct ipahal_imm_cmd_pyld *cmd_pyld;
4049 struct ipahal_reg_valmask valmask;
4050
4051 for (i = start_pipe; i < end_pipe; i++) {
4052 ipahal_read_reg_n_fields(IPA_ENDP_INIT_AGGR_n, i, &ep_aggr);
4053 if (!ep_aggr.aggr_en)
4054 continue;
4055 IPADBG("Force close ep: %d\n", i);
4056 if (desc_idx + 1 > desc_size) {
4057 IPAERR("Internal error - no descriptors\n");
4058 res = -EFAULT;
4059 goto fail_no_desc;
4060 }
4061
4062 reg_write_agg_close.skip_pipeline_clear = false;
4063 reg_write_agg_close.pipeline_clear_options =
4064 IPAHAL_FULL_PIPELINE_CLEAR;
4065 reg_write_agg_close.offset =
4066 ipahal_get_reg_ofst(IPA_AGGR_FORCE_CLOSE);
Ghanim Fodicff9c942017-08-07 11:40:58 +03004067 ipahal_get_aggr_force_close_valmask(i, &valmask);
Amir Levy9659e592016-10-27 18:08:27 +03004068 reg_write_agg_close.value = valmask.val;
4069 reg_write_agg_close.value_mask = valmask.mask;
4070 cmd_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE,
4071 &reg_write_agg_close, false);
4072 if (!cmd_pyld) {
4073 IPAERR("failed to construct register_write imm cmd\n");
4074 res = -ENOMEM;
4075 goto fail_alloc_reg_write_agg_close;
4076 }
4077
Amir Levy479cfdd2017-10-26 12:23:14 +03004078 ipa3_init_imm_cmd_desc(&desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03004079 desc[desc_idx].callback = ipa3_tag_destroy_imm;
4080 desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03004081 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004082 }
4083
4084 return desc_idx;
4085
4086fail_alloc_reg_write_agg_close:
Amir Levy479cfdd2017-10-26 12:23:14 +03004087 for (i = 0; i < desc_idx; ++i)
Amir Levy9659e592016-10-27 18:08:27 +03004088 if (desc[desc_idx].callback)
4089 desc[desc_idx].callback(desc[desc_idx].user1,
4090 desc[desc_idx].user2);
4091fail_no_desc:
4092 return res;
4093}
4094
4095/**
4096 * ipa3_tag_aggr_force_close() - Force close aggregation
4097 *
4098 * @pipe_num: pipe number or -1 for all pipes
4099 */
4100int ipa3_tag_aggr_force_close(int pipe_num)
4101{
4102 struct ipa3_desc *desc;
4103 int res = -1;
4104 int start_pipe;
4105 int end_pipe;
4106 int num_descs;
4107 int num_aggr_descs;
4108
4109 if (pipe_num < -1 || pipe_num >= (int)ipa3_ctx->ipa_num_pipes) {
4110 IPAERR("Invalid pipe number %d\n", pipe_num);
4111 return -EINVAL;
4112 }
4113
4114 if (pipe_num == -1) {
4115 start_pipe = 0;
4116 end_pipe = ipa3_ctx->ipa_num_pipes;
4117 } else {
4118 start_pipe = pipe_num;
4119 end_pipe = pipe_num + 1;
4120 }
4121
4122 num_descs = end_pipe - start_pipe;
4123
4124 desc = kcalloc(num_descs, sizeof(*desc), GFP_KERNEL);
4125 if (!desc) {
4126 IPAERR("no mem\n");
4127 return -ENOMEM;
4128 }
4129
4130 /* Force close aggregation on all valid pipes with aggregation */
4131 num_aggr_descs = ipa3_tag_generate_force_close_desc(desc, num_descs,
4132 start_pipe, end_pipe);
4133 if (num_aggr_descs < 0) {
4134 IPAERR("ipa3_tag_generate_force_close_desc failed %d\n",
4135 num_aggr_descs);
4136 goto fail_free_desc;
4137 }
4138
4139 res = ipa3_tag_process(desc, num_aggr_descs,
4140 IPA_FORCE_CLOSE_TAG_PROCESS_TIMEOUT);
4141
4142fail_free_desc:
4143 kfree(desc);
4144
4145 return res;
4146}
4147
4148/**
4149 * ipa3_is_ready() - check if IPA module was initialized
4150 * successfully
4151 *
4152 * Return value: true for yes; false for no
4153 */
4154bool ipa3_is_ready(void)
4155{
4156 bool complete;
4157
4158 if (ipa3_ctx == NULL)
4159 return false;
4160 mutex_lock(&ipa3_ctx->lock);
4161 complete = ipa3_ctx->ipa_initialization_complete;
4162 mutex_unlock(&ipa3_ctx->lock);
4163 return complete;
4164}
4165
4166/**
4167 * ipa3_is_client_handle_valid() - check if IPA client handle is valid handle
4168 *
4169 * Return value: true for yes; false for no
4170 */
4171bool ipa3_is_client_handle_valid(u32 clnt_hdl)
4172{
4173 if (clnt_hdl >= 0 && clnt_hdl < ipa3_ctx->ipa_num_pipes)
4174 return true;
4175 return false;
4176}
4177
4178/**
4179 * ipa3_proxy_clk_unvote() - called to remove IPA clock proxy vote
4180 *
4181 * Return value: none
4182 */
4183void ipa3_proxy_clk_unvote(void)
4184{
Skylar Changfb792c62017-08-17 12:53:23 -07004185 if (!ipa3_is_ready())
4186 return;
4187
4188 mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
4189 if (ipa3_ctx->q6_proxy_clk_vote_valid) {
Amir Levy9659e592016-10-27 18:08:27 +03004190 IPA_ACTIVE_CLIENTS_DEC_SPECIAL("PROXY_CLK_VOTE");
Mohammed Javid05b05d02017-11-13 23:43:27 +05304191 ipa3_ctx->q6_proxy_clk_vote_cnt--;
4192 if (ipa3_ctx->q6_proxy_clk_vote_cnt == 0)
4193 ipa3_ctx->q6_proxy_clk_vote_valid = false;
Amir Levy9659e592016-10-27 18:08:27 +03004194 }
Skylar Changfb792c62017-08-17 12:53:23 -07004195 mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Amir Levy9659e592016-10-27 18:08:27 +03004196}
4197
4198/**
4199 * ipa3_proxy_clk_vote() - called to add IPA clock proxy vote
4200 *
4201 * Return value: none
4202 */
4203void ipa3_proxy_clk_vote(void)
4204{
Skylar Changfb792c62017-08-17 12:53:23 -07004205 if (!ipa3_is_ready())
4206 return;
4207
4208 mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Mohammed Javid05b05d02017-11-13 23:43:27 +05304209 if (!ipa3_ctx->q6_proxy_clk_vote_valid ||
4210 (ipa3_ctx->q6_proxy_clk_vote_cnt > 0)) {
Amir Levy9659e592016-10-27 18:08:27 +03004211 IPA_ACTIVE_CLIENTS_INC_SPECIAL("PROXY_CLK_VOTE");
Mohammed Javid05b05d02017-11-13 23:43:27 +05304212 ipa3_ctx->q6_proxy_clk_vote_cnt++;
Amir Levy9659e592016-10-27 18:08:27 +03004213 ipa3_ctx->q6_proxy_clk_vote_valid = true;
4214 }
Skylar Changfb792c62017-08-17 12:53:23 -07004215 mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Amir Levy9659e592016-10-27 18:08:27 +03004216}
4217
4218/**
4219 * ipa3_get_smem_restr_bytes()- Return IPA smem restricted bytes
4220 *
4221 * Return value: u16 - number of IPA smem restricted bytes
4222 */
4223u16 ipa3_get_smem_restr_bytes(void)
4224{
4225 if (ipa3_ctx)
4226 return ipa3_ctx->smem_restricted_bytes;
4227
4228 IPAERR("IPA Driver not initialized\n");
4229
4230 return 0;
4231}
4232
4233/**
4234 * ipa3_get_modem_cfg_emb_pipe_flt()- Return ipa3_ctx->modem_cfg_emb_pipe_flt
4235 *
4236 * Return value: true if modem configures embedded pipe flt, false otherwise
4237 */
4238bool ipa3_get_modem_cfg_emb_pipe_flt(void)
4239{
4240 if (ipa3_ctx)
4241 return ipa3_ctx->modem_cfg_emb_pipe_flt;
4242
4243 IPAERR("IPA driver has not been initialized\n");
4244
4245 return false;
4246}
4247
4248/**
Amir Levya59ed3f2017-03-05 17:30:55 +02004249 * ipa3_get_transport_type()
Amir Levy9659e592016-10-27 18:08:27 +03004250 *
4251 * Return value: enum ipa_transport_type
4252 */
4253enum ipa_transport_type ipa3_get_transport_type(void)
4254{
Amir Levy9659e592016-10-27 18:08:27 +03004255 return IPA_TRANSPORT_TYPE_GSI;
4256}
4257
4258u32 ipa3_get_num_pipes(void)
4259{
4260 return ipahal_read_reg(IPA_ENABLED_PIPES);
4261}
4262
4263/**
4264 * ipa3_disable_apps_wan_cons_deaggr()-
4265 * set ipa_ctx->ipa_client_apps_wan_cons_agg_gro
4266 *
4267 * Return value: 0 or negative in case of failure
4268 */
4269int ipa3_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
4270{
4271 int res = -1;
4272 u32 limit;
4273
4274 /* checking if IPA-HW can support */
4275 limit = ipahal_aggr_get_max_byte_limit();
4276 if ((agg_size >> 10) > limit) {
4277 IPAERR("IPA-AGG byte limit %d\n", limit);
4278 IPAERR("exceed aggr_byte_limit\n");
4279 return res;
4280 }
4281 limit = ipahal_aggr_get_max_pkt_limit();
4282 if (agg_count > limit) {
4283 IPAERR("IPA-AGG pkt limit %d\n", limit);
4284 IPAERR("exceed aggr_pkt_limit\n");
4285 return res;
4286 }
4287
4288 if (ipa3_ctx) {
4289 ipa3_ctx->ipa_client_apps_wan_cons_agg_gro = true;
4290 return 0;
4291 }
4292 return res;
4293}
4294
4295static void *ipa3_get_ipc_logbuf(void)
4296{
4297 if (ipa3_ctx)
4298 return ipa3_ctx->logbuf;
4299
4300 return NULL;
4301}
4302
4303static void *ipa3_get_ipc_logbuf_low(void)
4304{
4305 if (ipa3_ctx)
4306 return ipa3_ctx->logbuf_low;
4307
4308 return NULL;
4309}
4310
4311static void ipa3_get_holb(int ep_idx, struct ipa_ep_cfg_holb *holb)
4312{
4313 *holb = ipa3_ctx->ep[ep_idx].holb;
4314}
4315
4316static void ipa3_set_tag_process_before_gating(bool val)
4317{
4318 ipa3_ctx->tag_process_before_gating = val;
4319}
4320
Amir Levy2da9d452017-12-12 10:09:46 +02004321/**
4322 * ipa3_is_vlan_mode - check if a LAN driver should load in VLAN mode
4323 * @iface - type of vlan capable device
4324 * @res - query result: true for vlan mode, false for non vlan mode
4325 *
4326 * API must be called after ipa_is_ready() returns true, otherwise it will fail
4327 *
4328 * Returns: 0 on success, negative on failure
4329 */
4330static int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
4331{
4332 if (!res) {
4333 IPAERR("NULL out param\n");
4334 return -EINVAL;
4335 }
4336
4337 if (iface < 0 || iface > IPA_VLAN_IF_MAX) {
4338 IPAERR("invalid iface %d\n", iface);
4339 return -EINVAL;
4340 }
4341
4342 if (!ipa3_is_ready()) {
4343 IPAERR("IPA is not ready yet\n");
4344 return -ENODEV;
4345 }
4346
4347 *res = ipa3_ctx->vlan_mode_iface[iface];
4348
4349 IPADBG("Driver %d vlan mode is %d\n", iface, *res);
4350 return 0;
4351}
4352
Amir Levy9659e592016-10-27 18:08:27 +03004353int ipa3_bind_api_controller(enum ipa_hw_type ipa_hw_type,
4354 struct ipa_api_controller *api_ctrl)
4355{
4356 if (ipa_hw_type < IPA_HW_v3_0) {
4357 IPAERR("Unsupported IPA HW version %d\n", ipa_hw_type);
4358 WARN_ON(1);
4359 return -EPERM;
4360 }
4361
Amir Levya59ed3f2017-03-05 17:30:55 +02004362 api_ctrl->ipa_connect = NULL;
4363 api_ctrl->ipa_disconnect = NULL;
4364 api_ctrl->ipa_reset_endpoint = NULL;
Amir Levy9659e592016-10-27 18:08:27 +03004365 api_ctrl->ipa_clear_endpoint_delay = ipa3_clear_endpoint_delay;
4366 api_ctrl->ipa_disable_endpoint = NULL;
4367 api_ctrl->ipa_cfg_ep = ipa3_cfg_ep;
4368 api_ctrl->ipa_cfg_ep_nat = ipa3_cfg_ep_nat;
Amir Levydc65f4c2017-07-06 09:49:50 +03004369 api_ctrl->ipa_cfg_ep_conn_track = ipa3_cfg_ep_conn_track;
Amir Levy9659e592016-10-27 18:08:27 +03004370 api_ctrl->ipa_cfg_ep_hdr = ipa3_cfg_ep_hdr;
4371 api_ctrl->ipa_cfg_ep_hdr_ext = ipa3_cfg_ep_hdr_ext;
4372 api_ctrl->ipa_cfg_ep_mode = ipa3_cfg_ep_mode;
4373 api_ctrl->ipa_cfg_ep_aggr = ipa3_cfg_ep_aggr;
4374 api_ctrl->ipa_cfg_ep_deaggr = ipa3_cfg_ep_deaggr;
4375 api_ctrl->ipa_cfg_ep_route = ipa3_cfg_ep_route;
4376 api_ctrl->ipa_cfg_ep_holb = ipa3_cfg_ep_holb;
4377 api_ctrl->ipa_get_holb = ipa3_get_holb;
4378 api_ctrl->ipa_set_tag_process_before_gating =
4379 ipa3_set_tag_process_before_gating;
4380 api_ctrl->ipa_cfg_ep_cfg = ipa3_cfg_ep_cfg;
4381 api_ctrl->ipa_cfg_ep_metadata_mask = ipa3_cfg_ep_metadata_mask;
4382 api_ctrl->ipa_cfg_ep_holb_by_client = ipa3_cfg_ep_holb_by_client;
4383 api_ctrl->ipa_cfg_ep_ctrl = ipa3_cfg_ep_ctrl;
4384 api_ctrl->ipa_add_hdr = ipa3_add_hdr;
4385 api_ctrl->ipa_del_hdr = ipa3_del_hdr;
4386 api_ctrl->ipa_commit_hdr = ipa3_commit_hdr;
4387 api_ctrl->ipa_reset_hdr = ipa3_reset_hdr;
4388 api_ctrl->ipa_get_hdr = ipa3_get_hdr;
4389 api_ctrl->ipa_put_hdr = ipa3_put_hdr;
4390 api_ctrl->ipa_copy_hdr = ipa3_copy_hdr;
4391 api_ctrl->ipa_add_hdr_proc_ctx = ipa3_add_hdr_proc_ctx;
4392 api_ctrl->ipa_del_hdr_proc_ctx = ipa3_del_hdr_proc_ctx;
4393 api_ctrl->ipa_add_rt_rule = ipa3_add_rt_rule;
4394 api_ctrl->ipa_del_rt_rule = ipa3_del_rt_rule;
4395 api_ctrl->ipa_commit_rt = ipa3_commit_rt;
4396 api_ctrl->ipa_reset_rt = ipa3_reset_rt;
4397 api_ctrl->ipa_get_rt_tbl = ipa3_get_rt_tbl;
4398 api_ctrl->ipa_put_rt_tbl = ipa3_put_rt_tbl;
4399 api_ctrl->ipa_query_rt_index = ipa3_query_rt_index;
4400 api_ctrl->ipa_mdfy_rt_rule = ipa3_mdfy_rt_rule;
4401 api_ctrl->ipa_add_flt_rule = ipa3_add_flt_rule;
4402 api_ctrl->ipa_del_flt_rule = ipa3_del_flt_rule;
4403 api_ctrl->ipa_mdfy_flt_rule = ipa3_mdfy_flt_rule;
4404 api_ctrl->ipa_commit_flt = ipa3_commit_flt;
4405 api_ctrl->ipa_reset_flt = ipa3_reset_flt;
Amir Levy479cfdd2017-10-26 12:23:14 +03004406 api_ctrl->ipa_allocate_nat_device = ipa3_allocate_nat_device;
4407 api_ctrl->ipa_allocate_nat_table = ipa3_allocate_nat_table;
4408 api_ctrl->ipa_allocate_ipv6ct_table = ipa3_allocate_ipv6ct_table;
Amir Levy9659e592016-10-27 18:08:27 +03004409 api_ctrl->ipa_nat_init_cmd = ipa3_nat_init_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004410 api_ctrl->ipa_ipv6ct_init_cmd = ipa3_ipv6ct_init_cmd;
Amir Levy9659e592016-10-27 18:08:27 +03004411 api_ctrl->ipa_nat_dma_cmd = ipa3_nat_dma_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004412 api_ctrl->ipa_table_dma_cmd = ipa3_table_dma_cmd;
Amir Levy9659e592016-10-27 18:08:27 +03004413 api_ctrl->ipa_nat_del_cmd = ipa3_nat_del_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004414 api_ctrl->ipa_del_nat_table = ipa3_del_nat_table;
4415 api_ctrl->ipa_del_ipv6ct_table = ipa3_del_ipv6ct_table;
4416 api_ctrl->ipa_nat_mdfy_pdn = ipa3_nat_mdfy_pdn;
Amir Levy9659e592016-10-27 18:08:27 +03004417 api_ctrl->ipa_send_msg = ipa3_send_msg;
4418 api_ctrl->ipa_register_pull_msg = ipa3_register_pull_msg;
4419 api_ctrl->ipa_deregister_pull_msg = ipa3_deregister_pull_msg;
4420 api_ctrl->ipa_register_intf = ipa3_register_intf;
4421 api_ctrl->ipa_register_intf_ext = ipa3_register_intf_ext;
4422 api_ctrl->ipa_deregister_intf = ipa3_deregister_intf;
4423 api_ctrl->ipa_set_aggr_mode = ipa3_set_aggr_mode;
4424 api_ctrl->ipa_set_qcncm_ndp_sig = ipa3_set_qcncm_ndp_sig;
4425 api_ctrl->ipa_set_single_ndp_per_mbim = ipa3_set_single_ndp_per_mbim;
4426 api_ctrl->ipa_tx_dp = ipa3_tx_dp;
4427 api_ctrl->ipa_tx_dp_mul = ipa3_tx_dp_mul;
4428 api_ctrl->ipa_free_skb = ipa3_free_skb;
4429 api_ctrl->ipa_setup_sys_pipe = ipa3_setup_sys_pipe;
4430 api_ctrl->ipa_teardown_sys_pipe = ipa3_teardown_sys_pipe;
4431 api_ctrl->ipa_sys_setup = ipa3_sys_setup;
4432 api_ctrl->ipa_sys_teardown = ipa3_sys_teardown;
4433 api_ctrl->ipa_sys_update_gsi_hdls = ipa3_sys_update_gsi_hdls;
4434 api_ctrl->ipa_connect_wdi_pipe = ipa3_connect_wdi_pipe;
4435 api_ctrl->ipa_disconnect_wdi_pipe = ipa3_disconnect_wdi_pipe;
4436 api_ctrl->ipa_enable_wdi_pipe = ipa3_enable_wdi_pipe;
4437 api_ctrl->ipa_disable_wdi_pipe = ipa3_disable_wdi_pipe;
4438 api_ctrl->ipa_resume_wdi_pipe = ipa3_resume_wdi_pipe;
4439 api_ctrl->ipa_suspend_wdi_pipe = ipa3_suspend_wdi_pipe;
4440 api_ctrl->ipa_get_wdi_stats = ipa3_get_wdi_stats;
4441 api_ctrl->ipa_get_smem_restr_bytes = ipa3_get_smem_restr_bytes;
Skylar Chang6b41f8d2016-11-01 12:50:11 -07004442 api_ctrl->ipa_broadcast_wdi_quota_reach_ind =
4443 ipa3_broadcast_wdi_quota_reach_ind;
Amir Levy9659e592016-10-27 18:08:27 +03004444 api_ctrl->ipa_uc_wdi_get_dbpa = ipa3_uc_wdi_get_dbpa;
4445 api_ctrl->ipa_uc_reg_rdyCB = ipa3_uc_reg_rdyCB;
4446 api_ctrl->ipa_uc_dereg_rdyCB = ipa3_uc_dereg_rdyCB;
4447 api_ctrl->teth_bridge_init = ipa3_teth_bridge_init;
4448 api_ctrl->teth_bridge_disconnect = ipa3_teth_bridge_disconnect;
4449 api_ctrl->teth_bridge_connect = ipa3_teth_bridge_connect;
4450 api_ctrl->ipa_set_client = ipa3_set_client;
4451 api_ctrl->ipa_get_client = ipa3_get_client;
4452 api_ctrl->ipa_get_client_uplink = ipa3_get_client_uplink;
4453 api_ctrl->ipa_dma_init = ipa3_dma_init;
4454 api_ctrl->ipa_dma_enable = ipa3_dma_enable;
4455 api_ctrl->ipa_dma_disable = ipa3_dma_disable;
4456 api_ctrl->ipa_dma_sync_memcpy = ipa3_dma_sync_memcpy;
4457 api_ctrl->ipa_dma_async_memcpy = ipa3_dma_async_memcpy;
4458 api_ctrl->ipa_dma_uc_memcpy = ipa3_dma_uc_memcpy;
4459 api_ctrl->ipa_dma_destroy = ipa3_dma_destroy;
4460 api_ctrl->ipa_mhi_init_engine = ipa3_mhi_init_engine;
4461 api_ctrl->ipa_connect_mhi_pipe = ipa3_connect_mhi_pipe;
4462 api_ctrl->ipa_disconnect_mhi_pipe = ipa3_disconnect_mhi_pipe;
4463 api_ctrl->ipa_mhi_stop_gsi_channel = ipa3_mhi_stop_gsi_channel;
4464 api_ctrl->ipa_uc_mhi_reset_channel = ipa3_uc_mhi_reset_channel;
4465 api_ctrl->ipa_qmi_enable_force_clear_datapath_send =
4466 ipa3_qmi_enable_force_clear_datapath_send;
4467 api_ctrl->ipa_qmi_disable_force_clear_datapath_send =
4468 ipa3_qmi_disable_force_clear_datapath_send;
4469 api_ctrl->ipa_mhi_reset_channel_internal =
4470 ipa3_mhi_reset_channel_internal;
4471 api_ctrl->ipa_mhi_start_channel_internal =
4472 ipa3_mhi_start_channel_internal;
4473 api_ctrl->ipa_mhi_query_ch_info = ipa3_mhi_query_ch_info;
4474 api_ctrl->ipa_mhi_resume_channels_internal =
4475 ipa3_mhi_resume_channels_internal;
4476 api_ctrl->ipa_has_open_aggr_frame = ipa3_has_open_aggr_frame;
4477 api_ctrl->ipa_mhi_destroy_channel = ipa3_mhi_destroy_channel;
4478 api_ctrl->ipa_uc_mhi_send_dl_ul_sync_info =
4479 ipa3_uc_mhi_send_dl_ul_sync_info;
4480 api_ctrl->ipa_uc_mhi_init = ipa3_uc_mhi_init;
4481 api_ctrl->ipa_uc_mhi_suspend_channel = ipa3_uc_mhi_suspend_channel;
4482 api_ctrl->ipa_uc_mhi_stop_event_update_channel =
4483 ipa3_uc_mhi_stop_event_update_channel;
4484 api_ctrl->ipa_uc_mhi_cleanup = ipa3_uc_mhi_cleanup;
4485 api_ctrl->ipa_uc_state_check = ipa3_uc_state_check;
4486 api_ctrl->ipa_write_qmap_id = ipa3_write_qmap_id;
4487 api_ctrl->ipa_add_interrupt_handler = ipa3_add_interrupt_handler;
4488 api_ctrl->ipa_remove_interrupt_handler = ipa3_remove_interrupt_handler;
4489 api_ctrl->ipa_restore_suspend_handler = ipa3_restore_suspend_handler;
Amir Levya59ed3f2017-03-05 17:30:55 +02004490 api_ctrl->ipa_bam_reg_dump = NULL;
Amir Levy9659e592016-10-27 18:08:27 +03004491 api_ctrl->ipa_get_ep_mapping = ipa3_get_ep_mapping;
4492 api_ctrl->ipa_is_ready = ipa3_is_ready;
4493 api_ctrl->ipa_proxy_clk_vote = ipa3_proxy_clk_vote;
4494 api_ctrl->ipa_proxy_clk_unvote = ipa3_proxy_clk_unvote;
4495 api_ctrl->ipa_is_client_handle_valid = ipa3_is_client_handle_valid;
4496 api_ctrl->ipa_get_client_mapping = ipa3_get_client_mapping;
4497 api_ctrl->ipa_get_rm_resource_from_ep = ipa3_get_rm_resource_from_ep;
4498 api_ctrl->ipa_get_modem_cfg_emb_pipe_flt =
4499 ipa3_get_modem_cfg_emb_pipe_flt;
4500 api_ctrl->ipa_get_transport_type = ipa3_get_transport_type;
4501 api_ctrl->ipa_ap_suspend = ipa3_ap_suspend;
4502 api_ctrl->ipa_ap_resume = ipa3_ap_resume;
4503 api_ctrl->ipa_get_smmu_domain = ipa3_get_smmu_domain;
4504 api_ctrl->ipa_disable_apps_wan_cons_deaggr =
4505 ipa3_disable_apps_wan_cons_deaggr;
4506 api_ctrl->ipa_get_dma_dev = ipa3_get_dma_dev;
4507 api_ctrl->ipa_release_wdi_mapping = ipa3_release_wdi_mapping;
4508 api_ctrl->ipa_create_wdi_mapping = ipa3_create_wdi_mapping;
4509 api_ctrl->ipa_get_gsi_ep_info = ipa3_get_gsi_ep_info;
4510 api_ctrl->ipa_stop_gsi_channel = ipa3_stop_gsi_channel;
Skylar Chang9fbce062017-07-25 16:20:42 -07004511 api_ctrl->ipa_start_gsi_channel = ipa3_start_gsi_channel;
Amir Levy9659e592016-10-27 18:08:27 +03004512 api_ctrl->ipa_register_ipa_ready_cb = ipa3_register_ipa_ready_cb;
4513 api_ctrl->ipa_inc_client_enable_clks = ipa3_inc_client_enable_clks;
4514 api_ctrl->ipa_dec_client_disable_clks = ipa3_dec_client_disable_clks;
4515 api_ctrl->ipa_inc_client_enable_clks_no_block =
4516 ipa3_inc_client_enable_clks_no_block;
4517 api_ctrl->ipa_suspend_resource_no_block =
4518 ipa3_suspend_resource_no_block;
4519 api_ctrl->ipa_resume_resource = ipa3_resume_resource;
4520 api_ctrl->ipa_suspend_resource_sync = ipa3_suspend_resource_sync;
4521 api_ctrl->ipa_set_required_perf_profile =
4522 ipa3_set_required_perf_profile;
4523 api_ctrl->ipa_get_ipc_logbuf = ipa3_get_ipc_logbuf;
4524 api_ctrl->ipa_get_ipc_logbuf_low = ipa3_get_ipc_logbuf_low;
4525 api_ctrl->ipa_rx_poll = ipa3_rx_poll;
4526 api_ctrl->ipa_recycle_wan_skb = ipa3_recycle_wan_skb;
4527 api_ctrl->ipa_setup_uc_ntn_pipes = ipa3_setup_uc_ntn_pipes;
4528 api_ctrl->ipa_tear_down_uc_offload_pipes =
4529 ipa3_tear_down_uc_offload_pipes;
Amir Levyc4222c92016-11-07 16:14:54 +02004530 api_ctrl->ipa_get_pdev = ipa3_get_pdev;
Sunil Paidimarrifbbcd072017-04-04 17:43:50 -07004531 api_ctrl->ipa_ntn_uc_reg_rdyCB = ipa3_ntn_uc_reg_rdyCB;
4532 api_ctrl->ipa_ntn_uc_dereg_rdyCB = ipa3_ntn_uc_dereg_rdyCB;
Skylar Chang852379b2016-12-13 14:00:19 -08004533 api_ctrl->ipa_conn_wdi3_pipes = ipa3_conn_wdi3_pipes;
4534 api_ctrl->ipa_disconn_wdi3_pipes = ipa3_disconn_wdi3_pipes;
4535 api_ctrl->ipa_enable_wdi3_pipes = ipa3_enable_wdi3_pipes;
4536 api_ctrl->ipa_disable_wdi3_pipes = ipa3_disable_wdi3_pipes;
Skylar Chang48afa052017-10-25 09:32:57 -07004537 api_ctrl->ipa_tz_unlock_reg = ipa3_tz_unlock_reg;
Michael Adisumartad04e6d62017-11-09 17:46:35 -08004538 api_ctrl->ipa_get_smmu_params = ipa3_get_smmu_params;
Amir Levy2da9d452017-12-12 10:09:46 +02004539 api_ctrl->ipa_is_vlan_mode = ipa3_is_vlan_mode;
Amir Levy9659e592016-10-27 18:08:27 +03004540
4541 return 0;
4542}
4543
4544/**
4545 * ipa_is_modem_pipe()- Checks if pipe is owned by the modem
4546 *
4547 * @pipe_idx: pipe number
4548 * Return value: true if owned by modem, false otherwize
4549 */
4550bool ipa_is_modem_pipe(int pipe_idx)
4551{
4552 int client_idx;
4553
4554 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
4555 IPAERR("Bad pipe index!\n");
4556 return false;
4557 }
4558
4559 for (client_idx = 0; client_idx < IPA_CLIENT_MAX; client_idx++) {
4560 if (!IPA_CLIENT_IS_Q6_CONS(client_idx) &&
4561 !IPA_CLIENT_IS_Q6_PROD(client_idx))
4562 continue;
4563 if (ipa3_get_ep_mapping(client_idx) == pipe_idx)
4564 return true;
4565 }
4566
4567 return false;
4568}
4569
4570static void ipa3_write_rsrc_grp_type_reg(int group_index,
4571 enum ipa_rsrc_grp_type_src n, bool src,
4572 struct ipahal_reg_rsrc_grp_cfg *val) {
Amir Levy0f97a5c2016-11-22 11:13:37 +02004573 u8 hw_type_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004574
Amir Levy0f97a5c2016-11-22 11:13:37 +02004575 hw_type_idx = ipa3_get_hw_type_index();
4576
4577 switch (hw_type_idx) {
4578 case IPA_3_0:
4579 if (src) {
4580 switch (group_index) {
4581 case IPA_v3_0_GROUP_UL:
4582 case IPA_v3_0_GROUP_DL:
4583 ipahal_write_reg_n_fields(
4584 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4585 n, val);
4586 break;
4587 case IPA_v3_0_GROUP_DIAG:
4588 case IPA_v3_0_GROUP_DMA:
4589 ipahal_write_reg_n_fields(
4590 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4591 n, val);
4592 break;
4593 case IPA_v3_0_GROUP_Q6ZIP:
4594 case IPA_v3_0_GROUP_UC_RX_Q:
4595 ipahal_write_reg_n_fields(
4596 IPA_SRC_RSRC_GRP_45_RSRC_TYPE_n,
4597 n, val);
4598 break;
4599 default:
4600 IPAERR(
4601 " Invalid source resource group,index #%d\n",
4602 group_index);
4603 break;
4604 }
4605 } else {
4606 switch (group_index) {
4607 case IPA_v3_0_GROUP_UL:
4608 case IPA_v3_0_GROUP_DL:
4609 ipahal_write_reg_n_fields(
4610 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4611 n, val);
4612 break;
4613 case IPA_v3_0_GROUP_DIAG:
4614 case IPA_v3_0_GROUP_DMA:
4615 ipahal_write_reg_n_fields(
4616 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4617 n, val);
4618 break;
4619 case IPA_v3_0_GROUP_Q6ZIP_GENERAL:
4620 case IPA_v3_0_GROUP_Q6ZIP_ENGINE:
4621 ipahal_write_reg_n_fields(
4622 IPA_DST_RSRC_GRP_45_RSRC_TYPE_n,
4623 n, val);
4624 break;
4625 default:
4626 IPAERR(
4627 " Invalid destination resource group,index #%d\n",
4628 group_index);
4629 break;
4630 }
Amir Levy9659e592016-10-27 18:08:27 +03004631 }
Amir Levy0f97a5c2016-11-22 11:13:37 +02004632 break;
Amir Levy3a59dbd2017-03-15 14:30:54 +02004633 case IPA_3_5:
Amir Levy54fe4d32017-03-16 11:21:49 +02004634 case IPA_3_5_MHI:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004635 case IPA_3_5_1:
4636 if (src) {
4637 switch (group_index) {
Amir Levy3be373c2017-03-05 16:31:30 +02004638 case IPA_v3_5_GROUP_LWA_DL:
4639 case IPA_v3_5_GROUP_UL_DL:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004640 ipahal_write_reg_n_fields(
4641 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4642 n, val);
4643 break;
Amir Levy54fe4d32017-03-16 11:21:49 +02004644 case IPA_v3_5_MHI_GROUP_DMA:
Amir Levy3be373c2017-03-05 16:31:30 +02004645 case IPA_v3_5_GROUP_UC_RX_Q:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004646 ipahal_write_reg_n_fields(
4647 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4648 n, val);
4649 break;
4650 default:
4651 IPAERR(
4652 " Invalid source resource group,index #%d\n",
4653 group_index);
4654 break;
4655 }
4656 } else {
4657 switch (group_index) {
Amir Levy3be373c2017-03-05 16:31:30 +02004658 case IPA_v3_5_GROUP_LWA_DL:
4659 case IPA_v3_5_GROUP_UL_DL:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004660 ipahal_write_reg_n_fields(
4661 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4662 n, val);
4663 break;
Amir Levy54fe4d32017-03-16 11:21:49 +02004664 case IPA_v3_5_MHI_GROUP_DMA:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004665 ipahal_write_reg_n_fields(
4666 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4667 n, val);
4668 break;
4669 default:
4670 IPAERR(
4671 " Invalid destination resource group,index #%d\n",
4672 group_index);
4673 break;
4674 }
Amir Levy9659e592016-10-27 18:08:27 +03004675 }
Amir Levy0f97a5c2016-11-22 11:13:37 +02004676 break;
Michael Adisumarta539339d2017-05-16 14:18:23 -07004677 case IPA_4_0:
4678 case IPA_4_0_MHI:
4679 if (src) {
4680 switch (group_index) {
4681 case IPA_v4_0_GROUP_LWA_DL:
4682 case IPA_v4_0_GROUP_UL_DL:
4683 ipahal_write_reg_n_fields(
4684 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4685 n, val);
4686 break;
4687 case IPA_v4_0_MHI_GROUP_DMA:
4688 case IPA_v4_0_GROUP_UC_RX_Q:
4689 ipahal_write_reg_n_fields(
4690 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4691 n, val);
4692 break;
4693 default:
4694 IPAERR(
4695 " Invalid source resource group,index #%d\n",
4696 group_index);
4697 break;
4698 }
4699 } else {
4700 switch (group_index) {
4701 case IPA_v4_0_GROUP_LWA_DL:
4702 case IPA_v4_0_GROUP_UL_DL:
4703 ipahal_write_reg_n_fields(
4704 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4705 n, val);
4706 break;
4707 case IPA_v4_0_MHI_GROUP_DMA:
4708 ipahal_write_reg_n_fields(
4709 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4710 n, val);
4711 break;
4712 default:
4713 IPAERR(
4714 " Invalid destination resource group,index #%d\n",
4715 group_index);
4716 break;
4717 }
4718 }
4719 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004720 default:
4721 IPAERR("invalid hw type\n");
4722 WARN_ON(1);
4723 return;
Amir Levy9659e592016-10-27 18:08:27 +03004724 }
4725}
4726
4727static void ipa3_configure_rx_hps_clients(int depth, bool min)
4728{
4729 int i;
4730 struct ipahal_reg_rx_hps_clients val;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004731 u8 hw_type_idx;
4732
4733 hw_type_idx = ipa3_get_hw_type_index();
Amir Levy9659e592016-10-27 18:08:27 +03004734
4735 /*
4736 * depth 0 contains 4 first clients out of 6
4737 * depth 1 contains 2 last clients out of 6
4738 */
4739 for (i = 0 ; i < (depth ? 2 : 4) ; i++) {
4740 if (min)
4741 val.client_minmax[i] =
4742 ipa3_rsrc_rx_grp_config
Amir Levy0f97a5c2016-11-22 11:13:37 +02004743 [hw_type_idx]
Amir Levy9659e592016-10-27 18:08:27 +03004744 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
4745 [!depth ? i : 4 + i].min;
4746 else
4747 val.client_minmax[i] =
4748 ipa3_rsrc_rx_grp_config
Amir Levy0f97a5c2016-11-22 11:13:37 +02004749 [hw_type_idx]
Amir Levy9659e592016-10-27 18:08:27 +03004750 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
4751 [!depth ? i : 4 + i].max;
4752 }
4753 if (depth) {
4754 ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_1 :
4755 IPA_RX_HPS_CLIENTS_MAX_DEPTH_1,
4756 &val);
4757 } else {
4758 ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_0 :
4759 IPA_RX_HPS_CLIENTS_MAX_DEPTH_0,
4760 &val);
4761 }
4762}
4763
Michael Adisumarta539339d2017-05-16 14:18:23 -07004764static void ipa3_configure_rx_hps_weight(void)
4765{
4766 struct ipahal_reg_rx_hps_weights val;
4767 u8 hw_type_idx;
4768
4769 hw_type_idx = ipa3_get_hw_type_index();
4770
4771 val.hps_queue_weight_0 =
4772 ipa3_rsrc_rx_grp_hps_weight_config
4773 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4774 [0];
4775 val.hps_queue_weight_1 =
4776 ipa3_rsrc_rx_grp_hps_weight_config
4777 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4778 [1];
4779 val.hps_queue_weight_2 =
4780 ipa3_rsrc_rx_grp_hps_weight_config
4781 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4782 [2];
4783 val.hps_queue_weight_3 =
4784 ipa3_rsrc_rx_grp_hps_weight_config
4785 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4786 [3];
4787
4788 ipahal_write_reg_fields(IPA_HPS_FTCH_ARB_QUEUE_WEIGHT, &val);
4789}
4790
Amir Levy9659e592016-10-27 18:08:27 +03004791void ipa3_set_resorce_groups_min_max_limits(void)
4792{
4793 int i;
4794 int j;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004795 int src_rsrc_type_max;
4796 int dst_rsrc_type_max;
4797 int src_grp_idx_max;
4798 int dst_grp_idx_max;
Amir Levy9659e592016-10-27 18:08:27 +03004799 struct ipahal_reg_rsrc_grp_cfg val;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004800 u8 hw_type_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004801
4802 IPADBG("ENTER\n");
4803 IPADBG("Assign source rsrc groups min-max limits\n");
4804
Amir Levy0f97a5c2016-11-22 11:13:37 +02004805 hw_type_idx = ipa3_get_hw_type_index();
4806 switch (hw_type_idx) {
4807 case IPA_3_0:
4808 src_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX;
4809 dst_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_DST_MAX;
4810 src_grp_idx_max = IPA_v3_0_GROUP_MAX;
4811 dst_grp_idx_max = IPA_v3_0_GROUP_MAX;
4812 break;
Amir Levy3a59dbd2017-03-15 14:30:54 +02004813 case IPA_3_5:
Amir Levy54fe4d32017-03-16 11:21:49 +02004814 case IPA_3_5_MHI:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004815 case IPA_3_5_1:
Amir Levy3be373c2017-03-05 16:31:30 +02004816 src_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_SRC_MAX;
4817 dst_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_DST_MAX;
4818 src_grp_idx_max = IPA_v3_5_SRC_GROUP_MAX;
4819 dst_grp_idx_max = IPA_v3_5_DST_GROUP_MAX;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004820 break;
Michael Adisumarta539339d2017-05-16 14:18:23 -07004821 case IPA_4_0:
4822 case IPA_4_0_MHI:
4823 src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
4824 dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
4825 src_grp_idx_max = IPA_v4_0_SRC_GROUP_MAX;
4826 dst_grp_idx_max = IPA_v4_0_DST_GROUP_MAX;
4827 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004828 default:
4829 IPAERR("invalid hw type index\n");
4830 WARN_ON(1);
4831 return;
4832 }
4833
4834 for (i = 0; i < src_rsrc_type_max; i++) {
4835 for (j = 0; j < src_grp_idx_max; j = j + 2) {
4836 val.x_min =
4837 ipa3_rsrc_src_grp_config[hw_type_idx][i][j].min;
4838 val.x_max =
4839 ipa3_rsrc_src_grp_config[hw_type_idx][i][j].max;
4840 val.y_min =
4841 ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].min;
4842 val.y_max =
4843 ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].max;
Amir Levy9659e592016-10-27 18:08:27 +03004844 ipa3_write_rsrc_grp_type_reg(j, i, true, &val);
4845 }
4846 }
4847
4848 IPADBG("Assign destination rsrc groups min-max limits\n");
4849
Amir Levy0f97a5c2016-11-22 11:13:37 +02004850 for (i = 0; i < dst_rsrc_type_max; i++) {
4851 for (j = 0; j < dst_grp_idx_max; j = j + 2) {
4852 val.x_min =
4853 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].min;
4854 val.x_max =
4855 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].max;
4856 val.y_min =
4857 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].min;
4858 val.y_max =
4859 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].max;
Amir Levy9659e592016-10-27 18:08:27 +03004860 ipa3_write_rsrc_grp_type_reg(j, i, false, &val);
4861 }
4862 }
4863
4864 /* move resource group configuration from HLOS to TZ */
4865 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_1) {
4866 IPAERR("skip configuring ipa_rx_hps_clients from HLOS\n");
4867 return;
4868 }
4869
4870 IPADBG("Assign RX_HPS CMDQ rsrc groups min-max limits\n");
4871
4872 ipa3_configure_rx_hps_clients(0, true);
Amir Levy9659e592016-10-27 18:08:27 +03004873 ipa3_configure_rx_hps_clients(0, false);
Amir Levy0f97a5c2016-11-22 11:13:37 +02004874
4875 /* only hw_type v3_0\3_1 have 6 RX_HPS_CMDQ and needs depth 1*/
4876 if (ipa3_ctx->ipa_hw_type <= IPA_HW_v3_1) {
4877 ipa3_configure_rx_hps_clients(1, true);
4878 ipa3_configure_rx_hps_clients(1, false);
4879 }
Amir Levy9659e592016-10-27 18:08:27 +03004880
Michael Adisumarta539339d2017-05-16 14:18:23 -07004881 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5)
4882 ipa3_configure_rx_hps_weight();
4883
Amir Levy9659e592016-10-27 18:08:27 +03004884 IPADBG("EXIT\n");
4885}
4886
4887static void ipa3_gsi_poll_after_suspend(struct ipa3_ep_context *ep)
4888{
4889 bool empty;
4890
4891 IPADBG("switch ch %ld to poll\n", ep->gsi_chan_hdl);
4892 gsi_config_channel_mode(ep->gsi_chan_hdl, GSI_CHAN_MODE_POLL);
4893 gsi_is_channel_empty(ep->gsi_chan_hdl, &empty);
4894 if (!empty) {
4895 IPADBG("ch %ld not empty\n", ep->gsi_chan_hdl);
4896 /* queue a work to start polling if don't have one */
4897 atomic_set(&ipa3_ctx->transport_pm.eot_activity, 1);
Michael Adisumarta3e350812017-09-18 14:54:36 -07004898 if (!atomic_read(&ep->sys->curr_polling_state))
4899 __ipa_gsi_irq_rx_scedule_poll(ep->sys);
Amir Levy9659e592016-10-27 18:08:27 +03004900 }
4901}
4902
Michael Adisumarta181b7e52017-12-11 12:38:09 -08004903static int __ipa3_stop_gsi_channel(u32 clnt_hdl)
4904{
4905 struct ipa_mem_buffer mem;
4906 int res = 0;
4907 int i;
4908 struct ipa3_ep_context *ep;
4909
4910 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
4911 ipa3_ctx->ep[clnt_hdl].valid == 0) {
4912 IPAERR("bad parm.\n");
4913 return -EINVAL;
4914 }
4915
4916 ep = &ipa3_ctx->ep[clnt_hdl];
4917 memset(&mem, 0, sizeof(mem));
4918
4919 if (IPA_CLIENT_IS_PROD(ep->client)) {
4920 IPADBG("Calling gsi_stop_channel ch:%lu\n",
4921 ep->gsi_chan_hdl);
4922 res = gsi_stop_channel(ep->gsi_chan_hdl);
4923 IPADBG("gsi_stop_channel ch: %lu returned %d\n",
4924 ep->gsi_chan_hdl, res);
4925 return res;
4926 }
4927
4928 for (i = 0; i < IPA_GSI_CHANNEL_STOP_MAX_RETRY; i++) {
4929 IPADBG("Calling gsi_stop_channel ch:%lu\n",
4930 ep->gsi_chan_hdl);
4931 res = gsi_stop_channel(ep->gsi_chan_hdl);
4932 IPADBG("gsi_stop_channel ch: %lu returned %d\n",
4933 ep->gsi_chan_hdl, res);
4934 if (res != -GSI_STATUS_AGAIN && res != -GSI_STATUS_TIMED_OUT)
4935 return res;
4936
4937 IPADBG("Inject a DMA_TASK with 1B packet to IPA\n");
4938 /* Send a 1B packet DMA_TASK to IPA and try again */
4939 res = ipa3_inject_dma_task_for_gsi();
4940 if (res) {
4941 IPAERR("Failed to inject DMA TASk for GSI\n");
4942 return res;
4943 }
4944
4945 /* sleep for short period to flush IPA */
4946 usleep_range(IPA_GSI_CHANNEL_STOP_SLEEP_MIN_USEC,
4947 IPA_GSI_CHANNEL_STOP_SLEEP_MAX_USEC);
4948 }
4949
4950 IPAERR("Failed to stop GSI channel with retries\n");
4951 return -EFAULT;
4952}
4953
4954/**
4955 * ipa3_stop_gsi_channel()- Stops a GSI channel in IPA
4956 * @chan_hdl: GSI channel handle
4957 *
4958 * This function implements the sequence to stop a GSI channel
4959 * in IPA. This function returns when the channel is in STOP state.
4960 *
4961 * Return value: 0 on success, negative otherwise
4962 */
4963int ipa3_stop_gsi_channel(u32 clnt_hdl)
4964{
4965 int res;
4966
4967 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
4968 res = __ipa3_stop_gsi_channel(clnt_hdl);
4969 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
4970
4971 return res;
4972}
4973
Amir Levy9659e592016-10-27 18:08:27 +03004974void ipa3_suspend_apps_pipes(bool suspend)
4975{
4976 struct ipa_ep_cfg_ctrl cfg;
4977 int ipa_ep_idx;
4978 struct ipa3_ep_context *ep;
Skylar Changa699afd2017-06-06 10:06:21 -07004979 int res;
Amir Levy9659e592016-10-27 18:08:27 +03004980
4981 memset(&cfg, 0, sizeof(cfg));
4982 cfg.ipa_ep_suspend = suspend;
4983
4984 ipa_ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
Ghanim Fodi79ee8d82017-02-27 16:39:25 +02004985 if (ipa_ep_idx < 0) {
4986 IPAERR("IPA client mapping failed\n");
4987 ipa_assert();
4988 return;
4989 }
Amir Levy9659e592016-10-27 18:08:27 +03004990 ep = &ipa3_ctx->ep[ipa_ep_idx];
4991 if (ep->valid) {
4992 IPADBG("%s pipe %d\n", suspend ? "suspend" : "unsuspend",
4993 ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07004994 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
4995 if (suspend) {
Michael Adisumarta181b7e52017-12-11 12:38:09 -08004996 res = __ipa3_stop_gsi_channel(ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07004997 if (res) {
4998 IPAERR("failed to stop LAN channel\n");
4999 ipa_assert();
5000 }
5001 } else {
5002 res = gsi_start_channel(ep->gsi_chan_hdl);
5003 if (res) {
5004 IPAERR("failed to start LAN channel\n");
5005 ipa_assert();
5006 }
5007 }
5008 } else {
5009 ipa3_cfg_ep_ctrl(ipa_ep_idx, &cfg);
5010 }
Amir Levy9659e592016-10-27 18:08:27 +03005011 if (suspend)
5012 ipa3_gsi_poll_after_suspend(ep);
5013 else if (!atomic_read(&ep->sys->curr_polling_state))
5014 gsi_config_channel_mode(ep->gsi_chan_hdl,
5015 GSI_CHAN_MODE_CALLBACK);
5016 }
5017
5018 ipa_ep_idx = ipa_get_ep_mapping(IPA_CLIENT_APPS_WAN_CONS);
5019 /* Considering the case for SSR. */
5020 if (ipa_ep_idx == -1) {
5021 IPADBG("Invalid client.\n");
5022 return;
5023 }
5024 ep = &ipa3_ctx->ep[ipa_ep_idx];
5025 if (ep->valid) {
5026 IPADBG("%s pipe %d\n", suspend ? "suspend" : "unsuspend",
5027 ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07005028 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
5029 if (suspend) {
Michael Adisumarta181b7e52017-12-11 12:38:09 -08005030 res = __ipa3_stop_gsi_channel(ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07005031 if (res) {
5032 IPAERR("failed to stop WAN channel\n");
5033 ipa_assert();
5034 }
5035 } else {
5036 res = gsi_start_channel(ep->gsi_chan_hdl);
5037 if (res) {
5038 IPAERR("failed to start WAN channel\n");
5039 ipa_assert();
5040 }
5041 }
5042 } else {
5043 ipa3_cfg_ep_ctrl(ipa_ep_idx, &cfg);
5044 }
Amir Levy9659e592016-10-27 18:08:27 +03005045 if (suspend)
5046 ipa3_gsi_poll_after_suspend(ep);
5047 else if (!atomic_read(&ep->sys->curr_polling_state))
5048 gsi_config_channel_mode(ep->gsi_chan_hdl,
5049 GSI_CHAN_MODE_CALLBACK);
5050 }
5051}
5052
Skylar Chang6c4bec92017-04-21 16:10:14 -07005053int ipa3_allocate_dma_task_for_gsi(void)
5054{
5055 struct ipahal_imm_cmd_dma_task_32b_addr cmd = { 0 };
5056
5057 IPADBG("Allocate mem\n");
5058 ipa3_ctx->dma_task_info.mem.size = IPA_GSI_CHANNEL_STOP_PKT_SIZE;
5059 ipa3_ctx->dma_task_info.mem.base = dma_alloc_coherent(ipa3_ctx->pdev,
5060 ipa3_ctx->dma_task_info.mem.size,
5061 &ipa3_ctx->dma_task_info.mem.phys_base,
5062 GFP_KERNEL);
5063 if (!ipa3_ctx->dma_task_info.mem.base) {
5064 IPAERR("no mem\n");
5065 return -EFAULT;
5066 }
5067
5068 cmd.flsh = 1;
5069 cmd.size1 = ipa3_ctx->dma_task_info.mem.size;
5070 cmd.addr1 = ipa3_ctx->dma_task_info.mem.phys_base;
5071 cmd.packet_size = ipa3_ctx->dma_task_info.mem.size;
5072 ipa3_ctx->dma_task_info.cmd_pyld = ipahal_construct_imm_cmd(
5073 IPA_IMM_CMD_DMA_TASK_32B_ADDR, &cmd, false);
5074 if (!ipa3_ctx->dma_task_info.cmd_pyld) {
5075 IPAERR("failed to construct dma_task_32b_addr cmd\n");
5076 dma_free_coherent(ipa3_ctx->pdev,
5077 ipa3_ctx->dma_task_info.mem.size,
5078 ipa3_ctx->dma_task_info.mem.base,
5079 ipa3_ctx->dma_task_info.mem.phys_base);
5080 memset(&ipa3_ctx->dma_task_info, 0,
5081 sizeof(ipa3_ctx->dma_task_info));
5082 return -EFAULT;
5083 }
5084
5085 return 0;
5086}
5087
5088void ipa3_free_dma_task_for_gsi(void)
5089{
5090 dma_free_coherent(ipa3_ctx->pdev,
5091 ipa3_ctx->dma_task_info.mem.size,
5092 ipa3_ctx->dma_task_info.mem.base,
5093 ipa3_ctx->dma_task_info.mem.phys_base);
5094 ipahal_destroy_imm_cmd(ipa3_ctx->dma_task_info.cmd_pyld);
5095 memset(&ipa3_ctx->dma_task_info, 0, sizeof(ipa3_ctx->dma_task_info));
5096}
5097
Amir Levy9659e592016-10-27 18:08:27 +03005098/**
5099 * ipa3_inject_dma_task_for_gsi()- Send DMA_TASK to IPA for GSI stop channel
5100 *
5101 * Send a DMA_TASK of 1B to IPA to unblock GSI channel in STOP_IN_PROG.
5102 * Return value: 0 on success, negative otherwise
5103 */
5104int ipa3_inject_dma_task_for_gsi(void)
5105{
Amir Levy479cfdd2017-10-26 12:23:14 +03005106 struct ipa3_desc desc;
Amir Levy9659e592016-10-27 18:08:27 +03005107
Amir Levy479cfdd2017-10-26 12:23:14 +03005108 ipa3_init_imm_cmd_desc(&desc, ipa3_ctx->dma_task_info.cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03005109
5110 IPADBG("sending 1B packet to IPA\n");
Gidon Studinski3021a6f2016-11-10 12:48:48 +02005111 if (ipa3_send_cmd_timeout(1, &desc,
5112 IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC)) {
Amir Levy9659e592016-10-27 18:08:27 +03005113 IPAERR("ipa3_send_cmd failed\n");
5114 return -EFAULT;
5115 }
5116
5117 return 0;
5118}
5119
Ghanim Fodi37b64952017-01-24 15:42:30 +02005120static int ipa3_load_single_fw(const struct firmware *firmware,
5121 const struct elf32_phdr *phdr)
5122{
5123 uint32_t *fw_mem_base;
5124 int index;
5125 const uint32_t *elf_data_ptr;
5126
5127 if (phdr->p_offset > firmware->size) {
5128 IPAERR("Invalid ELF: offset=%u is beyond elf_size=%zu\n",
5129 phdr->p_offset, firmware->size);
5130 return -EINVAL;
5131 }
5132 if ((firmware->size - phdr->p_offset) < phdr->p_filesz) {
5133 IPAERR("Invalid ELF: offset=%u filesz=%u elf_size=%zu\n",
5134 phdr->p_offset, phdr->p_filesz, firmware->size);
5135 return -EINVAL;
5136 }
5137
5138 if (phdr->p_memsz % sizeof(uint32_t)) {
5139 IPAERR("FW mem size %u doesn't align to 32bit\n",
5140 phdr->p_memsz);
5141 return -EFAULT;
5142 }
5143
5144 if (phdr->p_filesz > phdr->p_memsz) {
5145 IPAERR("FW image too big src_size=%u dst_size=%u\n",
5146 phdr->p_filesz, phdr->p_memsz);
5147 return -EFAULT;
5148 }
5149
5150 fw_mem_base = ioremap(phdr->p_vaddr, phdr->p_memsz);
5151 if (!fw_mem_base) {
5152 IPAERR("Failed to map 0x%x for the size of %u\n",
5153 phdr->p_vaddr, phdr->p_memsz);
5154 return -ENOMEM;
5155 }
5156
5157 /* Set the entire region to 0s */
5158 memset(fw_mem_base, 0, phdr->p_memsz);
5159
5160 elf_data_ptr = (uint32_t *)(firmware->data + phdr->p_offset);
5161
5162 /* Write the FW */
5163 for (index = 0; index < phdr->p_filesz/sizeof(uint32_t); index++) {
5164 writel_relaxed(*elf_data_ptr, &fw_mem_base[index]);
5165 elf_data_ptr++;
5166 }
5167
5168 iounmap(fw_mem_base);
5169
5170 return 0;
5171}
5172
Amir Levy9659e592016-10-27 18:08:27 +03005173/**
5174 * ipa3_load_fws() - Load the IPAv3 FWs into IPA&GSI SRAM.
5175 *
5176 * @firmware: Structure which contains the FW data from the user space.
Ghanim Fodi37b64952017-01-24 15:42:30 +02005177 * @gsi_mem_base: GSI base address
Amir Levy9659e592016-10-27 18:08:27 +03005178 *
5179 * Return value: 0 on success, negative otherwise
5180 *
5181 */
Ghanim Fodi37b64952017-01-24 15:42:30 +02005182int ipa3_load_fws(const struct firmware *firmware, phys_addr_t gsi_mem_base)
Amir Levy9659e592016-10-27 18:08:27 +03005183{
5184 const struct elf32_hdr *ehdr;
5185 const struct elf32_phdr *phdr;
Ghanim Fodi37b64952017-01-24 15:42:30 +02005186 unsigned long gsi_iram_ofst;
5187 unsigned long gsi_iram_size;
5188 phys_addr_t ipa_reg_mem_base;
5189 u32 ipa_reg_ofst;
5190 int rc;
5191
5192 if (!gsi_mem_base) {
5193 IPAERR("Invalid GSI base address\n");
5194 return -EINVAL;
5195 }
5196
5197 ipa_assert_on(!firmware);
5198 /* One program header per FW image: GSI, DPS and HPS */
5199 if (firmware->size < (sizeof(*ehdr) + 3 * sizeof(*phdr))) {
5200 IPAERR("Missing ELF and Program headers firmware size=%zu\n",
5201 firmware->size);
5202 return -EINVAL;
5203 }
Amir Levy9659e592016-10-27 18:08:27 +03005204
5205 ehdr = (struct elf32_hdr *) firmware->data;
Ghanim Fodi37b64952017-01-24 15:42:30 +02005206 ipa_assert_on(!ehdr);
5207 if (ehdr->e_phnum != 3) {
5208 IPAERR("Unexpected number of ELF program headers\n");
5209 return -EINVAL;
Amir Levy9659e592016-10-27 18:08:27 +03005210 }
Ghanim Fodi37b64952017-01-24 15:42:30 +02005211 phdr = (struct elf32_phdr *)(firmware->data + sizeof(*ehdr));
5212
5213 /*
5214 * Each ELF program header represents a FW image and contains:
5215 * p_vaddr : The starting address to which the FW needs to loaded.
5216 * p_memsz : The size of the IRAM (where the image loaded)
5217 * p_filesz: The size of the FW image embedded inside the ELF
5218 * p_offset: Absolute offset to the image from the head of the ELF
5219 */
5220
5221 /* Load GSI FW image */
5222 gsi_get_inst_ram_offset_and_size(&gsi_iram_ofst, &gsi_iram_size);
5223 if (phdr->p_vaddr != (gsi_mem_base + gsi_iram_ofst)) {
5224 IPAERR(
5225 "Invalid GSI FW img load addr vaddr=0x%x gsi_mem_base=%pa gsi_iram_ofst=0x%lx\n"
5226 , phdr->p_vaddr, &gsi_mem_base, gsi_iram_ofst);
5227 return -EINVAL;
5228 }
5229 if (phdr->p_memsz > gsi_iram_size) {
5230 IPAERR("Invalid GSI FW img size memsz=%d gsi_iram_size=%lu\n",
5231 phdr->p_memsz, gsi_iram_size);
5232 return -EINVAL;
5233 }
5234 rc = ipa3_load_single_fw(firmware, phdr);
5235 if (rc)
5236 return rc;
5237
5238 phdr++;
5239 ipa_reg_mem_base = ipa3_ctx->ipa_wrapper_base + ipahal_get_reg_base();
5240
5241 /* Load IPA DPS FW image */
5242 ipa_reg_ofst = ipahal_get_reg_ofst(IPA_DPS_SEQUENCER_FIRST);
5243 if (phdr->p_vaddr != (ipa_reg_mem_base + ipa_reg_ofst)) {
5244 IPAERR(
5245 "Invalid IPA DPS img load addr vaddr=0x%x ipa_reg_mem_base=%pa ipa_reg_ofst=%u\n"
5246 , phdr->p_vaddr, &ipa_reg_mem_base, ipa_reg_ofst);
5247 return -EINVAL;
5248 }
5249 if (phdr->p_memsz > ipahal_get_dps_img_mem_size()) {
5250 IPAERR("Invalid IPA DPS img size memsz=%d dps_mem_size=%u\n",
5251 phdr->p_memsz, ipahal_get_dps_img_mem_size());
5252 return -EINVAL;
5253 }
5254 rc = ipa3_load_single_fw(firmware, phdr);
5255 if (rc)
5256 return rc;
5257
5258 phdr++;
5259
5260 /* Load IPA HPS FW image */
5261 ipa_reg_ofst = ipahal_get_reg_ofst(IPA_HPS_SEQUENCER_FIRST);
5262 if (phdr->p_vaddr != (ipa_reg_mem_base + ipa_reg_ofst)) {
5263 IPAERR(
5264 "Invalid IPA HPS img load addr vaddr=0x%x ipa_reg_mem_base=%pa ipa_reg_ofst=%u\n"
5265 , phdr->p_vaddr, &ipa_reg_mem_base, ipa_reg_ofst);
5266 return -EINVAL;
5267 }
5268 if (phdr->p_memsz > ipahal_get_hps_img_mem_size()) {
5269 IPAERR("Invalid IPA HPS img size memsz=%d dps_mem_size=%u\n",
5270 phdr->p_memsz, ipahal_get_hps_img_mem_size());
5271 return -EINVAL;
5272 }
5273 rc = ipa3_load_single_fw(firmware, phdr);
5274 if (rc)
5275 return rc;
5276
5277 IPADBG("IPA FWs (GSI FW, DPS and HPS) loaded successfully\n");
Amir Levy9659e592016-10-27 18:08:27 +03005278 return 0;
5279}
5280
5281/**
5282 * ipa3_is_msm_device() - Is the running device a MSM or MDM?
5283 * Determine according to IPA version
5284 *
5285 * Return value: true if MSM, false if MDM
5286 *
5287 */
5288bool ipa3_is_msm_device(void)
5289{
5290 switch (ipa3_ctx->ipa_hw_type) {
5291 case IPA_HW_v3_0:
5292 case IPA_HW_v3_5:
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07005293 case IPA_HW_v4_0:
Amir Levy9659e592016-10-27 18:08:27 +03005294 return false;
5295 case IPA_HW_v3_1:
5296 case IPA_HW_v3_5_1:
5297 return true;
5298 default:
5299 IPAERR("unknown HW type %d\n", ipa3_ctx->ipa_hw_type);
5300 ipa_assert();
5301 }
5302
5303 return false;
5304}
Amir Levyc4222c92016-11-07 16:14:54 +02005305
5306/**
Amir Levy3afd94a2017-01-05 10:19:13 +02005307* ipa3_disable_prefetch() - disable\enable tx prefetch
5308*
5309* @client: the client which is related to the TX where prefetch will be
5310* disabled
5311*
5312* Return value: Non applicable
5313*
5314*/
5315void ipa3_disable_prefetch(enum ipa_client_type client)
5316{
5317 struct ipahal_reg_tx_cfg cfg;
5318 u8 qmb;
5319
5320 qmb = ipa3_get_qmb_master_sel(client);
5321
5322 IPADBG("disabling prefetch for qmb %d\n", (int)qmb);
5323
5324 ipahal_read_reg_fields(IPA_TX_CFG, &cfg);
5325 /* QMB0 (DDR) correlates with TX0, QMB1(PCIE) correlates with TX1 */
5326 if (qmb == QMB_MASTER_SELECT_DDR)
5327 cfg.tx0_prefetch_disable = true;
5328 else
5329 cfg.tx1_prefetch_disable = true;
5330 ipahal_write_reg_fields(IPA_TX_CFG, &cfg);
5331}
5332
5333/**
Amir Levyc4222c92016-11-07 16:14:54 +02005334 * ipa3_get_pdev() - return a pointer to IPA dev struct
5335 *
5336 * Return value: a pointer to IPA dev struct
5337 *
5338 */
5339struct device *ipa3_get_pdev(void)
5340{
5341 if (!ipa3_ctx)
5342 return NULL;
5343
5344 return ipa3_ctx->pdev;
5345}
Amir Levy12ef0912016-08-30 09:27:34 +03005346
5347/**
5348 * ipa3_enable_dcd() - enable dynamic clock division on IPA
5349 *
5350 * Return value: Non applicable
5351 *
5352 */
5353void ipa3_enable_dcd(void)
5354{
5355 struct ipahal_reg_idle_indication_cfg idle_indication_cfg;
5356
5357 /* recommended values for IPA 3.5 according to IPA HPG */
5358 idle_indication_cfg.const_non_idle_enable = 0;
5359 idle_indication_cfg.enter_idle_debounce_thresh = 256;
5360
5361 ipahal_write_reg_fields(IPA_IDLE_INDICATION_CFG,
5362 &idle_indication_cfg);
5363}
Amir Levy479cfdd2017-10-26 12:23:14 +03005364
5365void ipa3_init_imm_cmd_desc(struct ipa3_desc *desc,
5366 struct ipahal_imm_cmd_pyld *cmd_pyld)
5367{
5368 memset(desc, 0, sizeof(*desc));
5369 desc->opcode = cmd_pyld->opcode;
5370 desc->pyld = cmd_pyld->data;
5371 desc->len = cmd_pyld->len;
5372 desc->type = IPA_IMM_CMD_DESC;
5373}
5374