.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: ISC */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
---|
3 | 4 | * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. |
---|
4 | 5 | * Copyright (c) 2018 The Linux Foundation. All rights reserved. |
---|
5 | | - * |
---|
6 | | - * Permission to use, copy, modify, and/or distribute this software for any |
---|
7 | | - * purpose with or without fee is hereby granted, provided that the above |
---|
8 | | - * copyright notice and this permission notice appear in all copies. |
---|
9 | | - * |
---|
10 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
11 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
12 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
13 | | - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
14 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
15 | | - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
16 | | - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
17 | 6 | */ |
---|
18 | 7 | |
---|
19 | 8 | #ifndef _CE_H_ |
---|
.. | .. |
---|
39 | 28 | #define CE_DESC_FLAGS_BYTE_SWAP (1 << 1) |
---|
40 | 29 | #define CE_WCN3990_DESC_FLAGS_GATHER BIT(31) |
---|
41 | 30 | |
---|
42 | | -#define CE_DESC_FLAGS_GET_MASK GENMASK(4, 0) |
---|
43 | | -#define CE_DESC_37BIT_ADDR_MASK GENMASK_ULL(37, 0) |
---|
| 31 | +#define CE_DESC_ADDR_MASK GENMASK_ULL(34, 0) |
---|
| 32 | +#define CE_DESC_ADDR_HI_MASK GENMASK(4, 0) |
---|
44 | 33 | |
---|
45 | 34 | /* Following desc flags are used in QCA99X0 */ |
---|
46 | 35 | #define CE_DESC_FLAGS_HOST_INT_DIS (1 << 2) |
---|
.. | .. |
---|
104 | 93 | /* Host address space */ |
---|
105 | 94 | void *base_addr_owner_space_unaligned; |
---|
106 | 95 | /* CE address space */ |
---|
107 | | - u32 base_addr_ce_space_unaligned; |
---|
| 96 | + dma_addr_t base_addr_ce_space_unaligned; |
---|
108 | 97 | |
---|
109 | 98 | /* |
---|
110 | 99 | * Actual start of descriptors. |
---|
.. | .. |
---|
115 | 104 | void *base_addr_owner_space; |
---|
116 | 105 | |
---|
117 | 106 | /* CE address space */ |
---|
118 | | - u32 base_addr_ce_space; |
---|
| 107 | + dma_addr_t base_addr_ce_space; |
---|
119 | 108 | |
---|
120 | 109 | char *shadow_base_unaligned; |
---|
121 | 110 | struct ce_desc_64 *shadow_base; |
---|
122 | 111 | |
---|
123 | 112 | /* keep last */ |
---|
124 | | - void *per_transfer_context[0]; |
---|
| 113 | + void *per_transfer_context[]; |
---|
125 | 114 | }; |
---|
126 | 115 | |
---|
127 | 116 | struct ath10k_ce_pipe { |
---|
.. | .. |
---|
266 | 255 | /*==================CE Interrupt Handlers====================*/ |
---|
267 | 256 | void ath10k_ce_per_engine_service_any(struct ath10k *ar); |
---|
268 | 257 | void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id); |
---|
269 | | -int ath10k_ce_disable_interrupts(struct ath10k *ar); |
---|
| 258 | +void ath10k_ce_disable_interrupt(struct ath10k *ar, int ce_id); |
---|
| 259 | +void ath10k_ce_disable_interrupts(struct ath10k *ar); |
---|
| 260 | +void ath10k_ce_enable_interrupt(struct ath10k *ar, int ce_id); |
---|
270 | 261 | void ath10k_ce_enable_interrupts(struct ath10k *ar); |
---|
271 | 262 | void ath10k_ce_dump_registers(struct ath10k *ar, |
---|
272 | 263 | struct ath10k_fw_crash_data *crash_data); |
---|
| 264 | + |
---|
273 | 265 | void ath10k_ce_alloc_rri(struct ath10k *ar); |
---|
274 | 266 | void ath10k_ce_free_rri(struct ath10k *ar); |
---|
275 | 267 | |
---|
276 | 268 | /* ce_attr.flags values */ |
---|
277 | 269 | /* Use NonSnooping PCIe accesses? */ |
---|
278 | | -#define CE_ATTR_NO_SNOOP 1 |
---|
| 270 | +#define CE_ATTR_NO_SNOOP BIT(0) |
---|
279 | 271 | |
---|
280 | 272 | /* Byte swap data words */ |
---|
281 | | -#define CE_ATTR_BYTE_SWAP_DATA 2 |
---|
| 273 | +#define CE_ATTR_BYTE_SWAP_DATA BIT(1) |
---|
282 | 274 | |
---|
283 | 275 | /* Swizzle descriptors? */ |
---|
284 | | -#define CE_ATTR_SWIZZLE_DESCRIPTORS 4 |
---|
| 276 | +#define CE_ATTR_SWIZZLE_DESCRIPTORS BIT(2) |
---|
285 | 277 | |
---|
286 | 278 | /* no interrupt on copy completion */ |
---|
287 | | -#define CE_ATTR_DIS_INTR 8 |
---|
| 279 | +#define CE_ATTR_DIS_INTR BIT(3) |
---|
| 280 | + |
---|
| 281 | +/* no interrupt, only polling */ |
---|
| 282 | +#define CE_ATTR_POLL BIT(4) |
---|
288 | 283 | |
---|
289 | 284 | /* Attributes of an instance of a Copy Engine */ |
---|
290 | 285 | struct ce_attr { |
---|
.. | .. |
---|
331 | 326 | void *per_transfer_context, |
---|
332 | 327 | dma_addr_t buffer, u32 nbytes, |
---|
333 | 328 | u32 transfer_id, u32 flags); |
---|
| 329 | + void (*ce_set_src_ring_base_addr_hi)(struct ath10k *ar, |
---|
| 330 | + u32 ce_ctrl_addr, |
---|
| 331 | + u64 addr); |
---|
| 332 | + void (*ce_set_dest_ring_base_addr_hi)(struct ath10k *ar, |
---|
| 333 | + u32 ce_ctrl_addr, |
---|
| 334 | + u64 addr); |
---|
| 335 | + int (*ce_completed_send_next_nolock)(struct ath10k_ce_pipe *ce_state, |
---|
| 336 | + void **per_transfer_contextp); |
---|
334 | 337 | }; |
---|
335 | 338 | |
---|
336 | 339 | static inline u32 ath10k_ce_base_address(struct ath10k *ar, unsigned int ce_id) |
---|
.. | .. |
---|
369 | 372 | (((x) & CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK) >> \ |
---|
370 | 373 | CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB) |
---|
371 | 374 | #define CE_WRAPPER_INTERRUPT_SUMMARY_ADDRESS 0x0000 |
---|
372 | | -#define CE_INTERRUPT_SUMMARY (GENMASK(CE_COUNT_MAX - 1, 0)) |
---|
373 | 375 | |
---|
374 | 376 | static inline u32 ath10k_ce_interrupt_summary(struct ath10k *ar) |
---|
375 | 377 | { |
---|
376 | 378 | struct ath10k_ce *ce = ath10k_ce_priv(ar); |
---|
377 | 379 | |
---|
378 | | - if (!ar->hw_params.per_ce_irq) |
---|
379 | | - return CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_GET( |
---|
380 | | - ce->bus_ops->read32((ar), CE_WRAPPER_BASE_ADDRESS + |
---|
381 | | - CE_WRAPPER_INTERRUPT_SUMMARY_ADDRESS)); |
---|
382 | | - else |
---|
383 | | - return CE_INTERRUPT_SUMMARY; |
---|
| 380 | + return CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_GET( |
---|
| 381 | + ce->bus_ops->read32((ar), CE_WRAPPER_BASE_ADDRESS + |
---|
| 382 | + CE_WRAPPER_INTERRUPT_SUMMARY_ADDRESS)); |
---|
384 | 383 | } |
---|
385 | 384 | |
---|
386 | 385 | /* Host software's Copy Engine configuration. */ |
---|
.. | .. |
---|
419 | 418 | #define PIPEDIR_INOUT 3 /* bidirectional */ |
---|
420 | 419 | |
---|
421 | 420 | /* Establish a mapping between a service/direction and a pipe. */ |
---|
422 | | -struct service_to_pipe { |
---|
| 421 | +struct ce_service_to_pipe { |
---|
423 | 422 | __le32 service_id; |
---|
424 | 423 | __le32 pipedir; |
---|
425 | 424 | __le32 pipenum; |
---|