blob: 7421eb8186f668aebe4fc2c8614fcceb28c275c9 [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;
Amir Levy9659e592016-10-27 18:08:27 +03001586 break;
1587 case IPA_RM_RESOURCE_MHI_CONS:
1588 clients->names[i++] = IPA_CLIENT_MHI_CONS;
1589 break;
Skylar Chang79699ec2016-11-18 10:21:33 -08001590 case IPA_RM_RESOURCE_ODU_ADAPT_CONS:
1591 clients->names[i++] = IPA_CLIENT_ODU_EMB_CONS;
1592 clients->names[i++] = IPA_CLIENT_ODU_TETH_CONS;
1593 break;
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001594 case IPA_RM_RESOURCE_ETHERNET_CONS:
1595 clients->names[i++] = IPA_CLIENT_ETHERNET_CONS;
1596 break;
Amir Levy9659e592016-10-27 18:08:27 +03001597 case IPA_RM_RESOURCE_USB_PROD:
1598 clients->names[i++] = IPA_CLIENT_USB_PROD;
1599 break;
1600 case IPA_RM_RESOURCE_HSIC_PROD:
1601 clients->names[i++] = IPA_CLIENT_HSIC1_PROD;
1602 break;
1603 case IPA_RM_RESOURCE_MHI_PROD:
1604 clients->names[i++] = IPA_CLIENT_MHI_PROD;
1605 break;
Skylar Chang79699ec2016-11-18 10:21:33 -08001606 case IPA_RM_RESOURCE_ODU_ADAPT_PROD:
1607 clients->names[i++] = IPA_CLIENT_ODU_PROD;
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001608 break;
1609 case IPA_RM_RESOURCE_ETHERNET_PROD:
1610 clients->names[i++] = IPA_CLIENT_ETHERNET_PROD;
1611 break;
Amir Levy9659e592016-10-27 18:08:27 +03001612 default:
1613 break;
1614 }
1615 clients->length = i;
1616
1617 return 0;
1618}
1619
1620/**
1621 * ipa3_should_pipe_be_suspended() - returns true when the client's pipe should
1622 * be suspended during a power save scenario. False otherwise.
1623 *
1624 * @client: [IN] IPA client
1625 */
1626bool ipa3_should_pipe_be_suspended(enum ipa_client_type client)
1627{
1628 struct ipa3_ep_context *ep;
1629 int ipa_ep_idx;
1630
1631 ipa_ep_idx = ipa3_get_ep_mapping(client);
1632 if (ipa_ep_idx == -1) {
1633 IPAERR("Invalid client.\n");
1634 WARN_ON(1);
1635 return false;
1636 }
1637
1638 ep = &ipa3_ctx->ep[ipa_ep_idx];
1639
Skylar Changa699afd2017-06-06 10:06:21 -07001640 /*
1641 * starting IPA 4.0 pipe no longer can be suspended. Instead,
1642 * the corresponding GSI channel should be stopped. Usually client
1643 * driver will take care of stopping the channel. For client drivers
1644 * that are not stopping the channel, IPA RM will do that based on
1645 * ipa3_should_pipe_channel_be_stopped().
1646 */
1647 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
1648 return false;
1649
Amir Levy9659e592016-10-27 18:08:27 +03001650 if (ep->keep_ipa_awake)
1651 return false;
1652
1653 if (client == IPA_CLIENT_USB_CONS ||
1654 client == IPA_CLIENT_USB_DPL_CONS ||
1655 client == IPA_CLIENT_MHI_CONS ||
1656 client == IPA_CLIENT_HSIC1_CONS ||
1657 client == IPA_CLIENT_WLAN1_CONS ||
1658 client == IPA_CLIENT_WLAN2_CONS ||
1659 client == IPA_CLIENT_WLAN3_CONS ||
Skylar Chang79699ec2016-11-18 10:21:33 -08001660 client == IPA_CLIENT_WLAN4_CONS ||
1661 client == IPA_CLIENT_ODU_EMB_CONS ||
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08001662 client == IPA_CLIENT_ODU_TETH_CONS ||
1663 client == IPA_CLIENT_ETHERNET_CONS)
Amir Levy9659e592016-10-27 18:08:27 +03001664 return true;
1665
1666 return false;
1667}
1668
1669/**
Skylar Changa699afd2017-06-06 10:06:21 -07001670 * ipa3_should_pipe_channel_be_stopped() - returns true when the client's
1671 * channel should be stopped during a power save scenario. False otherwise.
1672 * Most client already stops the GSI channel on suspend, and are not included
1673 * in the list below.
1674 *
1675 * @client: [IN] IPA client
1676 */
1677static bool ipa3_should_pipe_channel_be_stopped(enum ipa_client_type client)
1678{
1679 struct ipa3_ep_context *ep;
1680 int ipa_ep_idx;
1681
1682 if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
1683 return false;
1684
1685 ipa_ep_idx = ipa3_get_ep_mapping(client);
1686 if (ipa_ep_idx == -1) {
1687 IPAERR("Invalid client.\n");
1688 WARN_ON(1);
1689 return false;
1690 }
1691
1692 ep = &ipa3_ctx->ep[ipa_ep_idx];
1693
1694 if (ep->keep_ipa_awake)
1695 return false;
1696
1697 if (client == IPA_CLIENT_ODU_EMB_CONS ||
1698 client == IPA_CLIENT_ODU_TETH_CONS)
1699 return true;
1700
1701 return false;
1702}
1703
1704/**
Amir Levy9659e592016-10-27 18:08:27 +03001705 * ipa3_suspend_resource_sync() - suspend client endpoints related to the IPA_RM
1706 * resource and decrement active clients counter, which may result in clock
1707 * gating of IPA clocks.
1708 *
1709 * @resource: [IN] IPA Resource Manager resource
1710 *
1711 * Return codes: 0 on success, negative on failure.
1712 */
1713int ipa3_suspend_resource_sync(enum ipa_rm_resource_name resource)
1714{
1715 struct ipa3_client_names clients;
1716 int res;
1717 int index;
1718 struct ipa_ep_cfg_ctrl suspend;
1719 enum ipa_client_type client;
1720 int ipa_ep_idx;
1721 bool pipe_suspended = false;
1722
1723 memset(&clients, 0, sizeof(clients));
1724 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1725 if (res) {
1726 IPAERR("Bad params.\n");
1727 return res;
1728 }
1729
1730 for (index = 0; index < clients.length; index++) {
1731 client = clients.names[index];
1732 ipa_ep_idx = ipa3_get_ep_mapping(client);
1733 if (ipa_ep_idx == -1) {
1734 IPAERR("Invalid client.\n");
1735 res = -EINVAL;
1736 continue;
1737 }
1738 ipa3_ctx->resume_on_connect[client] = false;
1739 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1740 ipa3_should_pipe_be_suspended(client)) {
1741 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1742 /* suspend endpoint */
1743 memset(&suspend, 0, sizeof(suspend));
1744 suspend.ipa_ep_suspend = true;
1745 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1746 pipe_suspended = true;
1747 }
1748 }
Skylar Changa699afd2017-06-06 10:06:21 -07001749
1750 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1751 ipa3_should_pipe_channel_be_stopped(client)) {
1752 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1753 /* Stop GSI channel */
1754 res = ipa3_stop_gsi_channel(ipa_ep_idx);
1755 if (res) {
1756 IPAERR("failed stop gsi ch %lu\n",
1757 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1758 return res;
1759 }
1760 }
1761 }
Amir Levy9659e592016-10-27 18:08:27 +03001762 }
1763 /* Sleep ~1 msec */
1764 if (pipe_suspended)
1765 usleep_range(1000, 2000);
1766
1767 /* before gating IPA clocks do TAG process */
1768 ipa3_ctx->tag_process_before_gating = true;
1769 IPA_ACTIVE_CLIENTS_DEC_RESOURCE(ipa_rm_resource_str(resource));
1770
1771 return 0;
1772}
1773
1774/**
1775 * ipa3_suspend_resource_no_block() - suspend client endpoints related to the
1776 * IPA_RM resource and decrement active clients counter. This function is
1777 * guaranteed to avoid sleeping.
1778 *
1779 * @resource: [IN] IPA Resource Manager resource
1780 *
1781 * Return codes: 0 on success, negative on failure.
1782 */
1783int ipa3_suspend_resource_no_block(enum ipa_rm_resource_name resource)
1784{
1785 int res;
1786 struct ipa3_client_names clients;
1787 int index;
1788 enum ipa_client_type client;
1789 struct ipa_ep_cfg_ctrl suspend;
1790 int ipa_ep_idx;
Amir Levy9659e592016-10-27 18:08:27 +03001791 struct ipa_active_client_logging_info log_info;
1792
Amir Levy9659e592016-10-27 18:08:27 +03001793 memset(&clients, 0, sizeof(clients));
1794 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1795 if (res) {
1796 IPAERR(
1797 "ipa3_get_clients_from_rm_resource() failed, name = %d.\n",
1798 resource);
1799 goto bail;
1800 }
1801
1802 for (index = 0; index < clients.length; index++) {
1803 client = clients.names[index];
1804 ipa_ep_idx = ipa3_get_ep_mapping(client);
1805 if (ipa_ep_idx == -1) {
1806 IPAERR("Invalid client.\n");
1807 res = -EINVAL;
1808 continue;
1809 }
1810 ipa3_ctx->resume_on_connect[client] = false;
1811 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1812 ipa3_should_pipe_be_suspended(client)) {
1813 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1814 /* suspend endpoint */
1815 memset(&suspend, 0, sizeof(suspend));
1816 suspend.ipa_ep_suspend = true;
1817 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1818 }
1819 }
Skylar Changa699afd2017-06-06 10:06:21 -07001820
1821 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1822 ipa3_should_pipe_channel_be_stopped(client)) {
1823 res = -EPERM;
1824 goto bail;
1825 }
Amir Levy9659e592016-10-27 18:08:27 +03001826 }
1827
1828 if (res == 0) {
1829 IPA_ACTIVE_CLIENTS_PREP_RESOURCE(log_info,
1830 ipa_rm_resource_str(resource));
Skylar Chang242952b2017-07-20 15:04:05 -07001831 /* before gating IPA clocks do TAG process */
1832 ipa3_ctx->tag_process_before_gating = true;
1833 ipa3_dec_client_disable_clks_no_block(&log_info);
Amir Levy9659e592016-10-27 18:08:27 +03001834 }
1835bail:
Amir Levy9659e592016-10-27 18:08:27 +03001836 return res;
1837}
1838
1839/**
1840 * ipa3_resume_resource() - resume client endpoints related to the IPA_RM
1841 * resource.
1842 *
1843 * @resource: [IN] IPA Resource Manager resource
1844 *
1845 * Return codes: 0 on success, negative on failure.
1846 */
1847int ipa3_resume_resource(enum ipa_rm_resource_name resource)
1848{
1849
1850 struct ipa3_client_names clients;
1851 int res;
1852 int index;
1853 struct ipa_ep_cfg_ctrl suspend;
1854 enum ipa_client_type client;
1855 int ipa_ep_idx;
1856
1857 memset(&clients, 0, sizeof(clients));
1858 res = ipa3_get_clients_from_rm_resource(resource, &clients);
1859 if (res) {
1860 IPAERR("ipa3_get_clients_from_rm_resource() failed.\n");
1861 return res;
1862 }
1863
1864 for (index = 0; index < clients.length; index++) {
1865 client = clients.names[index];
1866 ipa_ep_idx = ipa3_get_ep_mapping(client);
1867 if (ipa_ep_idx == -1) {
1868 IPAERR("Invalid client.\n");
1869 res = -EINVAL;
1870 continue;
1871 }
1872 /*
1873 * The related ep, will be resumed on connect
1874 * while its resource is granted
1875 */
1876 ipa3_ctx->resume_on_connect[client] = true;
1877 IPADBG("%d will be resumed on connect.\n", client);
1878 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1879 ipa3_should_pipe_be_suspended(client)) {
1880 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1881 memset(&suspend, 0, sizeof(suspend));
1882 suspend.ipa_ep_suspend = false;
1883 ipa3_cfg_ep_ctrl(ipa_ep_idx, &suspend);
1884 }
1885 }
Skylar Changa699afd2017-06-06 10:06:21 -07001886
1887 if (ipa3_ctx->ep[ipa_ep_idx].client == client &&
1888 ipa3_should_pipe_channel_be_stopped(client)) {
1889 if (ipa3_ctx->ep[ipa_ep_idx].valid) {
1890 res = gsi_start_channel(
1891 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1892 if (res) {
1893 IPAERR("failed to start gsi ch %lu\n",
1894 ipa3_ctx->ep[ipa_ep_idx].gsi_chan_hdl);
1895 return res;
1896 }
1897 }
1898 }
Amir Levy9659e592016-10-27 18:08:27 +03001899 }
1900
1901 return res;
1902}
1903
1904/**
1905 * _ipa_sram_settings_read_v3_0() - Read SRAM settings from HW
1906 *
1907 * Returns: None
1908 */
1909void _ipa_sram_settings_read_v3_0(void)
1910{
1911 struct ipahal_reg_shared_mem_size smem_sz;
1912
1913 memset(&smem_sz, 0, sizeof(smem_sz));
1914
1915 ipahal_read_reg_fields(IPA_SHARED_MEM_SIZE, &smem_sz);
1916
1917 ipa3_ctx->smem_restricted_bytes = smem_sz.shared_mem_baddr;
1918 ipa3_ctx->smem_sz = smem_sz.shared_mem_sz;
1919
1920 /* reg fields are in 8B units */
1921 ipa3_ctx->smem_restricted_bytes *= 8;
1922 ipa3_ctx->smem_sz *= 8;
1923 ipa3_ctx->smem_reqd_sz = IPA_MEM_PART(end_ofst);
1924 ipa3_ctx->hdr_tbl_lcl = 0;
1925 ipa3_ctx->hdr_proc_ctx_tbl_lcl = 1;
1926
1927 /*
1928 * when proc ctx table is located in internal memory,
1929 * modem entries resides first.
1930 */
1931 if (ipa3_ctx->hdr_proc_ctx_tbl_lcl) {
1932 ipa3_ctx->hdr_proc_ctx_tbl.start_offset =
1933 IPA_MEM_PART(modem_hdr_proc_ctx_size);
1934 }
1935 ipa3_ctx->ip4_rt_tbl_hash_lcl = 0;
1936 ipa3_ctx->ip4_rt_tbl_nhash_lcl = 0;
1937 ipa3_ctx->ip6_rt_tbl_hash_lcl = 0;
1938 ipa3_ctx->ip6_rt_tbl_nhash_lcl = 0;
1939 ipa3_ctx->ip4_flt_tbl_hash_lcl = 0;
1940 ipa3_ctx->ip4_flt_tbl_nhash_lcl = 0;
1941 ipa3_ctx->ip6_flt_tbl_hash_lcl = 0;
1942 ipa3_ctx->ip6_flt_tbl_nhash_lcl = 0;
1943}
1944
1945/**
1946 * ipa3_cfg_route() - configure IPA route
1947 * @route: IPA route
1948 *
1949 * Return codes:
1950 * 0: success
1951 */
1952int ipa3_cfg_route(struct ipahal_reg_route *route)
1953{
1954
1955 IPADBG("disable_route_block=%d, default_pipe=%d, default_hdr_tbl=%d\n",
1956 route->route_dis,
1957 route->route_def_pipe,
1958 route->route_def_hdr_table);
1959 IPADBG("default_hdr_ofst=%d, default_frag_pipe=%d\n",
1960 route->route_def_hdr_ofst,
1961 route->route_frag_def_pipe);
1962
1963 IPADBG("default_retain_hdr=%d\n",
1964 route->route_def_retain_hdr);
1965
1966 if (route->route_dis) {
1967 IPAERR("Route disable is not supported!\n");
1968 return -EPERM;
1969 }
1970
1971 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
1972
1973 ipahal_write_reg_fields(IPA_ROUTE, route);
1974
1975 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
1976
1977 return 0;
1978}
1979
1980/**
1981 * ipa3_cfg_filter() - configure filter
1982 * @disable: disable value
1983 *
1984 * Return codes:
1985 * 0: success
1986 */
1987int ipa3_cfg_filter(u32 disable)
1988{
Utkarsh Saxenae9782812017-05-26 17:20:32 +05301989 IPAERR_RL("Filter disable is not supported!\n");
Amir Levy9659e592016-10-27 18:08:27 +03001990 return -EPERM;
1991}
1992
1993/**
1994 * ipa3_cfg_qsb() - Configure IPA QSB maximal reads and writes
1995 *
1996 * Returns: None
1997 */
1998void ipa3_cfg_qsb(void)
1999{
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002000 struct ipahal_reg_qsb_max_reads max_reads = { 0 };
2001 struct ipahal_reg_qsb_max_writes max_writes = { 0 };
2002
2003 max_reads.qmb_0_max_reads = 8,
2004 max_reads.qmb_1_max_reads = 8,
2005
2006 max_writes.qmb_0_max_writes = 8;
2007 max_writes.qmb_1_max_writes = 2;
Amir Levy9659e592016-10-27 18:08:27 +03002008
Amir Levy54fe4d32017-03-16 11:21:49 +02002009 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5) {
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002010 max_writes.qmb_1_max_writes = 4;
2011 max_reads.qmb_1_max_reads = 12;
Amir Levy54fe4d32017-03-16 11:21:49 +02002012 }
2013
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002014 ipahal_write_reg_fields(IPA_QSB_MAX_WRITES, &max_writes);
2015 ipahal_write_reg_fields(IPA_QSB_MAX_READS, &max_reads);
Amir Levy9659e592016-10-27 18:08:27 +03002016}
2017
2018/**
2019 * ipa3_init_hw() - initialize HW
2020 *
2021 * Return codes:
2022 * 0: success
2023 */
2024int ipa3_init_hw(void)
2025{
2026 u32 ipa_version = 0;
2027 u32 val;
2028
2029 /* Read IPA version and make sure we have access to the registers */
2030 ipa_version = ipahal_read_reg(IPA_VERSION);
2031 if (ipa_version == 0)
2032 return -EFAULT;
2033
2034 switch (ipa3_ctx->ipa_hw_type) {
2035 case IPA_HW_v3_0:
2036 case IPA_HW_v3_1:
2037 val = IPA_BCR_REG_VAL_v3_0;
2038 break;
2039 case IPA_HW_v3_5:
2040 case IPA_HW_v3_5_1:
2041 val = IPA_BCR_REG_VAL_v3_5;
2042 break;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002043 case IPA_HW_v4_0:
2044 val = IPA_BCR_REG_VAL_v4_0;
2045 break;
Amir Levy9659e592016-10-27 18:08:27 +03002046 default:
2047 IPAERR("unknown HW type in dts\n");
2048 return -EFAULT;
2049 }
2050
2051 ipahal_write_reg(IPA_BCR, val);
2052
Skylar Changf0772872017-07-06 16:11:01 -07002053 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
2054 struct ipahal_reg_tx_cfg cfg;
2055
Michael Adisumartad68ab112017-06-14 11:40:06 -07002056 ipahal_write_reg(IPA_CLKON_CFG, IPA_CLKON_CFG_v4_0);
Skylar Changf0772872017-07-06 16:11:01 -07002057 ipahal_read_reg_fields(IPA_TX_CFG, &cfg);
2058 /* disable PA_MASK_EN to allow holb drop */
2059 cfg.pa_mask_en = 0;
2060 ipahal_write_reg_fields(IPA_TX_CFG, &cfg);
2061 }
Michael Adisumartad68ab112017-06-14 11:40:06 -07002062
Amir Levy9659e592016-10-27 18:08:27 +03002063 ipa3_cfg_qsb();
2064
2065 return 0;
2066}
2067
2068/**
2069 * ipa3_get_hw_type_index() - Get HW type index which is used as the entry index
Amir Levy0f97a5c2016-11-22 11:13:37 +02002070 * for ep\resource groups related arrays .
Amir Levy9659e592016-10-27 18:08:27 +03002071 *
2072 * Return value: HW type index
2073 */
2074u8 ipa3_get_hw_type_index(void)
2075{
2076 u8 hw_type_index;
2077
2078 switch (ipa3_ctx->ipa_hw_type) {
2079 case IPA_HW_v3_0:
2080 case IPA_HW_v3_1:
2081 hw_type_index = IPA_3_0;
2082 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02002083 case IPA_HW_v3_5:
2084 hw_type_index = IPA_3_5;
Amir Levy54fe4d32017-03-16 11:21:49 +02002085 /*
2086 *this flag is initialized only after fw load trigger from
2087 * user space (ipa3_write)
2088 */
2089 if (ipa3_ctx->ipa_config_is_mhi)
2090 hw_type_index = IPA_3_5_MHI;
Amir Levy0f97a5c2016-11-22 11:13:37 +02002091 break;
2092 case IPA_HW_v3_5_1:
2093 hw_type_index = IPA_3_5_1;
2094 break;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002095 case IPA_HW_v4_0:
2096 hw_type_index = IPA_4_0;
Michael Adisumarta539339d2017-05-16 14:18:23 -07002097 /*
2098 *this flag is initialized only after fw load trigger from
2099 * user space (ipa3_write)
2100 */
2101 if (ipa3_ctx->ipa_config_is_mhi)
2102 hw_type_index = IPA_4_0_MHI;
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07002103 break;
Amir Levy9659e592016-10-27 18:08:27 +03002104 default:
2105 IPAERR("Incorrect IPA version %d\n", ipa3_ctx->ipa_hw_type);
2106 hw_type_index = IPA_3_0;
2107 break;
2108 }
2109
2110 return hw_type_index;
2111}
2112
2113/**
2114 * ipa3_get_ep_mapping() - provide endpoint mapping
2115 * @client: client type
2116 *
2117 * Return value: endpoint mapping
2118 */
2119int ipa3_get_ep_mapping(enum ipa_client_type client)
2120{
Skylar Chang652ee8e2017-02-10 11:40:30 -08002121 int ipa_ep_idx;
2122
Amir Levy9659e592016-10-27 18:08:27 +03002123 if (client >= IPA_CLIENT_MAX || client < 0) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05302124 IPAERR_RL("Bad client number! client =%d\n", client);
Ghanim Fodi79ee8d82017-02-27 16:39:25 +02002125 return IPA_EP_NOT_ALLOCATED;
Amir Levy9659e592016-10-27 18:08:27 +03002126 }
2127
Skylar Changa9516582017-05-09 11:36:47 -07002128 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2129 return IPA_EP_NOT_ALLOCATED;
2130
2131 ipa_ep_idx = ipa3_ep_mapping[ipa3_get_hw_type_index()][client].
2132 ipa_gsi_ep_info.ipa_ep_num;
Skylar Chang7fa22712017-04-03 18:29:21 -07002133 if (ipa_ep_idx < 0 || (ipa_ep_idx >= IPA3_MAX_NUM_PIPES
2134 && client != IPA_CLIENT_DUMMY_CONS))
Skylar Chang652ee8e2017-02-10 11:40:30 -08002135 return IPA_EP_NOT_ALLOCATED;
2136
2137 return ipa_ep_idx;
Amir Levy9659e592016-10-27 18:08:27 +03002138}
2139
2140/**
2141 * ipa3_get_gsi_ep_info() - provide gsi ep information
Amir Levy3be373c2017-03-05 16:31:30 +02002142 * @client: IPA client value
Amir Levy9659e592016-10-27 18:08:27 +03002143 *
2144 * Return value: pointer to ipa_gsi_ep_info
2145 */
Amir Levy3be373c2017-03-05 16:31:30 +02002146const struct ipa_gsi_ep_config *ipa3_get_gsi_ep_info
2147 (enum ipa_client_type client)
Amir Levy9659e592016-10-27 18:08:27 +03002148{
Skylar Changc1f15312017-05-09 14:14:32 -07002149 int ep_idx;
2150
2151 ep_idx = ipa3_get_ep_mapping(client);
2152 if (ep_idx == IPA_EP_NOT_ALLOCATED)
Amir Levy3be373c2017-03-05 16:31:30 +02002153 return NULL;
Amir Levy9659e592016-10-27 18:08:27 +03002154
Skylar Changa9516582017-05-09 11:36:47 -07002155 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2156 return NULL;
2157
Amir Levy3be373c2017-03-05 16:31:30 +02002158 return &(ipa3_ep_mapping[ipa3_get_hw_type_index()]
2159 [client].ipa_gsi_ep_info);
Amir Levy9659e592016-10-27 18:08:27 +03002160}
2161
2162/**
2163 * ipa_get_ep_group() - provide endpoint group by client
2164 * @client: client type
2165 *
2166 * Return value: endpoint group
2167 */
2168int ipa_get_ep_group(enum ipa_client_type client)
2169{
2170 if (client >= IPA_CLIENT_MAX || client < 0) {
2171 IPAERR("Bad client number! client =%d\n", client);
2172 return -EINVAL;
2173 }
2174
Skylar Changa9516582017-05-09 11:36:47 -07002175 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2176 return -EINVAL;
2177
Amir Levy9659e592016-10-27 18:08:27 +03002178 return ipa3_ep_mapping[ipa3_get_hw_type_index()][client].group_num;
2179}
2180
2181/**
2182 * ipa3_get_qmb_master_sel() - provide QMB master selection for the client
2183 * @client: client type
2184 *
2185 * Return value: QMB master index
2186 */
2187u8 ipa3_get_qmb_master_sel(enum ipa_client_type client)
2188{
2189 if (client >= IPA_CLIENT_MAX || client < 0) {
2190 IPAERR("Bad client number! client =%d\n", client);
2191 return -EINVAL;
2192 }
2193
Skylar Changa9516582017-05-09 11:36:47 -07002194 if (!ipa3_ep_mapping[ipa3_get_hw_type_index()][client].valid)
2195 return -EINVAL;
2196
Amir Levy9659e592016-10-27 18:08:27 +03002197 return ipa3_ep_mapping[ipa3_get_hw_type_index()]
2198 [client].qmb_master_sel;
2199}
2200
2201/* ipa3_set_client() - provide client mapping
2202 * @client: client type
2203 *
2204 * Return value: none
2205 */
2206
2207void ipa3_set_client(int index, enum ipacm_client_enum client, bool uplink)
2208{
Skylar Chang09e0e252017-03-20 14:51:29 -07002209 if (client > IPACM_CLIENT_MAX || client < IPACM_CLIENT_USB) {
Amir Levy9659e592016-10-27 18:08:27 +03002210 IPAERR("Bad client number! client =%d\n", client);
2211 } else if (index >= IPA3_MAX_NUM_PIPES || index < 0) {
2212 IPAERR("Bad pipe index! index =%d\n", index);
2213 } else {
2214 ipa3_ctx->ipacm_client[index].client_enum = client;
2215 ipa3_ctx->ipacm_client[index].uplink = uplink;
2216 }
2217}
2218
Skylar Chang6b41f8d2016-11-01 12:50:11 -07002219/* ipa3_get_wlan_stats() - get ipa wifi stats
2220 *
2221 * Return value: success or failure
2222 */
2223int ipa3_get_wlan_stats(struct ipa_get_wdi_sap_stats *wdi_sap_stats)
2224{
2225 if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
2226 ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_GET_WDI_SAP_STATS,
2227 wdi_sap_stats);
2228 } else {
2229 IPAERR("uc_wdi_ctx.stats_notify NULL\n");
2230 return -EFAULT;
2231 }
2232 return 0;
2233}
2234
2235int ipa3_set_wlan_quota(struct ipa_set_wifi_quota *wdi_quota)
2236{
2237 if (ipa3_ctx->uc_wdi_ctx.stats_notify) {
2238 ipa3_ctx->uc_wdi_ctx.stats_notify(IPA_SET_WIFI_QUOTA,
2239 wdi_quota);
2240 } else {
2241 IPAERR("uc_wdi_ctx.stats_notify NULL\n");
2242 return -EFAULT;
2243 }
2244 return 0;
2245}
2246
Amir Levy9659e592016-10-27 18:08:27 +03002247/**
2248 * ipa3_get_client() - provide client mapping
2249 * @client: client type
2250 *
Skylar Chang6b41f8d2016-11-01 12:50:11 -07002251 * Return value: client mapping enum
Amir Levy9659e592016-10-27 18:08:27 +03002252 */
2253enum ipacm_client_enum ipa3_get_client(int pipe_idx)
2254{
2255 if (pipe_idx >= IPA3_MAX_NUM_PIPES || pipe_idx < 0) {
2256 IPAERR("Bad pipe index! pipe_idx =%d\n", pipe_idx);
2257 return IPACM_CLIENT_MAX;
2258 } else {
2259 return ipa3_ctx->ipacm_client[pipe_idx].client_enum;
2260 }
2261}
2262
2263/**
2264 * ipa2_get_client_uplink() - provide client mapping
2265 * @client: client type
2266 *
2267 * Return value: none
2268 */
2269bool ipa3_get_client_uplink(int pipe_idx)
2270{
Skylar Chang53f855e2017-06-12 10:50:12 -07002271 if (pipe_idx < 0 || pipe_idx >= IPA3_MAX_NUM_PIPES) {
2272 IPAERR("invalid pipe idx %d\n", pipe_idx);
2273 return false;
2274 }
2275
Amir Levy9659e592016-10-27 18:08:27 +03002276 return ipa3_ctx->ipacm_client[pipe_idx].uplink;
2277}
2278
2279/**
2280 * ipa3_get_rm_resource_from_ep() - get the IPA_RM resource which is related to
2281 * the supplied pipe index.
2282 *
2283 * @pipe_idx:
2284 *
2285 * Return value: IPA_RM resource related to the pipe, -1 if a resource was not
2286 * found.
2287 */
2288enum ipa_rm_resource_name ipa3_get_rm_resource_from_ep(int pipe_idx)
2289{
2290 int i;
2291 int j;
2292 enum ipa_client_type client;
2293 struct ipa3_client_names clients;
2294 bool found = false;
2295
2296 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2297 IPAERR("Bad pipe index!\n");
2298 return -EINVAL;
2299 }
2300
2301 client = ipa3_ctx->ep[pipe_idx].client;
2302
2303 for (i = 0; i < IPA_RM_RESOURCE_MAX; i++) {
2304 memset(&clients, 0, sizeof(clients));
2305 ipa3_get_clients_from_rm_resource(i, &clients);
2306 for (j = 0; j < clients.length; j++) {
2307 if (clients.names[j] == client) {
2308 found = true;
2309 break;
2310 }
2311 }
2312 if (found)
2313 break;
2314 }
2315
2316 if (!found)
2317 return -EFAULT;
2318
2319 return i;
2320}
2321
2322/**
2323 * ipa3_get_client_mapping() - provide client mapping
2324 * @pipe_idx: IPA end-point number
2325 *
2326 * Return value: client mapping
2327 */
2328enum ipa_client_type ipa3_get_client_mapping(int pipe_idx)
2329{
2330 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2331 IPAERR("Bad pipe index!\n");
2332 return -EINVAL;
2333 }
2334
2335 return ipa3_ctx->ep[pipe_idx].client;
2336}
2337
2338/**
2339 * ipa_init_ep_flt_bitmap() - Initialize the bitmap
2340 * that represents the End-points that supports filtering
2341 */
2342void ipa_init_ep_flt_bitmap(void)
2343{
2344 enum ipa_client_type cl;
2345 u8 hw_type_idx = ipa3_get_hw_type_index();
2346 u32 bitmap;
Skylar Changa9516582017-05-09 11:36:47 -07002347 u32 pipe_num;
Amir Levy9659e592016-10-27 18:08:27 +03002348
2349 bitmap = 0;
2350
2351 BUG_ON(ipa3_ctx->ep_flt_bitmap);
2352
2353 for (cl = 0; cl < IPA_CLIENT_MAX ; cl++) {
2354 if (ipa3_ep_mapping[hw_type_idx][cl].support_flt) {
Skylar Changa9516582017-05-09 11:36:47 -07002355 pipe_num = ipa3_ep_mapping[hw_type_idx][cl].
2356 ipa_gsi_ep_info.ipa_ep_num;
2357 bitmap |= (1U << pipe_num);
Amir Levy9659e592016-10-27 18:08:27 +03002358 if (bitmap != ipa3_ctx->ep_flt_bitmap) {
2359 ipa3_ctx->ep_flt_bitmap = bitmap;
2360 ipa3_ctx->ep_flt_num++;
2361 }
2362 }
2363 }
2364}
2365
2366/**
2367 * ipa_is_ep_support_flt() - Given an End-point check
2368 * whether it supports filtering or not.
2369 *
2370 * @pipe_idx:
2371 *
2372 * Return values:
2373 * true if supports and false if not
2374 */
2375bool ipa_is_ep_support_flt(int pipe_idx)
2376{
2377 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
2378 IPAERR("Bad pipe index!\n");
2379 return false;
2380 }
2381
2382 return ipa3_ctx->ep_flt_bitmap & (1U<<pipe_idx);
2383}
2384
2385/**
2386 * ipa3_cfg_ep_seq() - IPA end-point HPS/DPS sequencer type configuration
2387 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2388 *
2389 * Returns: 0 on success, negative on failure
2390 *
2391 * Note: Should not be called from atomic context
2392 */
2393int ipa3_cfg_ep_seq(u32 clnt_hdl, const struct ipa_ep_cfg_seq *seq_cfg)
2394{
2395 int type;
2396
2397 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2398 ipa3_ctx->ep[clnt_hdl].valid == 0) {
2399 IPAERR("bad param, clnt_hdl = %d", clnt_hdl);
2400 return -EINVAL;
2401 }
2402
2403 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2404 IPAERR("SEQ does not apply to IPA consumer EP %d\n", clnt_hdl);
2405 return -EINVAL;
2406 }
2407
2408 /*
2409 * Skip Configure sequencers type for test clients.
2410 * These are configured dynamically in ipa3_cfg_ep_mode
2411 */
2412 if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
2413 IPADBG("Skip sequencers configuration for test clients\n");
2414 return 0;
2415 }
2416
2417 if (seq_cfg->set_dynamic)
2418 type = seq_cfg->seq_type;
2419 else
2420 type = ipa3_ep_mapping[ipa3_get_hw_type_index()]
2421 [ipa3_ctx->ep[clnt_hdl].client].sequencer_type;
2422
2423 if (type != IPA_DPS_HPS_SEQ_TYPE_INVALID) {
2424 if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA &&
2425 !IPA_DPS_HPS_SEQ_TYPE_IS_DMA(type)) {
2426 IPAERR("Configuring non-DMA SEQ type to DMA pipe\n");
2427 BUG();
2428 }
2429 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2430 /* Configure sequencers type*/
2431
2432 IPADBG("set sequencers to sequence 0x%x, ep = %d\n", type,
2433 clnt_hdl);
2434 ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
2435
2436 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2437 } else {
2438 IPADBG("should not set sequencer type of ep = %d\n", clnt_hdl);
2439 }
2440
2441 return 0;
2442}
2443
2444/**
2445 * ipa3_cfg_ep - IPA end-point configuration
2446 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2447 * @ipa_ep_cfg: [in] IPA end-point configuration params
2448 *
Amir Levydc65f4c2017-07-06 09:49:50 +03002449 * This includes nat, IPv6CT, header, mode, aggregation and route settings and
2450 * is a one shot API to configure the IPA end-point fully
Amir Levy9659e592016-10-27 18:08:27 +03002451 *
2452 * Returns: 0 on success, negative on failure
2453 *
2454 * Note: Should not be called from atomic context
2455 */
2456int ipa3_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg)
2457{
2458 int result = -EINVAL;
2459
2460 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2461 ipa3_ctx->ep[clnt_hdl].valid == 0 || ipa_ep_cfg == NULL) {
2462 IPAERR("bad parm.\n");
2463 return -EINVAL;
2464 }
2465
2466 result = ipa3_cfg_ep_hdr(clnt_hdl, &ipa_ep_cfg->hdr);
2467 if (result)
2468 return result;
2469
2470 result = ipa3_cfg_ep_hdr_ext(clnt_hdl, &ipa_ep_cfg->hdr_ext);
2471 if (result)
2472 return result;
2473
2474 result = ipa3_cfg_ep_aggr(clnt_hdl, &ipa_ep_cfg->aggr);
2475 if (result)
2476 return result;
2477
2478 result = ipa3_cfg_ep_cfg(clnt_hdl, &ipa_ep_cfg->cfg);
2479 if (result)
2480 return result;
2481
2482 if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
2483 result = ipa3_cfg_ep_nat(clnt_hdl, &ipa_ep_cfg->nat);
2484 if (result)
2485 return result;
2486
Amir Levydc65f4c2017-07-06 09:49:50 +03002487 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
2488 result = ipa3_cfg_ep_conn_track(clnt_hdl,
2489 &ipa_ep_cfg->conn_track);
2490 if (result)
2491 return result;
2492 }
2493
Amir Levy9659e592016-10-27 18:08:27 +03002494 result = ipa3_cfg_ep_mode(clnt_hdl, &ipa_ep_cfg->mode);
2495 if (result)
2496 return result;
2497
2498 result = ipa3_cfg_ep_seq(clnt_hdl, &ipa_ep_cfg->seq);
2499 if (result)
2500 return result;
2501
2502 result = ipa3_cfg_ep_route(clnt_hdl, &ipa_ep_cfg->route);
2503 if (result)
2504 return result;
2505
2506 result = ipa3_cfg_ep_deaggr(clnt_hdl, &ipa_ep_cfg->deaggr);
2507 if (result)
2508 return result;
2509 } else {
2510 result = ipa3_cfg_ep_metadata_mask(clnt_hdl,
2511 &ipa_ep_cfg->metadata_mask);
2512 if (result)
2513 return result;
2514 }
2515
2516 return 0;
2517}
2518
Amir Levydc65f4c2017-07-06 09:49:50 +03002519static const char *ipa3_get_nat_en_str(enum ipa_nat_en_type nat_en)
Amir Levy9659e592016-10-27 18:08:27 +03002520{
2521 switch (nat_en) {
2522 case (IPA_BYPASS_NAT):
2523 return "NAT disabled";
2524 case (IPA_SRC_NAT):
2525 return "Source NAT";
2526 case (IPA_DST_NAT):
2527 return "Dst NAT";
2528 }
2529
2530 return "undefined";
2531}
2532
Amir Levydc65f4c2017-07-06 09:49:50 +03002533static const char *ipa3_get_ipv6ct_en_str(enum ipa_ipv6ct_en_type ipv6ct_en)
2534{
2535 switch (ipv6ct_en) {
2536 case (IPA_BYPASS_IPV6CT):
2537 return "ipv6ct disabled";
2538 case (IPA_ENABLE_IPV6CT):
2539 return "ipv6ct enabled";
2540 }
2541
2542 return "undefined";
2543}
2544
Amir Levy9659e592016-10-27 18:08:27 +03002545/**
2546 * ipa3_cfg_ep_nat() - IPA end-point NAT configuration
2547 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
Amir Levydc65f4c2017-07-06 09:49:50 +03002548 * @ep_nat: [in] IPA NAT end-point configuration params
Amir Levy9659e592016-10-27 18:08:27 +03002549 *
2550 * Returns: 0 on success, negative on failure
2551 *
2552 * Note: Should not be called from atomic context
2553 */
2554int ipa3_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ep_nat)
2555{
2556 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2557 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_nat == NULL) {
2558 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2559 clnt_hdl,
2560 ipa3_ctx->ep[clnt_hdl].valid);
2561 return -EINVAL;
2562 }
2563
2564 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2565 IPAERR("NAT does not apply to IPA out EP %d\n", clnt_hdl);
2566 return -EINVAL;
2567 }
2568
2569 IPADBG("pipe=%d, nat_en=%d(%s)\n",
2570 clnt_hdl,
2571 ep_nat->nat_en,
2572 ipa3_get_nat_en_str(ep_nat->nat_en));
2573
2574 /* copy over EP cfg */
2575 ipa3_ctx->ep[clnt_hdl].cfg.nat = *ep_nat;
2576
2577 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2578
2579 ipahal_write_reg_n_fields(IPA_ENDP_INIT_NAT_n, clnt_hdl, ep_nat);
2580
2581 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2582
2583 return 0;
2584}
2585
Amir Levydc65f4c2017-07-06 09:49:50 +03002586/**
2587 * ipa3_cfg_ep_conn_track() - IPA end-point IPv6CT configuration
2588 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2589 * @ep_conn_track: [in] IPA IPv6CT end-point configuration params
2590 *
2591 * Returns: 0 on success, negative on failure
2592 *
2593 * Note: Should not be called from atomic context
2594 */
2595int ipa3_cfg_ep_conn_track(u32 clnt_hdl,
2596 const struct ipa_ep_cfg_conn_track *ep_conn_track)
2597{
2598 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2599 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_conn_track == NULL) {
2600 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2601 clnt_hdl,
2602 ipa3_ctx->ep[clnt_hdl].valid);
2603 return -EINVAL;
2604 }
2605
2606 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2607 IPAERR("IPv6CT does not apply to IPA out EP %d\n", clnt_hdl);
2608 return -EINVAL;
2609 }
2610
2611 IPADBG("pipe=%d, conn_track_en=%d(%s)\n",
2612 clnt_hdl,
2613 ep_conn_track->conn_track_en,
2614 ipa3_get_ipv6ct_en_str(ep_conn_track->conn_track_en));
2615
2616 /* copy over EP cfg */
2617 ipa3_ctx->ep[clnt_hdl].cfg.conn_track = *ep_conn_track;
2618
2619 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2620
2621 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CONN_TRACK_n, clnt_hdl,
2622 ep_conn_track);
2623
2624 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2625
2626 return 0;
2627}
2628
Amir Levy9659e592016-10-27 18:08:27 +03002629
2630/**
2631 * ipa3_cfg_ep_status() - IPA end-point status configuration
2632 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2633 * @ipa_ep_cfg: [in] IPA end-point configuration params
2634 *
2635 * Returns: 0 on success, negative on failure
2636 *
2637 * Note: Should not be called from atomic context
2638 */
2639int ipa3_cfg_ep_status(u32 clnt_hdl,
2640 const struct ipahal_reg_ep_cfg_status *ep_status)
2641{
2642 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2643 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_status == NULL) {
2644 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2645 clnt_hdl,
2646 ipa3_ctx->ep[clnt_hdl].valid);
2647 return -EINVAL;
2648 }
2649
2650 IPADBG("pipe=%d, status_en=%d status_ep=%d status_location=%d\n",
2651 clnt_hdl,
2652 ep_status->status_en,
2653 ep_status->status_ep,
2654 ep_status->status_location);
2655
2656 /* copy over EP cfg */
2657 ipa3_ctx->ep[clnt_hdl].status = *ep_status;
2658
2659 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2660
2661 ipahal_write_reg_n_fields(IPA_ENDP_STATUS_n, clnt_hdl, ep_status);
2662
2663 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2664
2665 return 0;
2666}
2667
2668/**
2669 * ipa3_cfg_ep_cfg() - IPA end-point cfg configuration
2670 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2671 * @ipa_ep_cfg: [in] IPA end-point configuration params
2672 *
2673 * Returns: 0 on success, negative on failure
2674 *
2675 * Note: Should not be called from atomic context
2676 */
2677int ipa3_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *cfg)
2678{
2679 u8 qmb_master_sel;
2680
2681 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2682 ipa3_ctx->ep[clnt_hdl].valid == 0 || cfg == NULL) {
2683 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2684 clnt_hdl,
2685 ipa3_ctx->ep[clnt_hdl].valid);
2686 return -EINVAL;
2687 }
2688
2689 /* copy over EP cfg */
2690 ipa3_ctx->ep[clnt_hdl].cfg.cfg = *cfg;
2691
2692 /* Override QMB master selection */
2693 qmb_master_sel = ipa3_get_qmb_master_sel(ipa3_ctx->ep[clnt_hdl].client);
2694 ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel = qmb_master_sel;
2695 IPADBG(
2696 "pipe=%d, frag_ofld_en=%d cs_ofld_en=%d mdata_hdr_ofst=%d gen_qmb_master_sel=%d\n",
2697 clnt_hdl,
2698 ipa3_ctx->ep[clnt_hdl].cfg.cfg.frag_offload_en,
2699 ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_offload_en,
2700 ipa3_ctx->ep[clnt_hdl].cfg.cfg.cs_metadata_hdr_offset,
2701 ipa3_ctx->ep[clnt_hdl].cfg.cfg.gen_qmb_master_sel);
2702
2703 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2704
2705 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CFG_n, clnt_hdl,
2706 &ipa3_ctx->ep[clnt_hdl].cfg.cfg);
2707
2708 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2709
2710 return 0;
2711}
2712
2713/**
2714 * ipa3_cfg_ep_metadata_mask() - IPA end-point meta-data mask configuration
2715 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2716 * @ipa_ep_cfg: [in] IPA end-point configuration params
2717 *
2718 * Returns: 0 on success, negative on failure
2719 *
2720 * Note: Should not be called from atomic context
2721 */
2722int ipa3_cfg_ep_metadata_mask(u32 clnt_hdl,
2723 const struct ipa_ep_cfg_metadata_mask
2724 *metadata_mask)
2725{
2726 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2727 ipa3_ctx->ep[clnt_hdl].valid == 0 || metadata_mask == NULL) {
2728 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2729 clnt_hdl,
2730 ipa3_ctx->ep[clnt_hdl].valid);
2731 return -EINVAL;
2732 }
2733
2734 IPADBG("pipe=%d, metadata_mask=0x%x\n",
2735 clnt_hdl,
2736 metadata_mask->metadata_mask);
2737
2738 /* copy over EP cfg */
2739 ipa3_ctx->ep[clnt_hdl].cfg.metadata_mask = *metadata_mask;
2740
2741 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2742
2743 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_MASK_n,
2744 clnt_hdl, metadata_mask);
2745
2746 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2747
2748 return 0;
2749}
2750
2751/**
2752 * ipa3_cfg_ep_hdr() - IPA end-point header configuration
2753 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2754 * @ipa_ep_cfg: [in] IPA end-point configuration params
2755 *
2756 * Returns: 0 on success, negative on failure
2757 *
2758 * Note: Should not be called from atomic context
2759 */
2760int ipa3_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ep_hdr)
2761{
2762 struct ipa3_ep_context *ep;
2763
2764 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2765 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr == NULL) {
2766 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2767 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
2768 return -EINVAL;
2769 }
2770 IPADBG("pipe=%d metadata_reg_valid=%d\n",
2771 clnt_hdl,
2772 ep_hdr->hdr_metadata_reg_valid);
2773
2774 IPADBG("remove_additional=%d, a5_mux=%d, ofst_pkt_size=0x%x\n",
2775 ep_hdr->hdr_remove_additional,
2776 ep_hdr->hdr_a5_mux,
2777 ep_hdr->hdr_ofst_pkt_size);
2778
2779 IPADBG("ofst_pkt_size_valid=%d, additional_const_len=0x%x\n",
2780 ep_hdr->hdr_ofst_pkt_size_valid,
2781 ep_hdr->hdr_additional_const_len);
2782
Amir Levy479cfdd2017-10-26 12:23:14 +03002783 IPADBG("ofst_metadata=0x%x, ofst_metadata_valid=%d, len=0x%x\n",
Amir Levy9659e592016-10-27 18:08:27 +03002784 ep_hdr->hdr_ofst_metadata,
2785 ep_hdr->hdr_ofst_metadata_valid,
2786 ep_hdr->hdr_len);
2787
2788 ep = &ipa3_ctx->ep[clnt_hdl];
2789
2790 /* copy over EP cfg */
2791 ep->cfg.hdr = *ep_hdr;
2792
2793 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2794
2795 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl, &ep->cfg.hdr);
2796
2797 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2798
2799 return 0;
2800}
2801
2802/**
2803 * ipa3_cfg_ep_hdr_ext() - IPA end-point extended header configuration
2804 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2805 * @ep_hdr_ext: [in] IPA end-point configuration params
2806 *
2807 * Returns: 0 on success, negative on failure
2808 *
2809 * Note: Should not be called from atomic context
2810 */
2811int ipa3_cfg_ep_hdr_ext(u32 clnt_hdl,
2812 const struct ipa_ep_cfg_hdr_ext *ep_hdr_ext)
2813{
2814 struct ipa3_ep_context *ep;
2815
2816 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2817 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_hdr_ext == NULL) {
2818 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
2819 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
2820 return -EINVAL;
2821 }
2822
2823 IPADBG("pipe=%d hdr_pad_to_alignment=%d\n",
2824 clnt_hdl,
2825 ep_hdr_ext->hdr_pad_to_alignment);
2826
2827 IPADBG("hdr_total_len_or_pad_offset=%d\n",
2828 ep_hdr_ext->hdr_total_len_or_pad_offset);
2829
2830 IPADBG("hdr_payload_len_inc_padding=%d hdr_total_len_or_pad=%d\n",
2831 ep_hdr_ext->hdr_payload_len_inc_padding,
2832 ep_hdr_ext->hdr_total_len_or_pad);
2833
2834 IPADBG("hdr_total_len_or_pad_valid=%d hdr_little_endian=%d\n",
2835 ep_hdr_ext->hdr_total_len_or_pad_valid,
2836 ep_hdr_ext->hdr_little_endian);
2837
2838 ep = &ipa3_ctx->ep[clnt_hdl];
2839
2840 /* copy over EP cfg */
2841 ep->cfg.hdr_ext = *ep_hdr_ext;
2842
2843 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2844
2845 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_EXT_n, clnt_hdl,
2846 &ep->cfg.hdr_ext);
2847
2848 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2849
2850 return 0;
2851}
2852
2853/**
2854 * ipa3_cfg_ep_ctrl() - IPA end-point Control configuration
2855 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2856 * @ipa_ep_cfg_ctrl: [in] IPA end-point configuration params
2857 *
2858 * Returns: 0 on success, negative on failure
2859 */
2860int ipa3_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl)
2861{
2862 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes || ep_ctrl == NULL) {
2863 IPAERR("bad parm, clnt_hdl = %d\n", clnt_hdl);
2864 return -EINVAL;
2865 }
2866
Skylar Changa699afd2017-06-06 10:06:21 -07002867 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0 && ep_ctrl->ipa_ep_suspend) {
2868 IPAERR("pipe suspend is not supported\n");
2869 WARN_ON(1);
2870 return -EPERM;
2871 }
2872
Amir Levy9659e592016-10-27 18:08:27 +03002873 IPADBG("pipe=%d ep_suspend=%d, ep_delay=%d\n",
2874 clnt_hdl,
2875 ep_ctrl->ipa_ep_suspend,
2876 ep_ctrl->ipa_ep_delay);
2877
2878 ipahal_write_reg_n_fields(IPA_ENDP_INIT_CTRL_n, clnt_hdl, ep_ctrl);
2879
2880 if (ep_ctrl->ipa_ep_suspend == true &&
2881 IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client))
2882 ipa3_suspend_active_aggr_wa(clnt_hdl);
2883
2884 return 0;
2885}
2886
2887const char *ipa3_get_mode_type_str(enum ipa_mode_type mode)
2888{
2889 switch (mode) {
2890 case (IPA_BASIC):
2891 return "Basic";
2892 case (IPA_ENABLE_FRAMING_HDLC):
2893 return "HDLC framing";
2894 case (IPA_ENABLE_DEFRAMING_HDLC):
2895 return "HDLC de-framing";
2896 case (IPA_DMA):
2897 return "DMA";
2898 }
2899
2900 return "undefined";
2901}
2902
2903/**
2904 * ipa3_cfg_ep_mode() - IPA end-point mode configuration
2905 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
2906 * @ipa_ep_cfg: [in] IPA end-point configuration params
2907 *
2908 * Returns: 0 on success, negative on failure
2909 *
2910 * Note: Should not be called from atomic context
2911 */
2912int ipa3_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ep_mode)
2913{
2914 int ep;
2915 int type;
2916 struct ipahal_reg_endp_init_mode init_mode;
2917
2918 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
2919 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_mode == NULL) {
2920 IPAERR("bad params clnt_hdl=%d , ep_valid=%d ep_mode=%p\n",
2921 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid,
2922 ep_mode);
2923 return -EINVAL;
2924 }
2925
2926 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
2927 IPAERR("MODE does not apply to IPA out EP %d\n", clnt_hdl);
2928 return -EINVAL;
2929 }
2930
2931 ep = ipa3_get_ep_mapping(ep_mode->dst);
2932 if (ep == -1 && ep_mode->mode == IPA_DMA) {
2933 IPAERR("dst %d does not exist in DMA mode\n", ep_mode->dst);
2934 return -EINVAL;
2935 }
2936
2937 WARN_ON(ep_mode->mode == IPA_DMA && IPA_CLIENT_IS_PROD(ep_mode->dst));
2938
2939 if (!IPA_CLIENT_IS_CONS(ep_mode->dst))
2940 ep = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
2941
Amir Levy479cfdd2017-10-26 12:23:14 +03002942 IPADBG("pipe=%d mode=%d(%s), dst_client_number=%d\n",
Amir Levy9659e592016-10-27 18:08:27 +03002943 clnt_hdl,
2944 ep_mode->mode,
2945 ipa3_get_mode_type_str(ep_mode->mode),
2946 ep_mode->dst);
2947
2948 /* copy over EP cfg */
2949 ipa3_ctx->ep[clnt_hdl].cfg.mode = *ep_mode;
2950 ipa3_ctx->ep[clnt_hdl].dst_pipe_index = ep;
2951
2952 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
2953
2954 init_mode.dst_pipe_number = ipa3_ctx->ep[clnt_hdl].dst_pipe_index;
2955 init_mode.ep_mode = *ep_mode;
2956 ipahal_write_reg_n_fields(IPA_ENDP_INIT_MODE_n, clnt_hdl, &init_mode);
2957
2958 /* Configure sequencers type for test clients*/
2959 if (IPA_CLIENT_IS_TEST(ipa3_ctx->ep[clnt_hdl].client)) {
2960 if (ep_mode->mode == IPA_DMA)
2961 type = IPA_DPS_HPS_SEQ_TYPE_DMA_ONLY;
2962 else
Skylar Chang7fa22712017-04-03 18:29:21 -07002963 type =
2964 IPA_DPS_HPS_SEQ_TYPE_2ND_PKT_PROCESS_PASS_NO_DEC_UCP;
Amir Levy9659e592016-10-27 18:08:27 +03002965
2966 IPADBG(" set sequencers to sequance 0x%x, ep = %d\n", type,
2967 clnt_hdl);
2968 ipahal_write_reg_n(IPA_ENDP_INIT_SEQ_n, clnt_hdl, type);
2969 }
2970 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
2971
2972 return 0;
2973}
2974
2975const char *ipa3_get_aggr_enable_str(enum ipa_aggr_en_type aggr_en)
2976{
2977 switch (aggr_en) {
2978 case (IPA_BYPASS_AGGR):
2979 return "no aggregation";
2980 case (IPA_ENABLE_AGGR):
2981 return "aggregation enabled";
2982 case (IPA_ENABLE_DEAGGR):
2983 return "de-aggregation enabled";
2984 }
2985
2986 return "undefined";
2987}
2988
2989const char *ipa3_get_aggr_type_str(enum ipa_aggr_type aggr_type)
2990{
2991 switch (aggr_type) {
2992 case (IPA_MBIM_16):
2993 return "MBIM_16";
2994 case (IPA_HDLC):
2995 return "HDLC";
2996 case (IPA_TLP):
2997 return "TLP";
2998 case (IPA_RNDIS):
2999 return "RNDIS";
3000 case (IPA_GENERIC):
3001 return "GENERIC";
3002 case (IPA_QCMAP):
3003 return "QCMAP";
3004 }
3005 return "undefined";
3006}
3007
3008/**
3009 * ipa3_cfg_ep_aggr() - IPA end-point aggregation configuration
3010 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3011 * @ipa_ep_cfg: [in] IPA end-point configuration params
3012 *
3013 * Returns: 0 on success, negative on failure
3014 *
3015 * Note: Should not be called from atomic context
3016 */
3017int ipa3_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ep_aggr)
3018{
3019 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3020 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_aggr == NULL) {
3021 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3022 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3023 return -EINVAL;
3024 }
3025
3026 if (ep_aggr->aggr_en == IPA_ENABLE_DEAGGR &&
3027 !IPA_EP_SUPPORTS_DEAGGR(clnt_hdl)) {
3028 IPAERR("pipe=%d cannot be configured to DEAGGR\n", clnt_hdl);
3029 WARN_ON(1);
3030 return -EINVAL;
3031 }
3032
3033 IPADBG("pipe=%d en=%d(%s), type=%d(%s), byte_limit=%d, time_limit=%d\n",
3034 clnt_hdl,
3035 ep_aggr->aggr_en,
3036 ipa3_get_aggr_enable_str(ep_aggr->aggr_en),
3037 ep_aggr->aggr,
3038 ipa3_get_aggr_type_str(ep_aggr->aggr),
3039 ep_aggr->aggr_byte_limit,
3040 ep_aggr->aggr_time_limit);
3041 IPADBG("hard_byte_limit_en=%d aggr_sw_eof_active=%d\n",
3042 ep_aggr->aggr_hard_byte_limit_en,
3043 ep_aggr->aggr_sw_eof_active);
3044
3045 /* copy over EP cfg */
3046 ipa3_ctx->ep[clnt_hdl].cfg.aggr = *ep_aggr;
3047
3048 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3049
3050 ipahal_write_reg_n_fields(IPA_ENDP_INIT_AGGR_n, clnt_hdl, ep_aggr);
3051
3052 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3053
3054 return 0;
3055}
3056
3057/**
3058 * ipa3_cfg_ep_route() - IPA end-point routing configuration
3059 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3060 * @ipa_ep_cfg: [in] IPA end-point configuration params
3061 *
3062 * Returns: 0 on success, negative on failure
3063 *
3064 * Note: Should not be called from atomic context
3065 */
3066int ipa3_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ep_route)
3067{
3068 struct ipahal_reg_endp_init_route init_rt;
3069
3070 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3071 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_route == NULL) {
3072 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3073 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3074 return -EINVAL;
3075 }
3076
3077 if (IPA_CLIENT_IS_CONS(ipa3_ctx->ep[clnt_hdl].client)) {
3078 IPAERR("ROUTE does not apply to IPA out EP %d\n",
3079 clnt_hdl);
3080 return -EINVAL;
3081 }
3082
3083 /*
3084 * if DMA mode was configured previously for this EP, return with
3085 * success
3086 */
3087 if (ipa3_ctx->ep[clnt_hdl].cfg.mode.mode == IPA_DMA) {
3088 IPADBG("DMA enabled for ep %d, dst pipe is part of DMA\n",
3089 clnt_hdl);
3090 return 0;
3091 }
3092
3093 if (ep_route->rt_tbl_hdl)
3094 IPAERR("client specified non-zero RT TBL hdl - ignore it\n");
3095
3096 IPADBG("pipe=%d, rt_tbl_hdl=%d\n",
3097 clnt_hdl,
3098 ep_route->rt_tbl_hdl);
3099
3100 /* always use "default" routing table when programming EP ROUTE reg */
3101 ipa3_ctx->ep[clnt_hdl].rt_tbl_idx =
3102 IPA_MEM_PART(v4_apps_rt_index_lo);
3103
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003104 if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0) {
3105 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
Amir Levy9659e592016-10-27 18:08:27 +03003106
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003107 init_rt.route_table_index = ipa3_ctx->ep[clnt_hdl].rt_tbl_idx;
3108 ipahal_write_reg_n_fields(IPA_ENDP_INIT_ROUTE_n,
3109 clnt_hdl, &init_rt);
Amir Levy9659e592016-10-27 18:08:27 +03003110
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003111 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3112 }
Amir Levy9659e592016-10-27 18:08:27 +03003113
3114 return 0;
3115}
3116
3117/**
3118 * ipa3_cfg_ep_holb() - IPA end-point holb configuration
3119 *
3120 * If an IPA producer pipe is full, IPA HW by default will block
3121 * indefinitely till space opens up. During this time no packets
3122 * including those from unrelated pipes will be processed. Enabling
3123 * HOLB means IPA HW will be allowed to drop packets as/when needed
3124 * and indefinite blocking is avoided.
3125 *
3126 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3127 * @ipa_ep_cfg: [in] IPA end-point configuration params
3128 *
3129 * Returns: 0 on success, negative on failure
3130 */
3131int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb)
3132{
3133 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3134 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_holb == NULL ||
3135 ep_holb->tmr_val > ipa3_ctx->ctrl->max_holb_tmr_val ||
3136 ep_holb->en > 1) {
3137 IPAERR("bad parm.\n");
3138 return -EINVAL;
3139 }
3140
3141 if (IPA_CLIENT_IS_PROD(ipa3_ctx->ep[clnt_hdl].client)) {
3142 IPAERR("HOLB does not apply to IPA in EP %d\n", clnt_hdl);
3143 return -EINVAL;
3144 }
3145
3146 ipa3_ctx->ep[clnt_hdl].holb = *ep_holb;
3147
3148 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3149
3150 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, clnt_hdl,
3151 ep_holb);
3152
3153 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_TIMER_n, clnt_hdl,
3154 ep_holb);
3155
3156 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3157
3158 IPADBG("cfg holb %u ep=%d tmr=%d\n", ep_holb->en, clnt_hdl,
3159 ep_holb->tmr_val);
3160
3161 return 0;
3162}
3163
3164/**
3165 * ipa3_cfg_ep_holb_by_client() - IPA end-point holb configuration
3166 *
3167 * Wrapper function for ipa3_cfg_ep_holb() with client name instead of
3168 * client handle. This function is used for clients that does not have
3169 * client handle.
3170 *
3171 * @client: [in] client name
3172 * @ipa_ep_cfg: [in] IPA end-point configuration params
3173 *
3174 * Returns: 0 on success, negative on failure
3175 */
3176int ipa3_cfg_ep_holb_by_client(enum ipa_client_type client,
3177 const struct ipa_ep_cfg_holb *ep_holb)
3178{
3179 return ipa3_cfg_ep_holb(ipa3_get_ep_mapping(client), ep_holb);
3180}
3181
3182/**
3183 * ipa3_cfg_ep_deaggr() - IPA end-point deaggregation configuration
3184 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3185 * @ep_deaggr: [in] IPA end-point configuration params
3186 *
3187 * Returns: 0 on success, negative on failure
3188 *
3189 * Note: Should not be called from atomic context
3190 */
3191int ipa3_cfg_ep_deaggr(u32 clnt_hdl,
3192 const struct ipa_ep_cfg_deaggr *ep_deaggr)
3193{
3194 struct ipa3_ep_context *ep;
3195
3196 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3197 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_deaggr == NULL) {
3198 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3199 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3200 return -EINVAL;
3201 }
3202
3203 IPADBG("pipe=%d deaggr_hdr_len=%d\n",
3204 clnt_hdl,
3205 ep_deaggr->deaggr_hdr_len);
3206
3207 IPADBG("packet_offset_valid=%d\n",
3208 ep_deaggr->packet_offset_valid);
3209
3210 IPADBG("packet_offset_location=%d max_packet_len=%d\n",
3211 ep_deaggr->packet_offset_location,
3212 ep_deaggr->max_packet_len);
3213
3214 ep = &ipa3_ctx->ep[clnt_hdl];
3215
3216 /* copy over EP cfg */
3217 ep->cfg.deaggr = *ep_deaggr;
3218
3219 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3220
3221 ipahal_write_reg_n_fields(IPA_ENDP_INIT_DEAGGR_n, clnt_hdl,
3222 &ep->cfg.deaggr);
3223
3224 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3225
3226 return 0;
3227}
3228
3229/**
3230 * ipa3_cfg_ep_metadata() - IPA end-point metadata configuration
3231 * @clnt_hdl: [in] opaque client handle assigned by IPA to client
3232 * @ipa_ep_cfg: [in] IPA end-point configuration params
3233 *
3234 * Returns: 0 on success, negative on failure
3235 *
3236 * Note: Should not be called from atomic context
3237 */
3238int ipa3_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
3239{
3240 u32 qmap_id = 0;
3241 struct ipa_ep_cfg_metadata ep_md_reg_wrt;
3242
3243 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
3244 ipa3_ctx->ep[clnt_hdl].valid == 0 || ep_md == NULL) {
3245 IPAERR("bad parm, clnt_hdl = %d , ep_valid = %d\n",
3246 clnt_hdl, ipa3_ctx->ep[clnt_hdl].valid);
3247 return -EINVAL;
3248 }
3249
3250 IPADBG("pipe=%d, mux id=%d\n", clnt_hdl, ep_md->qmap_id);
3251
3252 /* copy over EP cfg */
3253 ipa3_ctx->ep[clnt_hdl].cfg.meta = *ep_md;
3254
3255 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
3256
3257 ep_md_reg_wrt = *ep_md;
3258 qmap_id = (ep_md->qmap_id <<
3259 IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT) &
3260 IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_BMASK;
3261
3262 ep_md_reg_wrt.qmap_id = qmap_id;
3263 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_METADATA_n, clnt_hdl,
3264 &ep_md_reg_wrt);
3265 ipa3_ctx->ep[clnt_hdl].cfg.hdr.hdr_metadata_reg_valid = 1;
3266 ipahal_write_reg_n_fields(IPA_ENDP_INIT_HDR_n, clnt_hdl,
3267 &ipa3_ctx->ep[clnt_hdl].cfg.hdr);
3268
3269 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
3270
3271 return 0;
3272}
3273
3274int ipa3_write_qmap_id(struct ipa_ioc_write_qmapid *param_in)
3275{
3276 struct ipa_ep_cfg_metadata meta;
3277 struct ipa3_ep_context *ep;
3278 int ipa_ep_idx;
3279 int result = -EINVAL;
3280
3281 if (param_in->client >= IPA_CLIENT_MAX) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303282 IPAERR_RL("bad parm client:%d\n", param_in->client);
Amir Levy9659e592016-10-27 18:08:27 +03003283 goto fail;
3284 }
3285
3286 ipa_ep_idx = ipa3_get_ep_mapping(param_in->client);
3287 if (ipa_ep_idx == -1) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303288 IPAERR_RL("Invalid client.\n");
Amir Levy9659e592016-10-27 18:08:27 +03003289 goto fail;
3290 }
3291
3292 ep = &ipa3_ctx->ep[ipa_ep_idx];
3293 if (!ep->valid) {
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303294 IPAERR_RL("EP not allocated.\n");
Amir Levy9659e592016-10-27 18:08:27 +03003295 goto fail;
3296 }
3297
3298 meta.qmap_id = param_in->qmap_id;
3299 if (param_in->client == IPA_CLIENT_USB_PROD ||
3300 param_in->client == IPA_CLIENT_HSIC1_PROD ||
Sunil Paidimarri5139aa22017-02-13 11:07:32 -08003301 param_in->client == IPA_CLIENT_ODU_PROD ||
3302 param_in->client == IPA_CLIENT_ETHERNET_PROD) {
Amir Levy9659e592016-10-27 18:08:27 +03003303 result = ipa3_cfg_ep_metadata(ipa_ep_idx, &meta);
3304 } else if (param_in->client == IPA_CLIENT_WLAN1_PROD) {
3305 ipa3_ctx->ep[ipa_ep_idx].cfg.meta = meta;
3306 result = ipa3_write_qmapid_wdi_pipe(ipa_ep_idx, meta.qmap_id);
3307 if (result)
Utkarsh Saxenae9782812017-05-26 17:20:32 +05303308 IPAERR_RL("qmap_id %d write failed on ep=%d\n",
Amir Levy9659e592016-10-27 18:08:27 +03003309 meta.qmap_id, ipa_ep_idx);
3310 result = 0;
3311 }
3312
3313fail:
3314 return result;
3315}
3316
3317/**
3318 * ipa3_dump_buff_internal() - dumps buffer for debug purposes
3319 * @base: buffer base address
3320 * @phy_base: buffer physical base address
3321 * @size: size of the buffer
3322 */
3323void ipa3_dump_buff_internal(void *base, dma_addr_t phy_base, u32 size)
3324{
3325 int i;
3326 u32 *cur = (u32 *)base;
3327 u8 *byt;
3328
3329 IPADBG("system phys addr=%pa len=%u\n", &phy_base, size);
3330 for (i = 0; i < size / 4; i++) {
3331 byt = (u8 *)(cur + i);
3332 IPADBG("%2d %08x %02x %02x %02x %02x\n", i, *(cur + i),
3333 byt[0], byt[1], byt[2], byt[3]);
3334 }
3335 IPADBG("END\n");
3336}
3337
3338/**
Amir Levy9659e592016-10-27 18:08:27 +03003339 * ipa3_set_aggr_mode() - Set the aggregation mode which is a global setting
3340 * @mode: [in] the desired aggregation mode for e.g. straight MBIM, QCNCM,
3341 * etc
3342 *
3343 * Returns: 0 on success
3344 */
3345int ipa3_set_aggr_mode(enum ipa_aggr_mode mode)
3346{
3347 struct ipahal_reg_qcncm qcncm;
3348
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003349 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3350 if (mode != IPA_MBIM_AGGR) {
3351 IPAERR("Only MBIM mode is supported staring 4.0\n");
3352 return -EPERM;
3353 }
3354 } else {
3355 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3356 ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
3357 qcncm.mode_en = mode;
3358 ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
3359 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3360 }
Amir Levy9659e592016-10-27 18:08:27 +03003361
3362 return 0;
3363}
3364
3365/**
3366 * ipa3_set_qcncm_ndp_sig() - Set the NDP signature used for QCNCM aggregation
3367 * mode
3368 * @sig: [in] the first 3 bytes of QCNCM NDP signature (expected to be
3369 * "QND")
3370 *
3371 * Set the NDP signature used for QCNCM aggregation mode. The fourth byte
3372 * (expected to be 'P') needs to be set using the header addition mechanism
3373 *
3374 * Returns: 0 on success, negative on failure
3375 */
3376int ipa3_set_qcncm_ndp_sig(char sig[3])
3377{
3378 struct ipahal_reg_qcncm qcncm;
3379
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003380 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3381 IPAERR("QCNCM mode is not supported staring 4.0\n");
3382 return -EPERM;
3383 }
3384
Amir Levy9659e592016-10-27 18:08:27 +03003385 if (sig == NULL) {
3386 IPAERR("bad argument for ipa3_set_qcncm_ndp_sig/n");
3387 return -EINVAL;
3388 }
3389 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3390 ipahal_read_reg_fields(IPA_QCNCM, &qcncm);
3391 qcncm.mode_val = ((sig[0] << 16) | (sig[1] << 8) | sig[2]);
3392 ipahal_write_reg_fields(IPA_QCNCM, &qcncm);
3393 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3394
3395 return 0;
3396}
3397
3398/**
3399 * ipa3_set_single_ndp_per_mbim() - Enable/disable single NDP per MBIM frame
3400 * configuration
3401 * @enable: [in] true for single NDP/MBIM; false otherwise
3402 *
3403 * Returns: 0 on success
3404 */
3405int ipa3_set_single_ndp_per_mbim(bool enable)
3406{
3407 struct ipahal_reg_single_ndp_mode mode;
3408
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003409 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
3410 IPAERR("QCNCM mode is not supported staring 4.0\n");
3411 return -EPERM;
3412 }
3413
Amir Levy9659e592016-10-27 18:08:27 +03003414 IPA_ACTIVE_CLIENTS_INC_SIMPLE();
3415 ipahal_read_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
3416 mode.single_ndp_en = enable;
3417 ipahal_write_reg_fields(IPA_SINGLE_NDP_MODE, &mode);
3418 IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
3419
3420 return 0;
3421}
3422
3423/**
3424 * ipa3_straddle_boundary() - Checks whether a memory buffer straddles a
3425 * boundary
3426 * @start: start address of the memory buffer
3427 * @end: end address of the memory buffer
3428 * @boundary: boundary
3429 *
3430 * Return value:
3431 * 1: if the interval [start, end] straddles boundary
3432 * 0: otherwise
3433 */
3434int ipa3_straddle_boundary(u32 start, u32 end, u32 boundary)
3435{
3436 u32 next_start;
3437 u32 prev_end;
3438
3439 IPADBG("start=%u end=%u boundary=%u\n", start, end, boundary);
3440
3441 next_start = (start + (boundary - 1)) & ~(boundary - 1);
3442 prev_end = ((end + (boundary - 1)) & ~(boundary - 1)) - boundary;
3443
3444 while (next_start < prev_end)
3445 next_start += boundary;
3446
3447 if (next_start == prev_end)
3448 return 1;
3449 else
3450 return 0;
3451}
3452
3453/**
Amir Levy9659e592016-10-27 18:08:27 +03003454 * ipa3_init_mem_partition() - Reads IPA memory map from DTS, performs alignment
3455 * checks and logs the fetched values.
3456 *
3457 * Returns: 0 on success
3458 */
3459int ipa3_init_mem_partition(struct device_node *node)
3460{
Amir Levy9fadeca2017-04-25 10:18:32 +03003461 const size_t ram_mmap_current_version_size =
3462 sizeof(ipa3_ctx->ctrl->mem_partition) / sizeof(u32);
Amir Levy9659e592016-10-27 18:08:27 +03003463 int result;
3464
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003465 memset(&ipa3_ctx->ctrl->mem_partition, 0,
3466 sizeof(ipa3_ctx->ctrl->mem_partition));
3467
Amir Levy9659e592016-10-27 18:08:27 +03003468 IPADBG("Reading from DTS as u32 array\n");
Amir Levy9659e592016-10-27 18:08:27 +03003469
Amir Levy9fadeca2017-04-25 10:18:32 +03003470 /*
3471 * The size of ipa-ram-mmap array depends on the IPA version. The
3472 * actual size can't be assumed because of possible DTS versions
3473 * mismatch. The size of the array monotonically increasing because the
3474 * obsolete entries are set to zero rather than deleted, so the
3475 * possible sizes are in range
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003476 * [1, ram_mmap_current_version_size]
Amir Levy9fadeca2017-04-25 10:18:32 +03003477 */
3478 result = of_property_read_variable_u32_array(node, "qcom,ipa-ram-mmap",
3479 (u32 *)&ipa3_ctx->ctrl->mem_partition,
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003480 1, ram_mmap_current_version_size);
Amir Levy9fadeca2017-04-25 10:18:32 +03003481
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003482 if (IPA_MEM_PART(uc_event_ring_ofst) & 1023) {
3483 IPAERR("UC EVENT RING OFST 0x%x is unaligned\n",
3484 IPA_MEM_PART(uc_event_ring_ofst));
Amir Levy9659e592016-10-27 18:08:27 +03003485 return -ENODEV;
3486 }
Amir Levy9fadeca2017-04-25 10:18:32 +03003487
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003488 IPADBG("UC EVENT RING OFST 0x%x SIZE 0x%x\n",
3489 IPA_MEM_PART(uc_event_ring_ofst),
3490 IPA_MEM_PART(uc_event_ring_size));
Amir Levy9659e592016-10-27 18:08:27 +03003491
3492 IPADBG("NAT OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(nat_ofst),
3493 IPA_MEM_PART(nat_size));
3494
3495 if (IPA_MEM_PART(uc_info_ofst) & 3) {
3496 IPAERR("UC INFO OFST 0x%x is unaligned\n",
3497 IPA_MEM_PART(uc_info_ofst));
3498 return -ENODEV;
3499 }
3500
3501 IPADBG("UC INFO OFST 0x%x SIZE 0x%x\n",
3502 IPA_MEM_PART(uc_info_ofst), IPA_MEM_PART(uc_info_size));
3503
3504 IPADBG("RAM OFST 0x%x\n", IPA_MEM_PART(ofst_start));
3505
3506 if (IPA_MEM_PART(v4_flt_hash_ofst) & 7) {
3507 IPAERR("V4 FLT HASHABLE OFST 0x%x is unaligned\n",
3508 IPA_MEM_PART(v4_flt_hash_ofst));
3509 return -ENODEV;
3510 }
3511
3512 IPADBG("V4 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3513 IPA_MEM_PART(v4_flt_hash_ofst),
3514 IPA_MEM_PART(v4_flt_hash_size),
3515 IPA_MEM_PART(v4_flt_hash_size_ddr));
3516
3517 if (IPA_MEM_PART(v4_flt_nhash_ofst) & 7) {
3518 IPAERR("V4 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
3519 IPA_MEM_PART(v4_flt_nhash_ofst));
3520 return -ENODEV;
3521 }
3522
3523 IPADBG("V4 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3524 IPA_MEM_PART(v4_flt_nhash_ofst),
3525 IPA_MEM_PART(v4_flt_nhash_size),
3526 IPA_MEM_PART(v4_flt_nhash_size_ddr));
3527
3528 if (IPA_MEM_PART(v6_flt_hash_ofst) & 7) {
3529 IPAERR("V6 FLT HASHABLE OFST 0x%x is unaligned\n",
3530 IPA_MEM_PART(v6_flt_hash_ofst));
3531 return -ENODEV;
3532 }
3533
3534 IPADBG("V6 FLT HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3535 IPA_MEM_PART(v6_flt_hash_ofst), IPA_MEM_PART(v6_flt_hash_size),
3536 IPA_MEM_PART(v6_flt_hash_size_ddr));
3537
3538 if (IPA_MEM_PART(v6_flt_nhash_ofst) & 7) {
3539 IPAERR("V6 FLT NON-HASHABLE OFST 0x%x is unaligned\n",
3540 IPA_MEM_PART(v6_flt_nhash_ofst));
3541 return -ENODEV;
3542 }
3543
3544 IPADBG("V6 FLT NON-HASHABLE OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3545 IPA_MEM_PART(v6_flt_nhash_ofst),
3546 IPA_MEM_PART(v6_flt_nhash_size),
3547 IPA_MEM_PART(v6_flt_nhash_size_ddr));
3548
3549 IPADBG("V4 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v4_rt_num_index));
3550
3551 IPADBG("V4 RT MODEM INDEXES 0x%x - 0x%x\n",
3552 IPA_MEM_PART(v4_modem_rt_index_lo),
3553 IPA_MEM_PART(v4_modem_rt_index_hi));
3554
3555 IPADBG("V4 RT APPS INDEXES 0x%x - 0x%x\n",
3556 IPA_MEM_PART(v4_apps_rt_index_lo),
3557 IPA_MEM_PART(v4_apps_rt_index_hi));
3558
3559 if (IPA_MEM_PART(v4_rt_hash_ofst) & 7) {
3560 IPAERR("V4 RT HASHABLE OFST 0x%x is unaligned\n",
3561 IPA_MEM_PART(v4_rt_hash_ofst));
3562 return -ENODEV;
3563 }
3564
3565 IPADBG("V4 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v4_rt_hash_ofst));
3566
3567 IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3568 IPA_MEM_PART(v4_rt_hash_size),
3569 IPA_MEM_PART(v4_rt_hash_size_ddr));
3570
3571 if (IPA_MEM_PART(v4_rt_nhash_ofst) & 7) {
3572 IPAERR("V4 RT NON-HASHABLE OFST 0x%x is unaligned\n",
3573 IPA_MEM_PART(v4_rt_nhash_ofst));
3574 return -ENODEV;
3575 }
3576
3577 IPADBG("V4 RT NON-HASHABLE OFST 0x%x\n",
3578 IPA_MEM_PART(v4_rt_nhash_ofst));
3579
3580 IPADBG("V4 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3581 IPA_MEM_PART(v4_rt_nhash_size),
3582 IPA_MEM_PART(v4_rt_nhash_size_ddr));
3583
3584 IPADBG("V6 RT NUM INDEX 0x%x\n", IPA_MEM_PART(v6_rt_num_index));
3585
3586 IPADBG("V6 RT MODEM INDEXES 0x%x - 0x%x\n",
3587 IPA_MEM_PART(v6_modem_rt_index_lo),
3588 IPA_MEM_PART(v6_modem_rt_index_hi));
3589
3590 IPADBG("V6 RT APPS INDEXES 0x%x - 0x%x\n",
3591 IPA_MEM_PART(v6_apps_rt_index_lo),
3592 IPA_MEM_PART(v6_apps_rt_index_hi));
3593
3594 if (IPA_MEM_PART(v6_rt_hash_ofst) & 7) {
3595 IPAERR("V6 RT HASHABLE OFST 0x%x is unaligned\n",
3596 IPA_MEM_PART(v6_rt_hash_ofst));
3597 return -ENODEV;
3598 }
3599
3600 IPADBG("V6 RT HASHABLE OFST 0x%x\n", IPA_MEM_PART(v6_rt_hash_ofst));
3601
3602 IPADBG("V6 RT HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3603 IPA_MEM_PART(v6_rt_hash_size),
3604 IPA_MEM_PART(v6_rt_hash_size_ddr));
3605
3606 if (IPA_MEM_PART(v6_rt_nhash_ofst) & 7) {
3607 IPAERR("V6 RT NON-HASHABLE OFST 0x%x is unaligned\n",
3608 IPA_MEM_PART(v6_rt_nhash_ofst));
3609 return -ENODEV;
3610 }
3611
3612 IPADBG("V6 RT NON-HASHABLE OFST 0x%x\n",
3613 IPA_MEM_PART(v6_rt_nhash_ofst));
3614
3615 IPADBG("V6 RT NON-HASHABLE SIZE 0x%x DDR SIZE 0x%x\n",
3616 IPA_MEM_PART(v6_rt_nhash_size),
3617 IPA_MEM_PART(v6_rt_nhash_size_ddr));
3618
3619 if (IPA_MEM_PART(modem_hdr_ofst) & 7) {
3620 IPAERR("MODEM HDR OFST 0x%x is unaligned\n",
3621 IPA_MEM_PART(modem_hdr_ofst));
3622 return -ENODEV;
3623 }
3624
3625 IPADBG("MODEM HDR OFST 0x%x SIZE 0x%x\n",
3626 IPA_MEM_PART(modem_hdr_ofst), IPA_MEM_PART(modem_hdr_size));
3627
3628 if (IPA_MEM_PART(apps_hdr_ofst) & 7) {
3629 IPAERR("APPS HDR OFST 0x%x is unaligned\n",
3630 IPA_MEM_PART(apps_hdr_ofst));
3631 return -ENODEV;
3632 }
3633
3634 IPADBG("APPS HDR OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3635 IPA_MEM_PART(apps_hdr_ofst), IPA_MEM_PART(apps_hdr_size),
3636 IPA_MEM_PART(apps_hdr_size_ddr));
3637
3638 if (IPA_MEM_PART(modem_hdr_proc_ctx_ofst) & 7) {
3639 IPAERR("MODEM HDR PROC CTX OFST 0x%x is unaligned\n",
3640 IPA_MEM_PART(modem_hdr_proc_ctx_ofst));
3641 return -ENODEV;
3642 }
3643
3644 IPADBG("MODEM HDR PROC CTX OFST 0x%x SIZE 0x%x\n",
3645 IPA_MEM_PART(modem_hdr_proc_ctx_ofst),
3646 IPA_MEM_PART(modem_hdr_proc_ctx_size));
3647
3648 if (IPA_MEM_PART(apps_hdr_proc_ctx_ofst) & 7) {
3649 IPAERR("APPS HDR PROC CTX OFST 0x%x is unaligned\n",
3650 IPA_MEM_PART(apps_hdr_proc_ctx_ofst));
3651 return -ENODEV;
3652 }
3653
3654 IPADBG("APPS HDR PROC CTX OFST 0x%x SIZE 0x%x DDR SIZE 0x%x\n",
3655 IPA_MEM_PART(apps_hdr_proc_ctx_ofst),
3656 IPA_MEM_PART(apps_hdr_proc_ctx_size),
3657 IPA_MEM_PART(apps_hdr_proc_ctx_size_ddr));
3658
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003659 if (IPA_MEM_PART(pdn_config_ofst) & 7) {
3660 IPAERR("PDN CONFIG OFST 0x%x is unaligned\n",
3661 IPA_MEM_PART(pdn_config_ofst));
3662 return -ENODEV;
3663 }
3664
3665 IPADBG("PDN CONFIG OFST 0x%x SIZE 0x%x\n",
3666 IPA_MEM_PART(pdn_config_ofst),
3667 IPA_MEM_PART(pdn_config_size));
3668
Amir Levy9659e592016-10-27 18:08:27 +03003669 if (IPA_MEM_PART(modem_ofst) & 7) {
3670 IPAERR("MODEM OFST 0x%x is unaligned\n",
3671 IPA_MEM_PART(modem_ofst));
3672 return -ENODEV;
3673 }
3674
3675 IPADBG("MODEM OFST 0x%x SIZE 0x%x\n", IPA_MEM_PART(modem_ofst),
3676 IPA_MEM_PART(modem_size));
3677
3678 IPADBG("V4 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3679 IPA_MEM_PART(apps_v4_flt_hash_ofst),
3680 IPA_MEM_PART(apps_v4_flt_hash_size));
3681
3682 IPADBG("V4 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3683 IPA_MEM_PART(apps_v4_flt_nhash_ofst),
3684 IPA_MEM_PART(apps_v4_flt_nhash_size));
3685
3686 IPADBG("V6 APPS HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3687 IPA_MEM_PART(apps_v6_flt_hash_ofst),
3688 IPA_MEM_PART(apps_v6_flt_hash_size));
3689
3690 IPADBG("V6 APPS NON-HASHABLE FLT OFST 0x%x SIZE 0x%x\n",
3691 IPA_MEM_PART(apps_v6_flt_nhash_ofst),
3692 IPA_MEM_PART(apps_v6_flt_nhash_size));
3693
3694 IPADBG("RAM END OFST 0x%x\n",
3695 IPA_MEM_PART(end_ofst));
3696
3697 IPADBG("V4 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3698 IPA_MEM_PART(apps_v4_rt_hash_ofst),
3699 IPA_MEM_PART(apps_v4_rt_hash_size));
3700
3701 IPADBG("V4 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3702 IPA_MEM_PART(apps_v4_rt_nhash_ofst),
3703 IPA_MEM_PART(apps_v4_rt_nhash_size));
3704
3705 IPADBG("V6 APPS HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3706 IPA_MEM_PART(apps_v6_rt_hash_ofst),
3707 IPA_MEM_PART(apps_v6_rt_hash_size));
3708
3709 IPADBG("V6 APPS NON-HASHABLE RT OFST 0x%x SIZE 0x%x\n",
3710 IPA_MEM_PART(apps_v6_rt_nhash_ofst),
3711 IPA_MEM_PART(apps_v6_rt_nhash_size));
3712
3713 return 0;
3714}
3715
3716/**
3717 * ipa_ctrl_static_bind() - set the appropriate methods for
3718 * IPA Driver based on the HW version
3719 *
3720 * @ctrl: data structure which holds the function pointers
3721 * @hw_type: the HW type in use
3722 *
3723 * This function can avoid the runtime assignment by using C99 special
3724 * struct initialization - hard decision... time.vs.mem
3725 */
3726int ipa3_controller_static_bind(struct ipa3_controller *ctrl,
3727 enum ipa_hw_type hw_type)
3728{
Skylar Changf88124c2017-07-18 18:11:25 -07003729 if (hw_type >= IPA_HW_v4_0) {
3730 ctrl->ipa_clk_rate_turbo = IPA_V4_0_CLK_RATE_TURBO;
3731 ctrl->ipa_clk_rate_nominal = IPA_V4_0_CLK_RATE_NOMINAL;
3732 ctrl->ipa_clk_rate_svs = IPA_V4_0_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003733 ctrl->ipa_clk_rate_svs2 = IPA_V4_0_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003734 } else if (hw_type >= IPA_HW_v3_5) {
3735 ctrl->ipa_clk_rate_turbo = IPA_V3_5_CLK_RATE_TURBO;
3736 ctrl->ipa_clk_rate_nominal = IPA_V3_5_CLK_RATE_NOMINAL;
3737 ctrl->ipa_clk_rate_svs = IPA_V3_5_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003738 ctrl->ipa_clk_rate_svs2 = IPA_V3_5_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003739 } else {
3740 ctrl->ipa_clk_rate_turbo = IPA_V3_0_CLK_RATE_TURBO;
3741 ctrl->ipa_clk_rate_nominal = IPA_V3_0_CLK_RATE_NOMINAL;
3742 ctrl->ipa_clk_rate_svs = IPA_V3_0_CLK_RATE_SVS;
Skylar Chang448d8b82017-08-08 17:30:32 -07003743 ctrl->ipa_clk_rate_svs2 = IPA_V3_0_CLK_RATE_SVS2;
Skylar Changf88124c2017-07-18 18:11:25 -07003744 }
3745
Amir Levy9659e592016-10-27 18:08:27 +03003746 ctrl->ipa_init_rt4 = _ipa_init_rt4_v3;
3747 ctrl->ipa_init_rt6 = _ipa_init_rt6_v3;
3748 ctrl->ipa_init_flt4 = _ipa_init_flt4_v3;
3749 ctrl->ipa_init_flt6 = _ipa_init_flt6_v3;
Amir Levy9659e592016-10-27 18:08:27 +03003750 ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v3_0;
3751 ctrl->ipa3_commit_flt = __ipa_commit_flt_v3;
3752 ctrl->ipa3_commit_rt = __ipa_commit_rt_v3;
3753 ctrl->ipa3_commit_hdr = __ipa_commit_hdr_v3_0;
3754 ctrl->ipa3_enable_clks = _ipa_enable_clks_v3_0;
3755 ctrl->ipa3_disable_clks = _ipa_disable_clks_v3_0;
3756 ctrl->msm_bus_data_ptr = &ipa_bus_client_pdata_v3_0;
Skylar Chang448d8b82017-08-08 17:30:32 -07003757 ctrl->clock_scaling_bw_threshold_svs =
3758 IPA_V3_0_BW_THRESHOLD_SVS_MBPS;
Amir Levy9659e592016-10-27 18:08:27 +03003759 ctrl->clock_scaling_bw_threshold_nominal =
3760 IPA_V3_0_BW_THRESHOLD_NOMINAL_MBPS;
3761 ctrl->clock_scaling_bw_threshold_turbo =
3762 IPA_V3_0_BW_THRESHOLD_TURBO_MBPS;
3763 ctrl->ipa_reg_base_ofst = ipahal_get_reg_base();
Amir Levy9fadeca2017-04-25 10:18:32 +03003764 ctrl->ipa_init_sram = _ipa_init_sram_v3;
Amir Levy9659e592016-10-27 18:08:27 +03003765 ctrl->ipa_sram_read_settings = _ipa_sram_settings_read_v3_0;
Amir Levy9659e592016-10-27 18:08:27 +03003766 ctrl->ipa_init_hdr = _ipa_init_hdr_v3_0;
3767
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07003768 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
3769 ctrl->ipa3_read_ep_reg = _ipa_read_ep_reg_v4_0;
3770
Amir Levy9659e592016-10-27 18:08:27 +03003771 return 0;
3772}
3773
3774void ipa3_skb_recycle(struct sk_buff *skb)
3775{
3776 struct skb_shared_info *shinfo;
3777
3778 shinfo = skb_shinfo(skb);
3779 memset(shinfo, 0, offsetof(struct skb_shared_info, dataref));
3780 atomic_set(&shinfo->dataref, 1);
3781
3782 memset(skb, 0, offsetof(struct sk_buff, tail));
3783 skb->data = skb->head + NET_SKB_PAD;
3784 skb_reset_tail_pointer(skb);
3785}
3786
3787int ipa3_alloc_rule_id(struct idr *rule_ids)
3788{
3789 /* There is two groups of rule-Ids, Modem ones and Apps ones.
3790 * Distinction by high bit: Modem Ids are high bit asserted.
3791 */
3792 return idr_alloc(rule_ids, NULL,
3793 ipahal_get_low_rule_id(), ipahal_get_rule_id_hi_bit(),
3794 GFP_KERNEL);
3795}
3796
3797int ipa3_id_alloc(void *ptr)
3798{
3799 int id;
3800
3801 idr_preload(GFP_KERNEL);
3802 spin_lock(&ipa3_ctx->idr_lock);
3803 id = idr_alloc(&ipa3_ctx->ipa_idr, ptr, 0, 0, GFP_NOWAIT);
3804 spin_unlock(&ipa3_ctx->idr_lock);
3805 idr_preload_end();
3806
3807 return id;
3808}
3809
3810void *ipa3_id_find(u32 id)
3811{
3812 void *ptr;
3813
3814 spin_lock(&ipa3_ctx->idr_lock);
3815 ptr = idr_find(&ipa3_ctx->ipa_idr, id);
3816 spin_unlock(&ipa3_ctx->idr_lock);
3817
3818 return ptr;
3819}
3820
3821void ipa3_id_remove(u32 id)
3822{
3823 spin_lock(&ipa3_ctx->idr_lock);
3824 idr_remove(&ipa3_ctx->ipa_idr, id);
3825 spin_unlock(&ipa3_ctx->idr_lock);
3826}
3827
3828void ipa3_tag_destroy_imm(void *user1, int user2)
3829{
3830 ipahal_destroy_imm_cmd(user1);
3831}
3832
3833static void ipa3_tag_free_skb(void *user1, int user2)
3834{
3835 dev_kfree_skb_any((struct sk_buff *)user1);
3836}
3837
3838#define REQUIRED_TAG_PROCESS_DESCRIPTORS 4
3839
3840/* ipa3_tag_process() - Initiates a tag process. Incorporates the input
3841 * descriptors
3842 *
3843 * @desc: descriptors with commands for IC
3844 * @desc_size: amount of descriptors in the above variable
3845 *
3846 * Note: The descriptors are copied (if there's room), the client needs to
3847 * free his descriptors afterwards
3848 *
3849 * Return: 0 or negative in case of failure
3850 */
3851int ipa3_tag_process(struct ipa3_desc desc[],
3852 int descs_num,
3853 unsigned long timeout)
3854{
3855 struct ipa3_sys_context *sys;
3856 struct ipa3_desc *tag_desc;
3857 int desc_idx = 0;
3858 struct ipahal_imm_cmd_ip_packet_init pktinit_cmd;
3859 struct ipahal_imm_cmd_pyld *cmd_pyld = NULL;
3860 struct ipahal_imm_cmd_ip_packet_tag_status status;
3861 int i;
3862 struct sk_buff *dummy_skb;
3863 int res;
3864 struct ipa3_tag_completion *comp;
3865 int ep_idx;
3866
3867 /* Not enough room for the required descriptors for the tag process */
3868 if (IPA_TAG_MAX_DESC - descs_num < REQUIRED_TAG_PROCESS_DESCRIPTORS) {
3869 IPAERR("up to %d descriptors are allowed (received %d)\n",
3870 IPA_TAG_MAX_DESC - REQUIRED_TAG_PROCESS_DESCRIPTORS,
3871 descs_num);
3872 return -ENOMEM;
3873 }
3874
3875 ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD);
3876 if (-1 == ep_idx) {
3877 IPAERR("Client %u is not mapped\n",
3878 IPA_CLIENT_APPS_CMD_PROD);
3879 return -EFAULT;
3880 }
3881 sys = ipa3_ctx->ep[ep_idx].sys;
3882
3883 tag_desc = kzalloc(sizeof(*tag_desc) * IPA_TAG_MAX_DESC, GFP_KERNEL);
3884 if (!tag_desc) {
3885 IPAERR("failed to allocate memory\n");
3886 return -ENOMEM;
3887 }
3888
3889 /* Copy the required descriptors from the client now */
3890 if (desc) {
3891 memcpy(&(tag_desc[0]), desc, descs_num *
3892 sizeof(tag_desc[0]));
3893 desc_idx += descs_num;
3894 }
3895
3896 /* NO-OP IC for ensuring that IPA pipeline is empty */
3897 cmd_pyld = ipahal_construct_nop_imm_cmd(
3898 false, IPAHAL_FULL_PIPELINE_CLEAR, false);
3899 if (!cmd_pyld) {
3900 IPAERR("failed to construct NOP imm cmd\n");
3901 res = -ENOMEM;
3902 goto fail_free_tag_desc;
3903 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003904 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003905 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3906 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003907 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003908
3909 /* IP_PACKET_INIT IC for tag status to be sent to apps */
3910 pktinit_cmd.destination_pipe_index =
3911 ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
3912 cmd_pyld = ipahal_construct_imm_cmd(
3913 IPA_IMM_CMD_IP_PACKET_INIT, &pktinit_cmd, false);
3914 if (!cmd_pyld) {
3915 IPAERR("failed to construct ip_packet_init imm cmd\n");
3916 res = -ENOMEM;
3917 goto fail_free_desc;
3918 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003919 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003920 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3921 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003922 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003923
3924 /* status IC */
3925 status.tag = IPA_COOKIE;
3926 cmd_pyld = ipahal_construct_imm_cmd(
3927 IPA_IMM_CMD_IP_PACKET_TAG_STATUS, &status, false);
3928 if (!cmd_pyld) {
3929 IPAERR("failed to construct ip_packet_tag_status imm cmd\n");
3930 res = -ENOMEM;
3931 goto fail_free_desc;
3932 }
Amir Levy479cfdd2017-10-26 12:23:14 +03003933 ipa3_init_imm_cmd_desc(&tag_desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03003934 tag_desc[desc_idx].callback = ipa3_tag_destroy_imm;
3935 tag_desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03003936 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03003937
3938 comp = kzalloc(sizeof(*comp), GFP_KERNEL);
3939 if (!comp) {
3940 IPAERR("no mem\n");
3941 res = -ENOMEM;
3942 goto fail_free_desc;
3943 }
3944 init_completion(&comp->comp);
3945
3946 /* completion needs to be released from both here and rx handler */
3947 atomic_set(&comp->cnt, 2);
3948
3949 /* dummy packet to send to IPA. packet payload is a completion object */
3950 dummy_skb = alloc_skb(sizeof(comp), GFP_KERNEL);
3951 if (!dummy_skb) {
3952 IPAERR("failed to allocate memory\n");
3953 res = -ENOMEM;
3954 goto fail_free_comp;
3955 }
3956
3957 memcpy(skb_put(dummy_skb, sizeof(comp)), &comp, sizeof(comp));
3958
Amir Levy479cfdd2017-10-26 12:23:14 +03003959 if (desc_idx >= IPA_TAG_MAX_DESC) {
3960 IPAERR("number of commands is out of range\n");
3961 res = -ENOBUFS;
3962 goto fail_free_skb;
3963 }
3964
Amir Levy9659e592016-10-27 18:08:27 +03003965 tag_desc[desc_idx].pyld = dummy_skb->data;
3966 tag_desc[desc_idx].len = dummy_skb->len;
3967 tag_desc[desc_idx].type = IPA_DATA_DESC_SKB;
3968 tag_desc[desc_idx].callback = ipa3_tag_free_skb;
3969 tag_desc[desc_idx].user1 = dummy_skb;
3970 desc_idx++;
3971
3972 /* send all descriptors to IPA with single EOT */
3973 res = ipa3_send(sys, desc_idx, tag_desc, true);
3974 if (res) {
3975 IPAERR("failed to send TAG packets %d\n", res);
3976 res = -ENOMEM;
Amir Levy479cfdd2017-10-26 12:23:14 +03003977 goto fail_free_skb;
Amir Levy9659e592016-10-27 18:08:27 +03003978 }
3979 kfree(tag_desc);
3980 tag_desc = NULL;
3981
3982 IPADBG("waiting for TAG response\n");
3983 res = wait_for_completion_timeout(&comp->comp, timeout);
3984 if (res == 0) {
3985 IPAERR("timeout (%lu msec) on waiting for TAG response\n",
3986 timeout);
3987 WARN_ON(1);
3988 if (atomic_dec_return(&comp->cnt) == 0)
3989 kfree(comp);
3990 return -ETIME;
3991 }
3992
3993 IPADBG("TAG response arrived!\n");
3994 if (atomic_dec_return(&comp->cnt) == 0)
3995 kfree(comp);
3996
Amir Levya59ed3f2017-03-05 17:30:55 +02003997 /*
3998 * sleep for short period to ensure IPA wrote all packets to
3999 * the transport
4000 */
Amir Levy9659e592016-10-27 18:08:27 +03004001 usleep_range(IPA_TAG_SLEEP_MIN_USEC, IPA_TAG_SLEEP_MAX_USEC);
4002
4003 return 0;
4004
Amir Levy479cfdd2017-10-26 12:23:14 +03004005fail_free_skb:
4006 kfree_skb(dummy_skb);
Amir Levy9659e592016-10-27 18:08:27 +03004007fail_free_comp:
4008 kfree(comp);
4009fail_free_desc:
4010 /*
4011 * Free only the first descriptors allocated here.
4012 * [nop, pkt_init, status, dummy_skb]
4013 * The user is responsible to free his allocations
4014 * in case of failure.
4015 * The min is required because we may fail during
4016 * of the initial allocations above
4017 */
4018 for (i = descs_num;
4019 i < min(REQUIRED_TAG_PROCESS_DESCRIPTORS, desc_idx); i++)
4020 if (tag_desc[i].callback)
4021 tag_desc[i].callback(tag_desc[i].user1,
4022 tag_desc[i].user2);
4023fail_free_tag_desc:
4024 kfree(tag_desc);
4025 return res;
4026}
4027
4028/**
4029 * ipa3_tag_generate_force_close_desc() - generate descriptors for force close
4030 * immediate command
4031 *
4032 * @desc: descriptors for IC
4033 * @desc_size: desc array size
4034 * @start_pipe: first pipe to close aggregation
4035 * @end_pipe: last (non-inclusive) pipe to close aggregation
4036 *
4037 * Return: number of descriptors written or negative in case of failure
4038 */
4039static int ipa3_tag_generate_force_close_desc(struct ipa3_desc desc[],
4040 int desc_size, int start_pipe, int end_pipe)
4041{
4042 int i;
4043 struct ipa_ep_cfg_aggr ep_aggr;
4044 int desc_idx = 0;
4045 int res;
4046 struct ipahal_imm_cmd_register_write reg_write_agg_close;
4047 struct ipahal_imm_cmd_pyld *cmd_pyld;
4048 struct ipahal_reg_valmask valmask;
4049
4050 for (i = start_pipe; i < end_pipe; i++) {
4051 ipahal_read_reg_n_fields(IPA_ENDP_INIT_AGGR_n, i, &ep_aggr);
4052 if (!ep_aggr.aggr_en)
4053 continue;
4054 IPADBG("Force close ep: %d\n", i);
4055 if (desc_idx + 1 > desc_size) {
4056 IPAERR("Internal error - no descriptors\n");
4057 res = -EFAULT;
4058 goto fail_no_desc;
4059 }
4060
4061 reg_write_agg_close.skip_pipeline_clear = false;
4062 reg_write_agg_close.pipeline_clear_options =
4063 IPAHAL_FULL_PIPELINE_CLEAR;
4064 reg_write_agg_close.offset =
4065 ipahal_get_reg_ofst(IPA_AGGR_FORCE_CLOSE);
Ghanim Fodicff9c942017-08-07 11:40:58 +03004066 ipahal_get_aggr_force_close_valmask(i, &valmask);
Amir Levy9659e592016-10-27 18:08:27 +03004067 reg_write_agg_close.value = valmask.val;
4068 reg_write_agg_close.value_mask = valmask.mask;
4069 cmd_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_REGISTER_WRITE,
4070 &reg_write_agg_close, false);
4071 if (!cmd_pyld) {
4072 IPAERR("failed to construct register_write imm cmd\n");
4073 res = -ENOMEM;
4074 goto fail_alloc_reg_write_agg_close;
4075 }
4076
Amir Levy479cfdd2017-10-26 12:23:14 +03004077 ipa3_init_imm_cmd_desc(&desc[desc_idx], cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03004078 desc[desc_idx].callback = ipa3_tag_destroy_imm;
4079 desc[desc_idx].user1 = cmd_pyld;
Amir Levy479cfdd2017-10-26 12:23:14 +03004080 ++desc_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004081 }
4082
4083 return desc_idx;
4084
4085fail_alloc_reg_write_agg_close:
Amir Levy479cfdd2017-10-26 12:23:14 +03004086 for (i = 0; i < desc_idx; ++i)
Amir Levy9659e592016-10-27 18:08:27 +03004087 if (desc[desc_idx].callback)
4088 desc[desc_idx].callback(desc[desc_idx].user1,
4089 desc[desc_idx].user2);
4090fail_no_desc:
4091 return res;
4092}
4093
4094/**
4095 * ipa3_tag_aggr_force_close() - Force close aggregation
4096 *
4097 * @pipe_num: pipe number or -1 for all pipes
4098 */
4099int ipa3_tag_aggr_force_close(int pipe_num)
4100{
4101 struct ipa3_desc *desc;
4102 int res = -1;
4103 int start_pipe;
4104 int end_pipe;
4105 int num_descs;
4106 int num_aggr_descs;
4107
4108 if (pipe_num < -1 || pipe_num >= (int)ipa3_ctx->ipa_num_pipes) {
4109 IPAERR("Invalid pipe number %d\n", pipe_num);
4110 return -EINVAL;
4111 }
4112
4113 if (pipe_num == -1) {
4114 start_pipe = 0;
4115 end_pipe = ipa3_ctx->ipa_num_pipes;
4116 } else {
4117 start_pipe = pipe_num;
4118 end_pipe = pipe_num + 1;
4119 }
4120
4121 num_descs = end_pipe - start_pipe;
4122
4123 desc = kcalloc(num_descs, sizeof(*desc), GFP_KERNEL);
4124 if (!desc) {
4125 IPAERR("no mem\n");
4126 return -ENOMEM;
4127 }
4128
4129 /* Force close aggregation on all valid pipes with aggregation */
4130 num_aggr_descs = ipa3_tag_generate_force_close_desc(desc, num_descs,
4131 start_pipe, end_pipe);
4132 if (num_aggr_descs < 0) {
4133 IPAERR("ipa3_tag_generate_force_close_desc failed %d\n",
4134 num_aggr_descs);
4135 goto fail_free_desc;
4136 }
4137
4138 res = ipa3_tag_process(desc, num_aggr_descs,
4139 IPA_FORCE_CLOSE_TAG_PROCESS_TIMEOUT);
4140
4141fail_free_desc:
4142 kfree(desc);
4143
4144 return res;
4145}
4146
4147/**
4148 * ipa3_is_ready() - check if IPA module was initialized
4149 * successfully
4150 *
4151 * Return value: true for yes; false for no
4152 */
4153bool ipa3_is_ready(void)
4154{
4155 bool complete;
4156
4157 if (ipa3_ctx == NULL)
4158 return false;
4159 mutex_lock(&ipa3_ctx->lock);
4160 complete = ipa3_ctx->ipa_initialization_complete;
4161 mutex_unlock(&ipa3_ctx->lock);
4162 return complete;
4163}
4164
4165/**
4166 * ipa3_is_client_handle_valid() - check if IPA client handle is valid handle
4167 *
4168 * Return value: true for yes; false for no
4169 */
4170bool ipa3_is_client_handle_valid(u32 clnt_hdl)
4171{
4172 if (clnt_hdl >= 0 && clnt_hdl < ipa3_ctx->ipa_num_pipes)
4173 return true;
4174 return false;
4175}
4176
4177/**
4178 * ipa3_proxy_clk_unvote() - called to remove IPA clock proxy vote
4179 *
4180 * Return value: none
4181 */
4182void ipa3_proxy_clk_unvote(void)
4183{
Skylar Changfb792c62017-08-17 12:53:23 -07004184 if (!ipa3_is_ready())
4185 return;
4186
4187 mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
4188 if (ipa3_ctx->q6_proxy_clk_vote_valid) {
Amir Levy9659e592016-10-27 18:08:27 +03004189 IPA_ACTIVE_CLIENTS_DEC_SPECIAL("PROXY_CLK_VOTE");
Mohammed Javid05b05d02017-11-13 23:43:27 +05304190 ipa3_ctx->q6_proxy_clk_vote_cnt--;
4191 if (ipa3_ctx->q6_proxy_clk_vote_cnt == 0)
4192 ipa3_ctx->q6_proxy_clk_vote_valid = false;
Amir Levy9659e592016-10-27 18:08:27 +03004193 }
Skylar Changfb792c62017-08-17 12:53:23 -07004194 mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Amir Levy9659e592016-10-27 18:08:27 +03004195}
4196
4197/**
4198 * ipa3_proxy_clk_vote() - called to add IPA clock proxy vote
4199 *
4200 * Return value: none
4201 */
4202void ipa3_proxy_clk_vote(void)
4203{
Skylar Changfb792c62017-08-17 12:53:23 -07004204 if (!ipa3_is_ready())
4205 return;
4206
4207 mutex_lock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Mohammed Javid05b05d02017-11-13 23:43:27 +05304208 if (!ipa3_ctx->q6_proxy_clk_vote_valid ||
4209 (ipa3_ctx->q6_proxy_clk_vote_cnt > 0)) {
Amir Levy9659e592016-10-27 18:08:27 +03004210 IPA_ACTIVE_CLIENTS_INC_SPECIAL("PROXY_CLK_VOTE");
Mohammed Javid05b05d02017-11-13 23:43:27 +05304211 ipa3_ctx->q6_proxy_clk_vote_cnt++;
Amir Levy9659e592016-10-27 18:08:27 +03004212 ipa3_ctx->q6_proxy_clk_vote_valid = true;
4213 }
Skylar Changfb792c62017-08-17 12:53:23 -07004214 mutex_unlock(&ipa3_ctx->q6_proxy_clk_vote_mutex);
Amir Levy9659e592016-10-27 18:08:27 +03004215}
4216
4217/**
4218 * ipa3_get_smem_restr_bytes()- Return IPA smem restricted bytes
4219 *
4220 * Return value: u16 - number of IPA smem restricted bytes
4221 */
4222u16 ipa3_get_smem_restr_bytes(void)
4223{
4224 if (ipa3_ctx)
4225 return ipa3_ctx->smem_restricted_bytes;
4226
4227 IPAERR("IPA Driver not initialized\n");
4228
4229 return 0;
4230}
4231
4232/**
4233 * ipa3_get_modem_cfg_emb_pipe_flt()- Return ipa3_ctx->modem_cfg_emb_pipe_flt
4234 *
4235 * Return value: true if modem configures embedded pipe flt, false otherwise
4236 */
4237bool ipa3_get_modem_cfg_emb_pipe_flt(void)
4238{
4239 if (ipa3_ctx)
4240 return ipa3_ctx->modem_cfg_emb_pipe_flt;
4241
4242 IPAERR("IPA driver has not been initialized\n");
4243
4244 return false;
4245}
4246
4247/**
Amir Levya59ed3f2017-03-05 17:30:55 +02004248 * ipa3_get_transport_type()
Amir Levy9659e592016-10-27 18:08:27 +03004249 *
4250 * Return value: enum ipa_transport_type
4251 */
4252enum ipa_transport_type ipa3_get_transport_type(void)
4253{
Amir Levy9659e592016-10-27 18:08:27 +03004254 return IPA_TRANSPORT_TYPE_GSI;
4255}
4256
4257u32 ipa3_get_num_pipes(void)
4258{
4259 return ipahal_read_reg(IPA_ENABLED_PIPES);
4260}
4261
4262/**
4263 * ipa3_disable_apps_wan_cons_deaggr()-
4264 * set ipa_ctx->ipa_client_apps_wan_cons_agg_gro
4265 *
4266 * Return value: 0 or negative in case of failure
4267 */
4268int ipa3_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
4269{
4270 int res = -1;
4271 u32 limit;
4272
4273 /* checking if IPA-HW can support */
4274 limit = ipahal_aggr_get_max_byte_limit();
4275 if ((agg_size >> 10) > limit) {
4276 IPAERR("IPA-AGG byte limit %d\n", limit);
4277 IPAERR("exceed aggr_byte_limit\n");
4278 return res;
4279 }
4280 limit = ipahal_aggr_get_max_pkt_limit();
4281 if (agg_count > limit) {
4282 IPAERR("IPA-AGG pkt limit %d\n", limit);
4283 IPAERR("exceed aggr_pkt_limit\n");
4284 return res;
4285 }
4286
4287 if (ipa3_ctx) {
4288 ipa3_ctx->ipa_client_apps_wan_cons_agg_gro = true;
4289 return 0;
4290 }
4291 return res;
4292}
4293
4294static void *ipa3_get_ipc_logbuf(void)
4295{
4296 if (ipa3_ctx)
4297 return ipa3_ctx->logbuf;
4298
4299 return NULL;
4300}
4301
4302static void *ipa3_get_ipc_logbuf_low(void)
4303{
4304 if (ipa3_ctx)
4305 return ipa3_ctx->logbuf_low;
4306
4307 return NULL;
4308}
4309
4310static void ipa3_get_holb(int ep_idx, struct ipa_ep_cfg_holb *holb)
4311{
4312 *holb = ipa3_ctx->ep[ep_idx].holb;
4313}
4314
4315static void ipa3_set_tag_process_before_gating(bool val)
4316{
4317 ipa3_ctx->tag_process_before_gating = val;
4318}
4319
Amir Levy2da9d452017-12-12 10:09:46 +02004320/**
4321 * ipa3_is_vlan_mode - check if a LAN driver should load in VLAN mode
4322 * @iface - type of vlan capable device
4323 * @res - query result: true for vlan mode, false for non vlan mode
4324 *
4325 * API must be called after ipa_is_ready() returns true, otherwise it will fail
4326 *
4327 * Returns: 0 on success, negative on failure
4328 */
4329static int ipa3_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res)
4330{
4331 if (!res) {
4332 IPAERR("NULL out param\n");
4333 return -EINVAL;
4334 }
4335
4336 if (iface < 0 || iface > IPA_VLAN_IF_MAX) {
4337 IPAERR("invalid iface %d\n", iface);
4338 return -EINVAL;
4339 }
4340
4341 if (!ipa3_is_ready()) {
4342 IPAERR("IPA is not ready yet\n");
4343 return -ENODEV;
4344 }
4345
4346 *res = ipa3_ctx->vlan_mode_iface[iface];
4347
4348 IPADBG("Driver %d vlan mode is %d\n", iface, *res);
4349 return 0;
4350}
4351
Amir Levy9659e592016-10-27 18:08:27 +03004352int ipa3_bind_api_controller(enum ipa_hw_type ipa_hw_type,
4353 struct ipa_api_controller *api_ctrl)
4354{
4355 if (ipa_hw_type < IPA_HW_v3_0) {
4356 IPAERR("Unsupported IPA HW version %d\n", ipa_hw_type);
4357 WARN_ON(1);
4358 return -EPERM;
4359 }
4360
Amir Levya59ed3f2017-03-05 17:30:55 +02004361 api_ctrl->ipa_connect = NULL;
4362 api_ctrl->ipa_disconnect = NULL;
4363 api_ctrl->ipa_reset_endpoint = NULL;
Amir Levy9659e592016-10-27 18:08:27 +03004364 api_ctrl->ipa_clear_endpoint_delay = ipa3_clear_endpoint_delay;
4365 api_ctrl->ipa_disable_endpoint = NULL;
4366 api_ctrl->ipa_cfg_ep = ipa3_cfg_ep;
4367 api_ctrl->ipa_cfg_ep_nat = ipa3_cfg_ep_nat;
Amir Levydc65f4c2017-07-06 09:49:50 +03004368 api_ctrl->ipa_cfg_ep_conn_track = ipa3_cfg_ep_conn_track;
Amir Levy9659e592016-10-27 18:08:27 +03004369 api_ctrl->ipa_cfg_ep_hdr = ipa3_cfg_ep_hdr;
4370 api_ctrl->ipa_cfg_ep_hdr_ext = ipa3_cfg_ep_hdr_ext;
4371 api_ctrl->ipa_cfg_ep_mode = ipa3_cfg_ep_mode;
4372 api_ctrl->ipa_cfg_ep_aggr = ipa3_cfg_ep_aggr;
4373 api_ctrl->ipa_cfg_ep_deaggr = ipa3_cfg_ep_deaggr;
4374 api_ctrl->ipa_cfg_ep_route = ipa3_cfg_ep_route;
4375 api_ctrl->ipa_cfg_ep_holb = ipa3_cfg_ep_holb;
4376 api_ctrl->ipa_get_holb = ipa3_get_holb;
4377 api_ctrl->ipa_set_tag_process_before_gating =
4378 ipa3_set_tag_process_before_gating;
4379 api_ctrl->ipa_cfg_ep_cfg = ipa3_cfg_ep_cfg;
4380 api_ctrl->ipa_cfg_ep_metadata_mask = ipa3_cfg_ep_metadata_mask;
4381 api_ctrl->ipa_cfg_ep_holb_by_client = ipa3_cfg_ep_holb_by_client;
4382 api_ctrl->ipa_cfg_ep_ctrl = ipa3_cfg_ep_ctrl;
4383 api_ctrl->ipa_add_hdr = ipa3_add_hdr;
4384 api_ctrl->ipa_del_hdr = ipa3_del_hdr;
4385 api_ctrl->ipa_commit_hdr = ipa3_commit_hdr;
4386 api_ctrl->ipa_reset_hdr = ipa3_reset_hdr;
4387 api_ctrl->ipa_get_hdr = ipa3_get_hdr;
4388 api_ctrl->ipa_put_hdr = ipa3_put_hdr;
4389 api_ctrl->ipa_copy_hdr = ipa3_copy_hdr;
4390 api_ctrl->ipa_add_hdr_proc_ctx = ipa3_add_hdr_proc_ctx;
4391 api_ctrl->ipa_del_hdr_proc_ctx = ipa3_del_hdr_proc_ctx;
4392 api_ctrl->ipa_add_rt_rule = ipa3_add_rt_rule;
4393 api_ctrl->ipa_del_rt_rule = ipa3_del_rt_rule;
4394 api_ctrl->ipa_commit_rt = ipa3_commit_rt;
4395 api_ctrl->ipa_reset_rt = ipa3_reset_rt;
4396 api_ctrl->ipa_get_rt_tbl = ipa3_get_rt_tbl;
4397 api_ctrl->ipa_put_rt_tbl = ipa3_put_rt_tbl;
4398 api_ctrl->ipa_query_rt_index = ipa3_query_rt_index;
4399 api_ctrl->ipa_mdfy_rt_rule = ipa3_mdfy_rt_rule;
4400 api_ctrl->ipa_add_flt_rule = ipa3_add_flt_rule;
4401 api_ctrl->ipa_del_flt_rule = ipa3_del_flt_rule;
4402 api_ctrl->ipa_mdfy_flt_rule = ipa3_mdfy_flt_rule;
4403 api_ctrl->ipa_commit_flt = ipa3_commit_flt;
4404 api_ctrl->ipa_reset_flt = ipa3_reset_flt;
Amir Levy479cfdd2017-10-26 12:23:14 +03004405 api_ctrl->ipa_allocate_nat_device = ipa3_allocate_nat_device;
4406 api_ctrl->ipa_allocate_nat_table = ipa3_allocate_nat_table;
4407 api_ctrl->ipa_allocate_ipv6ct_table = ipa3_allocate_ipv6ct_table;
Amir Levy9659e592016-10-27 18:08:27 +03004408 api_ctrl->ipa_nat_init_cmd = ipa3_nat_init_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004409 api_ctrl->ipa_ipv6ct_init_cmd = ipa3_ipv6ct_init_cmd;
Amir Levy9659e592016-10-27 18:08:27 +03004410 api_ctrl->ipa_nat_dma_cmd = ipa3_nat_dma_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004411 api_ctrl->ipa_table_dma_cmd = ipa3_table_dma_cmd;
Amir Levy9659e592016-10-27 18:08:27 +03004412 api_ctrl->ipa_nat_del_cmd = ipa3_nat_del_cmd;
Amir Levy479cfdd2017-10-26 12:23:14 +03004413 api_ctrl->ipa_del_nat_table = ipa3_del_nat_table;
4414 api_ctrl->ipa_del_ipv6ct_table = ipa3_del_ipv6ct_table;
4415 api_ctrl->ipa_nat_mdfy_pdn = ipa3_nat_mdfy_pdn;
Amir Levy9659e592016-10-27 18:08:27 +03004416 api_ctrl->ipa_send_msg = ipa3_send_msg;
4417 api_ctrl->ipa_register_pull_msg = ipa3_register_pull_msg;
4418 api_ctrl->ipa_deregister_pull_msg = ipa3_deregister_pull_msg;
4419 api_ctrl->ipa_register_intf = ipa3_register_intf;
4420 api_ctrl->ipa_register_intf_ext = ipa3_register_intf_ext;
4421 api_ctrl->ipa_deregister_intf = ipa3_deregister_intf;
4422 api_ctrl->ipa_set_aggr_mode = ipa3_set_aggr_mode;
4423 api_ctrl->ipa_set_qcncm_ndp_sig = ipa3_set_qcncm_ndp_sig;
4424 api_ctrl->ipa_set_single_ndp_per_mbim = ipa3_set_single_ndp_per_mbim;
4425 api_ctrl->ipa_tx_dp = ipa3_tx_dp;
4426 api_ctrl->ipa_tx_dp_mul = ipa3_tx_dp_mul;
4427 api_ctrl->ipa_free_skb = ipa3_free_skb;
4428 api_ctrl->ipa_setup_sys_pipe = ipa3_setup_sys_pipe;
4429 api_ctrl->ipa_teardown_sys_pipe = ipa3_teardown_sys_pipe;
4430 api_ctrl->ipa_sys_setup = ipa3_sys_setup;
4431 api_ctrl->ipa_sys_teardown = ipa3_sys_teardown;
4432 api_ctrl->ipa_sys_update_gsi_hdls = ipa3_sys_update_gsi_hdls;
4433 api_ctrl->ipa_connect_wdi_pipe = ipa3_connect_wdi_pipe;
4434 api_ctrl->ipa_disconnect_wdi_pipe = ipa3_disconnect_wdi_pipe;
4435 api_ctrl->ipa_enable_wdi_pipe = ipa3_enable_wdi_pipe;
4436 api_ctrl->ipa_disable_wdi_pipe = ipa3_disable_wdi_pipe;
4437 api_ctrl->ipa_resume_wdi_pipe = ipa3_resume_wdi_pipe;
4438 api_ctrl->ipa_suspend_wdi_pipe = ipa3_suspend_wdi_pipe;
4439 api_ctrl->ipa_get_wdi_stats = ipa3_get_wdi_stats;
4440 api_ctrl->ipa_get_smem_restr_bytes = ipa3_get_smem_restr_bytes;
Skylar Chang6b41f8d2016-11-01 12:50:11 -07004441 api_ctrl->ipa_broadcast_wdi_quota_reach_ind =
4442 ipa3_broadcast_wdi_quota_reach_ind;
Amir Levy9659e592016-10-27 18:08:27 +03004443 api_ctrl->ipa_uc_wdi_get_dbpa = ipa3_uc_wdi_get_dbpa;
4444 api_ctrl->ipa_uc_reg_rdyCB = ipa3_uc_reg_rdyCB;
4445 api_ctrl->ipa_uc_dereg_rdyCB = ipa3_uc_dereg_rdyCB;
4446 api_ctrl->teth_bridge_init = ipa3_teth_bridge_init;
4447 api_ctrl->teth_bridge_disconnect = ipa3_teth_bridge_disconnect;
4448 api_ctrl->teth_bridge_connect = ipa3_teth_bridge_connect;
4449 api_ctrl->ipa_set_client = ipa3_set_client;
4450 api_ctrl->ipa_get_client = ipa3_get_client;
4451 api_ctrl->ipa_get_client_uplink = ipa3_get_client_uplink;
4452 api_ctrl->ipa_dma_init = ipa3_dma_init;
4453 api_ctrl->ipa_dma_enable = ipa3_dma_enable;
4454 api_ctrl->ipa_dma_disable = ipa3_dma_disable;
4455 api_ctrl->ipa_dma_sync_memcpy = ipa3_dma_sync_memcpy;
4456 api_ctrl->ipa_dma_async_memcpy = ipa3_dma_async_memcpy;
4457 api_ctrl->ipa_dma_uc_memcpy = ipa3_dma_uc_memcpy;
4458 api_ctrl->ipa_dma_destroy = ipa3_dma_destroy;
4459 api_ctrl->ipa_mhi_init_engine = ipa3_mhi_init_engine;
4460 api_ctrl->ipa_connect_mhi_pipe = ipa3_connect_mhi_pipe;
4461 api_ctrl->ipa_disconnect_mhi_pipe = ipa3_disconnect_mhi_pipe;
4462 api_ctrl->ipa_mhi_stop_gsi_channel = ipa3_mhi_stop_gsi_channel;
4463 api_ctrl->ipa_uc_mhi_reset_channel = ipa3_uc_mhi_reset_channel;
4464 api_ctrl->ipa_qmi_enable_force_clear_datapath_send =
4465 ipa3_qmi_enable_force_clear_datapath_send;
4466 api_ctrl->ipa_qmi_disable_force_clear_datapath_send =
4467 ipa3_qmi_disable_force_clear_datapath_send;
4468 api_ctrl->ipa_mhi_reset_channel_internal =
4469 ipa3_mhi_reset_channel_internal;
4470 api_ctrl->ipa_mhi_start_channel_internal =
4471 ipa3_mhi_start_channel_internal;
4472 api_ctrl->ipa_mhi_query_ch_info = ipa3_mhi_query_ch_info;
4473 api_ctrl->ipa_mhi_resume_channels_internal =
4474 ipa3_mhi_resume_channels_internal;
4475 api_ctrl->ipa_has_open_aggr_frame = ipa3_has_open_aggr_frame;
4476 api_ctrl->ipa_mhi_destroy_channel = ipa3_mhi_destroy_channel;
4477 api_ctrl->ipa_uc_mhi_send_dl_ul_sync_info =
4478 ipa3_uc_mhi_send_dl_ul_sync_info;
4479 api_ctrl->ipa_uc_mhi_init = ipa3_uc_mhi_init;
4480 api_ctrl->ipa_uc_mhi_suspend_channel = ipa3_uc_mhi_suspend_channel;
4481 api_ctrl->ipa_uc_mhi_stop_event_update_channel =
4482 ipa3_uc_mhi_stop_event_update_channel;
4483 api_ctrl->ipa_uc_mhi_cleanup = ipa3_uc_mhi_cleanup;
4484 api_ctrl->ipa_uc_state_check = ipa3_uc_state_check;
4485 api_ctrl->ipa_write_qmap_id = ipa3_write_qmap_id;
4486 api_ctrl->ipa_add_interrupt_handler = ipa3_add_interrupt_handler;
4487 api_ctrl->ipa_remove_interrupt_handler = ipa3_remove_interrupt_handler;
4488 api_ctrl->ipa_restore_suspend_handler = ipa3_restore_suspend_handler;
Amir Levya59ed3f2017-03-05 17:30:55 +02004489 api_ctrl->ipa_bam_reg_dump = NULL;
Amir Levy9659e592016-10-27 18:08:27 +03004490 api_ctrl->ipa_get_ep_mapping = ipa3_get_ep_mapping;
4491 api_ctrl->ipa_is_ready = ipa3_is_ready;
4492 api_ctrl->ipa_proxy_clk_vote = ipa3_proxy_clk_vote;
4493 api_ctrl->ipa_proxy_clk_unvote = ipa3_proxy_clk_unvote;
4494 api_ctrl->ipa_is_client_handle_valid = ipa3_is_client_handle_valid;
4495 api_ctrl->ipa_get_client_mapping = ipa3_get_client_mapping;
4496 api_ctrl->ipa_get_rm_resource_from_ep = ipa3_get_rm_resource_from_ep;
4497 api_ctrl->ipa_get_modem_cfg_emb_pipe_flt =
4498 ipa3_get_modem_cfg_emb_pipe_flt;
4499 api_ctrl->ipa_get_transport_type = ipa3_get_transport_type;
4500 api_ctrl->ipa_ap_suspend = ipa3_ap_suspend;
4501 api_ctrl->ipa_ap_resume = ipa3_ap_resume;
4502 api_ctrl->ipa_get_smmu_domain = ipa3_get_smmu_domain;
4503 api_ctrl->ipa_disable_apps_wan_cons_deaggr =
4504 ipa3_disable_apps_wan_cons_deaggr;
4505 api_ctrl->ipa_get_dma_dev = ipa3_get_dma_dev;
4506 api_ctrl->ipa_release_wdi_mapping = ipa3_release_wdi_mapping;
4507 api_ctrl->ipa_create_wdi_mapping = ipa3_create_wdi_mapping;
4508 api_ctrl->ipa_get_gsi_ep_info = ipa3_get_gsi_ep_info;
4509 api_ctrl->ipa_stop_gsi_channel = ipa3_stop_gsi_channel;
Skylar Chang9fbce062017-07-25 16:20:42 -07004510 api_ctrl->ipa_start_gsi_channel = ipa3_start_gsi_channel;
Amir Levy9659e592016-10-27 18:08:27 +03004511 api_ctrl->ipa_register_ipa_ready_cb = ipa3_register_ipa_ready_cb;
4512 api_ctrl->ipa_inc_client_enable_clks = ipa3_inc_client_enable_clks;
4513 api_ctrl->ipa_dec_client_disable_clks = ipa3_dec_client_disable_clks;
4514 api_ctrl->ipa_inc_client_enable_clks_no_block =
4515 ipa3_inc_client_enable_clks_no_block;
4516 api_ctrl->ipa_suspend_resource_no_block =
4517 ipa3_suspend_resource_no_block;
4518 api_ctrl->ipa_resume_resource = ipa3_resume_resource;
4519 api_ctrl->ipa_suspend_resource_sync = ipa3_suspend_resource_sync;
4520 api_ctrl->ipa_set_required_perf_profile =
4521 ipa3_set_required_perf_profile;
4522 api_ctrl->ipa_get_ipc_logbuf = ipa3_get_ipc_logbuf;
4523 api_ctrl->ipa_get_ipc_logbuf_low = ipa3_get_ipc_logbuf_low;
4524 api_ctrl->ipa_rx_poll = ipa3_rx_poll;
4525 api_ctrl->ipa_recycle_wan_skb = ipa3_recycle_wan_skb;
4526 api_ctrl->ipa_setup_uc_ntn_pipes = ipa3_setup_uc_ntn_pipes;
4527 api_ctrl->ipa_tear_down_uc_offload_pipes =
4528 ipa3_tear_down_uc_offload_pipes;
Amir Levyc4222c92016-11-07 16:14:54 +02004529 api_ctrl->ipa_get_pdev = ipa3_get_pdev;
Sunil Paidimarrifbbcd072017-04-04 17:43:50 -07004530 api_ctrl->ipa_ntn_uc_reg_rdyCB = ipa3_ntn_uc_reg_rdyCB;
4531 api_ctrl->ipa_ntn_uc_dereg_rdyCB = ipa3_ntn_uc_dereg_rdyCB;
Skylar Chang852379b2016-12-13 14:00:19 -08004532 api_ctrl->ipa_conn_wdi3_pipes = ipa3_conn_wdi3_pipes;
4533 api_ctrl->ipa_disconn_wdi3_pipes = ipa3_disconn_wdi3_pipes;
4534 api_ctrl->ipa_enable_wdi3_pipes = ipa3_enable_wdi3_pipes;
4535 api_ctrl->ipa_disable_wdi3_pipes = ipa3_disable_wdi3_pipes;
Skylar Chang48afa052017-10-25 09:32:57 -07004536 api_ctrl->ipa_tz_unlock_reg = ipa3_tz_unlock_reg;
Michael Adisumartad04e6d62017-11-09 17:46:35 -08004537 api_ctrl->ipa_get_smmu_params = ipa3_get_smmu_params;
Amir Levy2da9d452017-12-12 10:09:46 +02004538 api_ctrl->ipa_is_vlan_mode = ipa3_is_vlan_mode;
Amir Levy9659e592016-10-27 18:08:27 +03004539
4540 return 0;
4541}
4542
4543/**
4544 * ipa_is_modem_pipe()- Checks if pipe is owned by the modem
4545 *
4546 * @pipe_idx: pipe number
4547 * Return value: true if owned by modem, false otherwize
4548 */
4549bool ipa_is_modem_pipe(int pipe_idx)
4550{
4551 int client_idx;
4552
4553 if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) {
4554 IPAERR("Bad pipe index!\n");
4555 return false;
4556 }
4557
4558 for (client_idx = 0; client_idx < IPA_CLIENT_MAX; client_idx++) {
4559 if (!IPA_CLIENT_IS_Q6_CONS(client_idx) &&
4560 !IPA_CLIENT_IS_Q6_PROD(client_idx))
4561 continue;
4562 if (ipa3_get_ep_mapping(client_idx) == pipe_idx)
4563 return true;
4564 }
4565
4566 return false;
4567}
4568
4569static void ipa3_write_rsrc_grp_type_reg(int group_index,
4570 enum ipa_rsrc_grp_type_src n, bool src,
4571 struct ipahal_reg_rsrc_grp_cfg *val) {
Amir Levy0f97a5c2016-11-22 11:13:37 +02004572 u8 hw_type_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004573
Amir Levy0f97a5c2016-11-22 11:13:37 +02004574 hw_type_idx = ipa3_get_hw_type_index();
4575
4576 switch (hw_type_idx) {
4577 case IPA_3_0:
4578 if (src) {
4579 switch (group_index) {
4580 case IPA_v3_0_GROUP_UL:
4581 case IPA_v3_0_GROUP_DL:
4582 ipahal_write_reg_n_fields(
4583 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4584 n, val);
4585 break;
4586 case IPA_v3_0_GROUP_DIAG:
4587 case IPA_v3_0_GROUP_DMA:
4588 ipahal_write_reg_n_fields(
4589 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4590 n, val);
4591 break;
4592 case IPA_v3_0_GROUP_Q6ZIP:
4593 case IPA_v3_0_GROUP_UC_RX_Q:
4594 ipahal_write_reg_n_fields(
4595 IPA_SRC_RSRC_GRP_45_RSRC_TYPE_n,
4596 n, val);
4597 break;
4598 default:
4599 IPAERR(
4600 " Invalid source resource group,index #%d\n",
4601 group_index);
4602 break;
4603 }
4604 } else {
4605 switch (group_index) {
4606 case IPA_v3_0_GROUP_UL:
4607 case IPA_v3_0_GROUP_DL:
4608 ipahal_write_reg_n_fields(
4609 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4610 n, val);
4611 break;
4612 case IPA_v3_0_GROUP_DIAG:
4613 case IPA_v3_0_GROUP_DMA:
4614 ipahal_write_reg_n_fields(
4615 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4616 n, val);
4617 break;
4618 case IPA_v3_0_GROUP_Q6ZIP_GENERAL:
4619 case IPA_v3_0_GROUP_Q6ZIP_ENGINE:
4620 ipahal_write_reg_n_fields(
4621 IPA_DST_RSRC_GRP_45_RSRC_TYPE_n,
4622 n, val);
4623 break;
4624 default:
4625 IPAERR(
4626 " Invalid destination resource group,index #%d\n",
4627 group_index);
4628 break;
4629 }
Amir Levy9659e592016-10-27 18:08:27 +03004630 }
Amir Levy0f97a5c2016-11-22 11:13:37 +02004631 break;
Amir Levy3a59dbd2017-03-15 14:30:54 +02004632 case IPA_3_5:
Amir Levy54fe4d32017-03-16 11:21:49 +02004633 case IPA_3_5_MHI:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004634 case IPA_3_5_1:
4635 if (src) {
4636 switch (group_index) {
Amir Levy3be373c2017-03-05 16:31:30 +02004637 case IPA_v3_5_GROUP_LWA_DL:
4638 case IPA_v3_5_GROUP_UL_DL:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004639 ipahal_write_reg_n_fields(
4640 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4641 n, val);
4642 break;
Amir Levy54fe4d32017-03-16 11:21:49 +02004643 case IPA_v3_5_MHI_GROUP_DMA:
Amir Levy3be373c2017-03-05 16:31:30 +02004644 case IPA_v3_5_GROUP_UC_RX_Q:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004645 ipahal_write_reg_n_fields(
4646 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4647 n, val);
4648 break;
4649 default:
4650 IPAERR(
4651 " Invalid source resource group,index #%d\n",
4652 group_index);
4653 break;
4654 }
4655 } else {
4656 switch (group_index) {
Amir Levy3be373c2017-03-05 16:31:30 +02004657 case IPA_v3_5_GROUP_LWA_DL:
4658 case IPA_v3_5_GROUP_UL_DL:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004659 ipahal_write_reg_n_fields(
4660 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4661 n, val);
4662 break;
Amir Levy54fe4d32017-03-16 11:21:49 +02004663 case IPA_v3_5_MHI_GROUP_DMA:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004664 ipahal_write_reg_n_fields(
4665 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4666 n, val);
4667 break;
4668 default:
4669 IPAERR(
4670 " Invalid destination resource group,index #%d\n",
4671 group_index);
4672 break;
4673 }
Amir Levy9659e592016-10-27 18:08:27 +03004674 }
Amir Levy0f97a5c2016-11-22 11:13:37 +02004675 break;
Michael Adisumarta539339d2017-05-16 14:18:23 -07004676 case IPA_4_0:
4677 case IPA_4_0_MHI:
4678 if (src) {
4679 switch (group_index) {
4680 case IPA_v4_0_GROUP_LWA_DL:
4681 case IPA_v4_0_GROUP_UL_DL:
4682 ipahal_write_reg_n_fields(
4683 IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n,
4684 n, val);
4685 break;
4686 case IPA_v4_0_MHI_GROUP_DMA:
4687 case IPA_v4_0_GROUP_UC_RX_Q:
4688 ipahal_write_reg_n_fields(
4689 IPA_SRC_RSRC_GRP_23_RSRC_TYPE_n,
4690 n, val);
4691 break;
4692 default:
4693 IPAERR(
4694 " Invalid source resource group,index #%d\n",
4695 group_index);
4696 break;
4697 }
4698 } else {
4699 switch (group_index) {
4700 case IPA_v4_0_GROUP_LWA_DL:
4701 case IPA_v4_0_GROUP_UL_DL:
4702 ipahal_write_reg_n_fields(
4703 IPA_DST_RSRC_GRP_01_RSRC_TYPE_n,
4704 n, val);
4705 break;
4706 case IPA_v4_0_MHI_GROUP_DMA:
4707 ipahal_write_reg_n_fields(
4708 IPA_DST_RSRC_GRP_23_RSRC_TYPE_n,
4709 n, val);
4710 break;
4711 default:
4712 IPAERR(
4713 " Invalid destination resource group,index #%d\n",
4714 group_index);
4715 break;
4716 }
4717 }
4718 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004719 default:
4720 IPAERR("invalid hw type\n");
4721 WARN_ON(1);
4722 return;
Amir Levy9659e592016-10-27 18:08:27 +03004723 }
4724}
4725
4726static void ipa3_configure_rx_hps_clients(int depth, bool min)
4727{
4728 int i;
4729 struct ipahal_reg_rx_hps_clients val;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004730 u8 hw_type_idx;
4731
4732 hw_type_idx = ipa3_get_hw_type_index();
Amir Levy9659e592016-10-27 18:08:27 +03004733
4734 /*
4735 * depth 0 contains 4 first clients out of 6
4736 * depth 1 contains 2 last clients out of 6
4737 */
4738 for (i = 0 ; i < (depth ? 2 : 4) ; i++) {
4739 if (min)
4740 val.client_minmax[i] =
4741 ipa3_rsrc_rx_grp_config
Amir Levy0f97a5c2016-11-22 11:13:37 +02004742 [hw_type_idx]
Amir Levy9659e592016-10-27 18:08:27 +03004743 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
4744 [!depth ? i : 4 + i].min;
4745 else
4746 val.client_minmax[i] =
4747 ipa3_rsrc_rx_grp_config
Amir Levy0f97a5c2016-11-22 11:13:37 +02004748 [hw_type_idx]
Amir Levy9659e592016-10-27 18:08:27 +03004749 [IPA_RSRC_GRP_TYPE_RX_HPS_CMDQ]
4750 [!depth ? i : 4 + i].max;
4751 }
4752 if (depth) {
4753 ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_1 :
4754 IPA_RX_HPS_CLIENTS_MAX_DEPTH_1,
4755 &val);
4756 } else {
4757 ipahal_write_reg_fields(min ? IPA_RX_HPS_CLIENTS_MIN_DEPTH_0 :
4758 IPA_RX_HPS_CLIENTS_MAX_DEPTH_0,
4759 &val);
4760 }
4761}
4762
Michael Adisumarta539339d2017-05-16 14:18:23 -07004763static void ipa3_configure_rx_hps_weight(void)
4764{
4765 struct ipahal_reg_rx_hps_weights val;
4766 u8 hw_type_idx;
4767
4768 hw_type_idx = ipa3_get_hw_type_index();
4769
4770 val.hps_queue_weight_0 =
4771 ipa3_rsrc_rx_grp_hps_weight_config
4772 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4773 [0];
4774 val.hps_queue_weight_1 =
4775 ipa3_rsrc_rx_grp_hps_weight_config
4776 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4777 [1];
4778 val.hps_queue_weight_2 =
4779 ipa3_rsrc_rx_grp_hps_weight_config
4780 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4781 [2];
4782 val.hps_queue_weight_3 =
4783 ipa3_rsrc_rx_grp_hps_weight_config
4784 [hw_type_idx][IPA_RSRC_GRP_TYPE_RX_HPS_WEIGHT_CONFIG]
4785 [3];
4786
4787 ipahal_write_reg_fields(IPA_HPS_FTCH_ARB_QUEUE_WEIGHT, &val);
4788}
4789
Amir Levy9659e592016-10-27 18:08:27 +03004790void ipa3_set_resorce_groups_min_max_limits(void)
4791{
4792 int i;
4793 int j;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004794 int src_rsrc_type_max;
4795 int dst_rsrc_type_max;
4796 int src_grp_idx_max;
4797 int dst_grp_idx_max;
Amir Levy9659e592016-10-27 18:08:27 +03004798 struct ipahal_reg_rsrc_grp_cfg val;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004799 u8 hw_type_idx;
Amir Levy9659e592016-10-27 18:08:27 +03004800
4801 IPADBG("ENTER\n");
4802 IPADBG("Assign source rsrc groups min-max limits\n");
4803
Amir Levy0f97a5c2016-11-22 11:13:37 +02004804 hw_type_idx = ipa3_get_hw_type_index();
4805 switch (hw_type_idx) {
4806 case IPA_3_0:
4807 src_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_SRC_MAX;
4808 dst_rsrc_type_max = IPA_v3_0_RSRC_GRP_TYPE_DST_MAX;
4809 src_grp_idx_max = IPA_v3_0_GROUP_MAX;
4810 dst_grp_idx_max = IPA_v3_0_GROUP_MAX;
4811 break;
Amir Levy3a59dbd2017-03-15 14:30:54 +02004812 case IPA_3_5:
Amir Levy54fe4d32017-03-16 11:21:49 +02004813 case IPA_3_5_MHI:
Amir Levy0f97a5c2016-11-22 11:13:37 +02004814 case IPA_3_5_1:
Amir Levy3be373c2017-03-05 16:31:30 +02004815 src_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_SRC_MAX;
4816 dst_rsrc_type_max = IPA_v3_5_RSRC_GRP_TYPE_DST_MAX;
4817 src_grp_idx_max = IPA_v3_5_SRC_GROUP_MAX;
4818 dst_grp_idx_max = IPA_v3_5_DST_GROUP_MAX;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004819 break;
Michael Adisumarta539339d2017-05-16 14:18:23 -07004820 case IPA_4_0:
4821 case IPA_4_0_MHI:
4822 src_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_SRC_MAX;
4823 dst_rsrc_type_max = IPA_v4_0_RSRC_GRP_TYPE_DST_MAX;
4824 src_grp_idx_max = IPA_v4_0_SRC_GROUP_MAX;
4825 dst_grp_idx_max = IPA_v4_0_DST_GROUP_MAX;
4826 break;
Amir Levy0f97a5c2016-11-22 11:13:37 +02004827 default:
4828 IPAERR("invalid hw type index\n");
4829 WARN_ON(1);
4830 return;
4831 }
4832
4833 for (i = 0; i < src_rsrc_type_max; i++) {
4834 for (j = 0; j < src_grp_idx_max; j = j + 2) {
4835 val.x_min =
4836 ipa3_rsrc_src_grp_config[hw_type_idx][i][j].min;
4837 val.x_max =
4838 ipa3_rsrc_src_grp_config[hw_type_idx][i][j].max;
4839 val.y_min =
4840 ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].min;
4841 val.y_max =
4842 ipa3_rsrc_src_grp_config[hw_type_idx][i][j + 1].max;
Amir Levy9659e592016-10-27 18:08:27 +03004843 ipa3_write_rsrc_grp_type_reg(j, i, true, &val);
4844 }
4845 }
4846
4847 IPADBG("Assign destination rsrc groups min-max limits\n");
4848
Amir Levy0f97a5c2016-11-22 11:13:37 +02004849 for (i = 0; i < dst_rsrc_type_max; i++) {
4850 for (j = 0; j < dst_grp_idx_max; j = j + 2) {
4851 val.x_min =
4852 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].min;
4853 val.x_max =
4854 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j].max;
4855 val.y_min =
4856 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].min;
4857 val.y_max =
4858 ipa3_rsrc_dst_grp_config[hw_type_idx][i][j + 1].max;
Amir Levy9659e592016-10-27 18:08:27 +03004859 ipa3_write_rsrc_grp_type_reg(j, i, false, &val);
4860 }
4861 }
4862
4863 /* move resource group configuration from HLOS to TZ */
4864 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_1) {
4865 IPAERR("skip configuring ipa_rx_hps_clients from HLOS\n");
4866 return;
4867 }
4868
4869 IPADBG("Assign RX_HPS CMDQ rsrc groups min-max limits\n");
4870
4871 ipa3_configure_rx_hps_clients(0, true);
Amir Levy9659e592016-10-27 18:08:27 +03004872 ipa3_configure_rx_hps_clients(0, false);
Amir Levy0f97a5c2016-11-22 11:13:37 +02004873
4874 /* only hw_type v3_0\3_1 have 6 RX_HPS_CMDQ and needs depth 1*/
4875 if (ipa3_ctx->ipa_hw_type <= IPA_HW_v3_1) {
4876 ipa3_configure_rx_hps_clients(1, true);
4877 ipa3_configure_rx_hps_clients(1, false);
4878 }
Amir Levy9659e592016-10-27 18:08:27 +03004879
Michael Adisumarta539339d2017-05-16 14:18:23 -07004880 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5)
4881 ipa3_configure_rx_hps_weight();
4882
Amir Levy9659e592016-10-27 18:08:27 +03004883 IPADBG("EXIT\n");
4884}
4885
4886static void ipa3_gsi_poll_after_suspend(struct ipa3_ep_context *ep)
4887{
4888 bool empty;
4889
4890 IPADBG("switch ch %ld to poll\n", ep->gsi_chan_hdl);
4891 gsi_config_channel_mode(ep->gsi_chan_hdl, GSI_CHAN_MODE_POLL);
4892 gsi_is_channel_empty(ep->gsi_chan_hdl, &empty);
4893 if (!empty) {
4894 IPADBG("ch %ld not empty\n", ep->gsi_chan_hdl);
4895 /* queue a work to start polling if don't have one */
4896 atomic_set(&ipa3_ctx->transport_pm.eot_activity, 1);
Michael Adisumarta3e350812017-09-18 14:54:36 -07004897 if (!atomic_read(&ep->sys->curr_polling_state))
4898 __ipa_gsi_irq_rx_scedule_poll(ep->sys);
Amir Levy9659e592016-10-27 18:08:27 +03004899 }
4900}
4901
Michael Adisumarta181b7e52017-12-11 12:38:09 -08004902static int __ipa3_stop_gsi_channel(u32 clnt_hdl)
4903{
4904 struct ipa_mem_buffer mem;
4905 int res = 0;
4906 int i;
4907 struct ipa3_ep_context *ep;
4908
4909 if (clnt_hdl >= ipa3_ctx->ipa_num_pipes ||
4910 ipa3_ctx->ep[clnt_hdl].valid == 0) {
4911 IPAERR("bad parm.\n");
4912 return -EINVAL;
4913 }
4914
4915 ep = &ipa3_ctx->ep[clnt_hdl];
4916 memset(&mem, 0, sizeof(mem));
4917
4918 if (IPA_CLIENT_IS_PROD(ep->client)) {
4919 IPADBG("Calling gsi_stop_channel ch:%lu\n",
4920 ep->gsi_chan_hdl);
4921 res = gsi_stop_channel(ep->gsi_chan_hdl);
4922 IPADBG("gsi_stop_channel ch: %lu returned %d\n",
4923 ep->gsi_chan_hdl, res);
4924 return res;
4925 }
4926
4927 for (i = 0; i < IPA_GSI_CHANNEL_STOP_MAX_RETRY; i++) {
4928 IPADBG("Calling gsi_stop_channel ch:%lu\n",
4929 ep->gsi_chan_hdl);
4930 res = gsi_stop_channel(ep->gsi_chan_hdl);
4931 IPADBG("gsi_stop_channel ch: %lu returned %d\n",
4932 ep->gsi_chan_hdl, res);
4933 if (res != -GSI_STATUS_AGAIN && res != -GSI_STATUS_TIMED_OUT)
4934 return res;
4935
4936 IPADBG("Inject a DMA_TASK with 1B packet to IPA\n");
4937 /* Send a 1B packet DMA_TASK to IPA and try again */
4938 res = ipa3_inject_dma_task_for_gsi();
4939 if (res) {
4940 IPAERR("Failed to inject DMA TASk for GSI\n");
4941 return res;
4942 }
4943
4944 /* sleep for short period to flush IPA */
4945 usleep_range(IPA_GSI_CHANNEL_STOP_SLEEP_MIN_USEC,
4946 IPA_GSI_CHANNEL_STOP_SLEEP_MAX_USEC);
4947 }
4948
4949 IPAERR("Failed to stop GSI channel with retries\n");
4950 return -EFAULT;
4951}
4952
4953/**
4954 * ipa3_stop_gsi_channel()- Stops a GSI channel in IPA
4955 * @chan_hdl: GSI channel handle
4956 *
4957 * This function implements the sequence to stop a GSI channel
4958 * in IPA. This function returns when the channel is in STOP state.
4959 *
4960 * Return value: 0 on success, negative otherwise
4961 */
4962int ipa3_stop_gsi_channel(u32 clnt_hdl)
4963{
4964 int res;
4965
4966 IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
4967 res = __ipa3_stop_gsi_channel(clnt_hdl);
4968 IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl));
4969
4970 return res;
4971}
4972
Amir Levy9659e592016-10-27 18:08:27 +03004973void ipa3_suspend_apps_pipes(bool suspend)
4974{
4975 struct ipa_ep_cfg_ctrl cfg;
4976 int ipa_ep_idx;
4977 struct ipa3_ep_context *ep;
Skylar Changa699afd2017-06-06 10:06:21 -07004978 int res;
Amir Levy9659e592016-10-27 18:08:27 +03004979
4980 memset(&cfg, 0, sizeof(cfg));
4981 cfg.ipa_ep_suspend = suspend;
4982
4983 ipa_ep_idx = ipa3_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
Ghanim Fodi79ee8d82017-02-27 16:39:25 +02004984 if (ipa_ep_idx < 0) {
4985 IPAERR("IPA client mapping failed\n");
4986 ipa_assert();
4987 return;
4988 }
Amir Levy9659e592016-10-27 18:08:27 +03004989 ep = &ipa3_ctx->ep[ipa_ep_idx];
4990 if (ep->valid) {
4991 IPADBG("%s pipe %d\n", suspend ? "suspend" : "unsuspend",
4992 ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07004993 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
4994 if (suspend) {
Michael Adisumarta181b7e52017-12-11 12:38:09 -08004995 res = __ipa3_stop_gsi_channel(ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07004996 if (res) {
4997 IPAERR("failed to stop LAN channel\n");
4998 ipa_assert();
4999 }
5000 } else {
5001 res = gsi_start_channel(ep->gsi_chan_hdl);
5002 if (res) {
5003 IPAERR("failed to start LAN channel\n");
5004 ipa_assert();
5005 }
5006 }
5007 } else {
5008 ipa3_cfg_ep_ctrl(ipa_ep_idx, &cfg);
5009 }
Amir Levy9659e592016-10-27 18:08:27 +03005010 if (suspend)
5011 ipa3_gsi_poll_after_suspend(ep);
5012 else if (!atomic_read(&ep->sys->curr_polling_state))
5013 gsi_config_channel_mode(ep->gsi_chan_hdl,
5014 GSI_CHAN_MODE_CALLBACK);
5015 }
5016
5017 ipa_ep_idx = ipa_get_ep_mapping(IPA_CLIENT_APPS_WAN_CONS);
5018 /* Considering the case for SSR. */
5019 if (ipa_ep_idx == -1) {
5020 IPADBG("Invalid client.\n");
5021 return;
5022 }
5023 ep = &ipa3_ctx->ep[ipa_ep_idx];
5024 if (ep->valid) {
5025 IPADBG("%s pipe %d\n", suspend ? "suspend" : "unsuspend",
5026 ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07005027 if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0) {
5028 if (suspend) {
Michael Adisumarta181b7e52017-12-11 12:38:09 -08005029 res = __ipa3_stop_gsi_channel(ipa_ep_idx);
Skylar Changa699afd2017-06-06 10:06:21 -07005030 if (res) {
5031 IPAERR("failed to stop WAN channel\n");
5032 ipa_assert();
5033 }
5034 } else {
5035 res = gsi_start_channel(ep->gsi_chan_hdl);
5036 if (res) {
5037 IPAERR("failed to start WAN channel\n");
5038 ipa_assert();
5039 }
5040 }
5041 } else {
5042 ipa3_cfg_ep_ctrl(ipa_ep_idx, &cfg);
5043 }
Amir Levy9659e592016-10-27 18:08:27 +03005044 if (suspend)
5045 ipa3_gsi_poll_after_suspend(ep);
5046 else if (!atomic_read(&ep->sys->curr_polling_state))
5047 gsi_config_channel_mode(ep->gsi_chan_hdl,
5048 GSI_CHAN_MODE_CALLBACK);
5049 }
5050}
5051
Skylar Chang6c4bec92017-04-21 16:10:14 -07005052int ipa3_allocate_dma_task_for_gsi(void)
5053{
5054 struct ipahal_imm_cmd_dma_task_32b_addr cmd = { 0 };
5055
5056 IPADBG("Allocate mem\n");
5057 ipa3_ctx->dma_task_info.mem.size = IPA_GSI_CHANNEL_STOP_PKT_SIZE;
5058 ipa3_ctx->dma_task_info.mem.base = dma_alloc_coherent(ipa3_ctx->pdev,
5059 ipa3_ctx->dma_task_info.mem.size,
5060 &ipa3_ctx->dma_task_info.mem.phys_base,
5061 GFP_KERNEL);
5062 if (!ipa3_ctx->dma_task_info.mem.base) {
5063 IPAERR("no mem\n");
5064 return -EFAULT;
5065 }
5066
5067 cmd.flsh = 1;
5068 cmd.size1 = ipa3_ctx->dma_task_info.mem.size;
5069 cmd.addr1 = ipa3_ctx->dma_task_info.mem.phys_base;
5070 cmd.packet_size = ipa3_ctx->dma_task_info.mem.size;
5071 ipa3_ctx->dma_task_info.cmd_pyld = ipahal_construct_imm_cmd(
5072 IPA_IMM_CMD_DMA_TASK_32B_ADDR, &cmd, false);
5073 if (!ipa3_ctx->dma_task_info.cmd_pyld) {
5074 IPAERR("failed to construct dma_task_32b_addr cmd\n");
5075 dma_free_coherent(ipa3_ctx->pdev,
5076 ipa3_ctx->dma_task_info.mem.size,
5077 ipa3_ctx->dma_task_info.mem.base,
5078 ipa3_ctx->dma_task_info.mem.phys_base);
5079 memset(&ipa3_ctx->dma_task_info, 0,
5080 sizeof(ipa3_ctx->dma_task_info));
5081 return -EFAULT;
5082 }
5083
5084 return 0;
5085}
5086
5087void ipa3_free_dma_task_for_gsi(void)
5088{
5089 dma_free_coherent(ipa3_ctx->pdev,
5090 ipa3_ctx->dma_task_info.mem.size,
5091 ipa3_ctx->dma_task_info.mem.base,
5092 ipa3_ctx->dma_task_info.mem.phys_base);
5093 ipahal_destroy_imm_cmd(ipa3_ctx->dma_task_info.cmd_pyld);
5094 memset(&ipa3_ctx->dma_task_info, 0, sizeof(ipa3_ctx->dma_task_info));
5095}
5096
Amir Levy9659e592016-10-27 18:08:27 +03005097/**
5098 * ipa3_inject_dma_task_for_gsi()- Send DMA_TASK to IPA for GSI stop channel
5099 *
5100 * Send a DMA_TASK of 1B to IPA to unblock GSI channel in STOP_IN_PROG.
5101 * Return value: 0 on success, negative otherwise
5102 */
5103int ipa3_inject_dma_task_for_gsi(void)
5104{
Amir Levy479cfdd2017-10-26 12:23:14 +03005105 struct ipa3_desc desc;
Amir Levy9659e592016-10-27 18:08:27 +03005106
Amir Levy479cfdd2017-10-26 12:23:14 +03005107 ipa3_init_imm_cmd_desc(&desc, ipa3_ctx->dma_task_info.cmd_pyld);
Amir Levy9659e592016-10-27 18:08:27 +03005108
5109 IPADBG("sending 1B packet to IPA\n");
Gidon Studinski3021a6f2016-11-10 12:48:48 +02005110 if (ipa3_send_cmd_timeout(1, &desc,
5111 IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC)) {
Amir Levy9659e592016-10-27 18:08:27 +03005112 IPAERR("ipa3_send_cmd failed\n");
5113 return -EFAULT;
5114 }
5115
5116 return 0;
5117}
5118
Ghanim Fodi37b64952017-01-24 15:42:30 +02005119static int ipa3_load_single_fw(const struct firmware *firmware,
5120 const struct elf32_phdr *phdr)
5121{
5122 uint32_t *fw_mem_base;
5123 int index;
5124 const uint32_t *elf_data_ptr;
5125
5126 if (phdr->p_offset > firmware->size) {
5127 IPAERR("Invalid ELF: offset=%u is beyond elf_size=%zu\n",
5128 phdr->p_offset, firmware->size);
5129 return -EINVAL;
5130 }
5131 if ((firmware->size - phdr->p_offset) < phdr->p_filesz) {
5132 IPAERR("Invalid ELF: offset=%u filesz=%u elf_size=%zu\n",
5133 phdr->p_offset, phdr->p_filesz, firmware->size);
5134 return -EINVAL;
5135 }
5136
5137 if (phdr->p_memsz % sizeof(uint32_t)) {
5138 IPAERR("FW mem size %u doesn't align to 32bit\n",
5139 phdr->p_memsz);
5140 return -EFAULT;
5141 }
5142
5143 if (phdr->p_filesz > phdr->p_memsz) {
5144 IPAERR("FW image too big src_size=%u dst_size=%u\n",
5145 phdr->p_filesz, phdr->p_memsz);
5146 return -EFAULT;
5147 }
5148
5149 fw_mem_base = ioremap(phdr->p_vaddr, phdr->p_memsz);
5150 if (!fw_mem_base) {
5151 IPAERR("Failed to map 0x%x for the size of %u\n",
5152 phdr->p_vaddr, phdr->p_memsz);
5153 return -ENOMEM;
5154 }
5155
5156 /* Set the entire region to 0s */
5157 memset(fw_mem_base, 0, phdr->p_memsz);
5158
5159 elf_data_ptr = (uint32_t *)(firmware->data + phdr->p_offset);
5160
5161 /* Write the FW */
5162 for (index = 0; index < phdr->p_filesz/sizeof(uint32_t); index++) {
5163 writel_relaxed(*elf_data_ptr, &fw_mem_base[index]);
5164 elf_data_ptr++;
5165 }
5166
5167 iounmap(fw_mem_base);
5168
5169 return 0;
5170}
5171
Amir Levy9659e592016-10-27 18:08:27 +03005172/**
5173 * ipa3_load_fws() - Load the IPAv3 FWs into IPA&GSI SRAM.
5174 *
5175 * @firmware: Structure which contains the FW data from the user space.
Ghanim Fodi37b64952017-01-24 15:42:30 +02005176 * @gsi_mem_base: GSI base address
Amir Levy9659e592016-10-27 18:08:27 +03005177 *
5178 * Return value: 0 on success, negative otherwise
5179 *
5180 */
Ghanim Fodi37b64952017-01-24 15:42:30 +02005181int ipa3_load_fws(const struct firmware *firmware, phys_addr_t gsi_mem_base)
Amir Levy9659e592016-10-27 18:08:27 +03005182{
5183 const struct elf32_hdr *ehdr;
5184 const struct elf32_phdr *phdr;
Ghanim Fodi37b64952017-01-24 15:42:30 +02005185 unsigned long gsi_iram_ofst;
5186 unsigned long gsi_iram_size;
5187 phys_addr_t ipa_reg_mem_base;
5188 u32 ipa_reg_ofst;
5189 int rc;
5190
5191 if (!gsi_mem_base) {
5192 IPAERR("Invalid GSI base address\n");
5193 return -EINVAL;
5194 }
5195
5196 ipa_assert_on(!firmware);
5197 /* One program header per FW image: GSI, DPS and HPS */
5198 if (firmware->size < (sizeof(*ehdr) + 3 * sizeof(*phdr))) {
5199 IPAERR("Missing ELF and Program headers firmware size=%zu\n",
5200 firmware->size);
5201 return -EINVAL;
5202 }
Amir Levy9659e592016-10-27 18:08:27 +03005203
5204 ehdr = (struct elf32_hdr *) firmware->data;
Ghanim Fodi37b64952017-01-24 15:42:30 +02005205 ipa_assert_on(!ehdr);
5206 if (ehdr->e_phnum != 3) {
5207 IPAERR("Unexpected number of ELF program headers\n");
5208 return -EINVAL;
Amir Levy9659e592016-10-27 18:08:27 +03005209 }
Ghanim Fodi37b64952017-01-24 15:42:30 +02005210 phdr = (struct elf32_phdr *)(firmware->data + sizeof(*ehdr));
5211
5212 /*
5213 * Each ELF program header represents a FW image and contains:
5214 * p_vaddr : The starting address to which the FW needs to loaded.
5215 * p_memsz : The size of the IRAM (where the image loaded)
5216 * p_filesz: The size of the FW image embedded inside the ELF
5217 * p_offset: Absolute offset to the image from the head of the ELF
5218 */
5219
5220 /* Load GSI FW image */
5221 gsi_get_inst_ram_offset_and_size(&gsi_iram_ofst, &gsi_iram_size);
5222 if (phdr->p_vaddr != (gsi_mem_base + gsi_iram_ofst)) {
5223 IPAERR(
5224 "Invalid GSI FW img load addr vaddr=0x%x gsi_mem_base=%pa gsi_iram_ofst=0x%lx\n"
5225 , phdr->p_vaddr, &gsi_mem_base, gsi_iram_ofst);
5226 return -EINVAL;
5227 }
5228 if (phdr->p_memsz > gsi_iram_size) {
5229 IPAERR("Invalid GSI FW img size memsz=%d gsi_iram_size=%lu\n",
5230 phdr->p_memsz, gsi_iram_size);
5231 return -EINVAL;
5232 }
5233 rc = ipa3_load_single_fw(firmware, phdr);
5234 if (rc)
5235 return rc;
5236
5237 phdr++;
5238 ipa_reg_mem_base = ipa3_ctx->ipa_wrapper_base + ipahal_get_reg_base();
5239
5240 /* Load IPA DPS FW image */
5241 ipa_reg_ofst = ipahal_get_reg_ofst(IPA_DPS_SEQUENCER_FIRST);
5242 if (phdr->p_vaddr != (ipa_reg_mem_base + ipa_reg_ofst)) {
5243 IPAERR(
5244 "Invalid IPA DPS img load addr vaddr=0x%x ipa_reg_mem_base=%pa ipa_reg_ofst=%u\n"
5245 , phdr->p_vaddr, &ipa_reg_mem_base, ipa_reg_ofst);
5246 return -EINVAL;
5247 }
5248 if (phdr->p_memsz > ipahal_get_dps_img_mem_size()) {
5249 IPAERR("Invalid IPA DPS img size memsz=%d dps_mem_size=%u\n",
5250 phdr->p_memsz, ipahal_get_dps_img_mem_size());
5251 return -EINVAL;
5252 }
5253 rc = ipa3_load_single_fw(firmware, phdr);
5254 if (rc)
5255 return rc;
5256
5257 phdr++;
5258
5259 /* Load IPA HPS FW image */
5260 ipa_reg_ofst = ipahal_get_reg_ofst(IPA_HPS_SEQUENCER_FIRST);
5261 if (phdr->p_vaddr != (ipa_reg_mem_base + ipa_reg_ofst)) {
5262 IPAERR(
5263 "Invalid IPA HPS img load addr vaddr=0x%x ipa_reg_mem_base=%pa ipa_reg_ofst=%u\n"
5264 , phdr->p_vaddr, &ipa_reg_mem_base, ipa_reg_ofst);
5265 return -EINVAL;
5266 }
5267 if (phdr->p_memsz > ipahal_get_hps_img_mem_size()) {
5268 IPAERR("Invalid IPA HPS img size memsz=%d dps_mem_size=%u\n",
5269 phdr->p_memsz, ipahal_get_hps_img_mem_size());
5270 return -EINVAL;
5271 }
5272 rc = ipa3_load_single_fw(firmware, phdr);
5273 if (rc)
5274 return rc;
5275
5276 IPADBG("IPA FWs (GSI FW, DPS and HPS) loaded successfully\n");
Amir Levy9659e592016-10-27 18:08:27 +03005277 return 0;
5278}
5279
5280/**
5281 * ipa3_is_msm_device() - Is the running device a MSM or MDM?
5282 * Determine according to IPA version
5283 *
5284 * Return value: true if MSM, false if MDM
5285 *
5286 */
5287bool ipa3_is_msm_device(void)
5288{
5289 switch (ipa3_ctx->ipa_hw_type) {
5290 case IPA_HW_v3_0:
5291 case IPA_HW_v3_5:
Michael Adisumarta891a4ff2017-05-16 16:40:06 -07005292 case IPA_HW_v4_0:
Amir Levy9659e592016-10-27 18:08:27 +03005293 return false;
5294 case IPA_HW_v3_1:
5295 case IPA_HW_v3_5_1:
5296 return true;
5297 default:
5298 IPAERR("unknown HW type %d\n", ipa3_ctx->ipa_hw_type);
5299 ipa_assert();
5300 }
5301
5302 return false;
5303}
Amir Levyc4222c92016-11-07 16:14:54 +02005304
5305/**
Amir Levy3afd94a2017-01-05 10:19:13 +02005306* ipa3_disable_prefetch() - disable\enable tx prefetch
5307*
5308* @client: the client which is related to the TX where prefetch will be
5309* disabled
5310*
5311* Return value: Non applicable
5312*
5313*/
5314void ipa3_disable_prefetch(enum ipa_client_type client)
5315{
5316 struct ipahal_reg_tx_cfg cfg;
5317 u8 qmb;
5318
5319 qmb = ipa3_get_qmb_master_sel(client);
5320
5321 IPADBG("disabling prefetch for qmb %d\n", (int)qmb);
5322
5323 ipahal_read_reg_fields(IPA_TX_CFG, &cfg);
5324 /* QMB0 (DDR) correlates with TX0, QMB1(PCIE) correlates with TX1 */
5325 if (qmb == QMB_MASTER_SELECT_DDR)
5326 cfg.tx0_prefetch_disable = true;
5327 else
5328 cfg.tx1_prefetch_disable = true;
5329 ipahal_write_reg_fields(IPA_TX_CFG, &cfg);
5330}
5331
5332/**
Amir Levyc4222c92016-11-07 16:14:54 +02005333 * ipa3_get_pdev() - return a pointer to IPA dev struct
5334 *
5335 * Return value: a pointer to IPA dev struct
5336 *
5337 */
5338struct device *ipa3_get_pdev(void)
5339{
5340 if (!ipa3_ctx)
5341 return NULL;
5342
5343 return ipa3_ctx->pdev;
5344}
Amir Levy12ef0912016-08-30 09:27:34 +03005345
5346/**
5347 * ipa3_enable_dcd() - enable dynamic clock division on IPA
5348 *
5349 * Return value: Non applicable
5350 *
5351 */
5352void ipa3_enable_dcd(void)
5353{
5354 struct ipahal_reg_idle_indication_cfg idle_indication_cfg;
5355
5356 /* recommended values for IPA 3.5 according to IPA HPG */
5357 idle_indication_cfg.const_non_idle_enable = 0;
5358 idle_indication_cfg.enter_idle_debounce_thresh = 256;
5359
5360 ipahal_write_reg_fields(IPA_IDLE_INDICATION_CFG,
5361 &idle_indication_cfg);
5362}
Amir Levy479cfdd2017-10-26 12:23:14 +03005363
5364void ipa3_init_imm_cmd_desc(struct ipa3_desc *desc,
5365 struct ipahal_imm_cmd_pyld *cmd_pyld)
5366{
5367 memset(desc, 0, sizeof(*desc));
5368 desc->opcode = cmd_pyld->opcode;
5369 desc->pyld = cmd_pyld->data;
5370 desc->len = cmd_pyld->len;
5371 desc->type = IPA_IMM_CMD_DESC;
5372}
5373