2013-06-13 01:52:10 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2005-2011 Atheros Communications Inc.
|
2017-12-23 00:31:13 +08:00
|
|
|
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
|
2018-04-17 20:06:59 +08:00
|
|
|
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
|
2013-06-13 01:52:10 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CE_H_
|
|
|
|
#define _CE_H_
|
|
|
|
|
|
|
|
#include "hif.h"
|
|
|
|
|
2016-03-01 20:16:10 +08:00
|
|
|
#define CE_HTT_H2T_MSG_SRC_NENTRIES 8192
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* Descriptor rings must be aligned to this boundary */
|
|
|
|
#define CE_DESC_RING_ALIGN 8
|
|
|
|
#define CE_SEND_FLAG_GATHER 0x00010000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy Engine support: low-level Target-side Copy Engine API.
|
|
|
|
* This is a hardware access layer used by code that understands
|
|
|
|
* how to use copy engines.
|
|
|
|
*/
|
|
|
|
|
2013-08-27 19:08:02 +08:00
|
|
|
struct ath10k_ce_pipe;
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
#define CE_DESC_FLAGS_GATHER (1 << 0)
|
|
|
|
#define CE_DESC_FLAGS_BYTE_SWAP (1 << 1)
|
2017-12-21 17:00:59 +08:00
|
|
|
#define CE_WCN3990_DESC_FLAGS_GATHER BIT(31)
|
|
|
|
|
|
|
|
#define CE_DESC_FLAGS_GET_MASK GENMASK(4, 0)
|
|
|
|
#define CE_DESC_37BIT_ADDR_MASK GENMASK_ULL(37, 0)
|
2015-06-18 15:01:07 +08:00
|
|
|
|
|
|
|
/* Following desc flags are used in QCA99X0 */
|
|
|
|
#define CE_DESC_FLAGS_HOST_INT_DIS (1 << 2)
|
|
|
|
#define CE_DESC_FLAGS_TGT_INT_DIS (1 << 3)
|
|
|
|
|
|
|
|
#define CE_DESC_FLAGS_META_DATA_MASK ar->hw_values->ce_desc_meta_data_mask
|
|
|
|
#define CE_DESC_FLAGS_META_DATA_LSB ar->hw_values->ce_desc_meta_data_lsb
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2018-04-17 20:07:00 +08:00
|
|
|
#define CE_DDR_RRI_MASK GENMASK(15, 0)
|
|
|
|
#define CE_DDR_DRRI_SHIFT 16
|
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
struct ce_desc {
|
|
|
|
__le32 addr;
|
|
|
|
__le16 nbytes;
|
|
|
|
__le16 flags; /* %CE_DESC_FLAGS_ */
|
|
|
|
};
|
|
|
|
|
2017-12-21 17:00:59 +08:00
|
|
|
struct ce_desc_64 {
|
|
|
|
__le64 addr;
|
|
|
|
__le16 nbytes; /* length in register map */
|
|
|
|
__le16 flags; /* fw_metadata_high */
|
|
|
|
__le32 toeplitz_hash_result;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define CE_DESC_SIZE sizeof(struct ce_desc)
|
|
|
|
#define CE_DESC_SIZE_64 sizeof(struct ce_desc_64)
|
|
|
|
|
2013-08-27 19:08:03 +08:00
|
|
|
struct ath10k_ce_ring {
|
2013-06-13 01:52:10 +08:00
|
|
|
/* Number of entries in this ring; must be power of 2 */
|
|
|
|
unsigned int nentries;
|
|
|
|
unsigned int nentries_mask;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For dest ring, this is the next index to be processed
|
|
|
|
* by software after it was/is received into.
|
|
|
|
*
|
|
|
|
* For src ring, this is the last descriptor that was sent
|
|
|
|
* and completion processed by software.
|
|
|
|
*
|
|
|
|
* Regardless of src or dest ring, this is an invariant
|
|
|
|
* (modulo ring size):
|
|
|
|
* write index >= read index >= sw_index
|
|
|
|
*/
|
|
|
|
unsigned int sw_index;
|
|
|
|
/* cached copy */
|
|
|
|
unsigned int write_index;
|
|
|
|
/*
|
|
|
|
* For src ring, this is the next index not yet processed by HW.
|
|
|
|
* This is a cached copy of the real HW index (read index), used
|
|
|
|
* for avoiding reading the HW index register more often than
|
|
|
|
* necessary.
|
|
|
|
* This extends the invariant:
|
|
|
|
* write index >= read index >= hw_index >= sw_index
|
|
|
|
*
|
|
|
|
* For dest ring, this is currently unused.
|
|
|
|
*/
|
|
|
|
/* cached copy */
|
|
|
|
unsigned int hw_index;
|
|
|
|
|
|
|
|
/* Start of DMA-coherent area reserved for descriptors */
|
|
|
|
/* Host address space */
|
|
|
|
void *base_addr_owner_space_unaligned;
|
|
|
|
/* CE address space */
|
|
|
|
u32 base_addr_ce_space_unaligned;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Actual start of descriptors.
|
|
|
|
* Aligned to descriptor-size boundary.
|
|
|
|
* Points into reserved DMA-coherent area, above.
|
|
|
|
*/
|
|
|
|
/* Host address space */
|
|
|
|
void *base_addr_owner_space;
|
|
|
|
|
|
|
|
/* CE address space */
|
|
|
|
u32 base_addr_ce_space;
|
|
|
|
|
2018-04-17 20:06:59 +08:00
|
|
|
char *shadow_base_unaligned;
|
|
|
|
struct ce_desc *shadow_base;
|
|
|
|
|
2014-03-28 16:02:38 +08:00
|
|
|
/* keep last */
|
|
|
|
void *per_transfer_context[0];
|
2013-06-13 01:52:10 +08:00
|
|
|
};
|
|
|
|
|
2013-08-27 19:08:02 +08:00
|
|
|
struct ath10k_ce_pipe {
|
2013-06-13 01:52:10 +08:00
|
|
|
struct ath10k *ar;
|
|
|
|
unsigned int id;
|
|
|
|
|
|
|
|
unsigned int attr_flags;
|
|
|
|
|
|
|
|
u32 ctrl_addr;
|
|
|
|
|
2013-09-03 21:09:58 +08:00
|
|
|
void (*send_cb)(struct ath10k_ce_pipe *);
|
|
|
|
void (*recv_cb)(struct ath10k_ce_pipe *);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
unsigned int src_sz_max;
|
2013-08-27 19:08:03 +08:00
|
|
|
struct ath10k_ce_ring *src_ring;
|
|
|
|
struct ath10k_ce_ring *dest_ring;
|
2017-12-21 17:00:59 +08:00
|
|
|
const struct ath10k_ce_ops *ops;
|
2013-06-13 01:52:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Copy Engine settable attributes */
|
|
|
|
struct ce_attr;
|
|
|
|
|
2017-06-28 12:48:26 +08:00
|
|
|
struct ath10k_bus_ops {
|
|
|
|
u32 (*read32)(struct ath10k *ar, u32 offset);
|
|
|
|
void (*write32)(struct ath10k *ar, u32 offset, u32 value);
|
|
|
|
int (*get_num_banks)(struct ath10k *ar);
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct ath10k_ce *ath10k_ce_priv(struct ath10k *ar)
|
|
|
|
{
|
|
|
|
return (struct ath10k_ce *)ar->ce_priv;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ath10k_ce {
|
|
|
|
/* protects CE info */
|
|
|
|
spinlock_t ce_lock;
|
|
|
|
const struct ath10k_bus_ops *bus_ops;
|
|
|
|
struct ath10k_ce_pipe ce_states[CE_COUNT_MAX];
|
2018-04-17 20:07:00 +08:00
|
|
|
u32 *vaddr_rri;
|
|
|
|
dma_addr_t paddr_rri;
|
2017-06-28 12:48:26 +08:00
|
|
|
};
|
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
/*==================Send====================*/
|
|
|
|
|
|
|
|
/* ath10k_ce_send flags */
|
|
|
|
#define CE_SEND_FLAG_BYTE_SWAP 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Queue a source buffer to be sent to an anonymous destination buffer.
|
|
|
|
* ce - which copy engine to use
|
|
|
|
* buffer - address of buffer
|
|
|
|
* nbytes - number of bytes to send
|
|
|
|
* transfer_id - arbitrary ID; reflected to destination
|
|
|
|
* flags - CE_SEND_FLAG_* values
|
|
|
|
* Returns 0 on success; otherwise an error status.
|
|
|
|
*
|
|
|
|
* Note: If no flags are specified, use CE's default data swap mode.
|
|
|
|
*
|
|
|
|
* Implementation note: pushes 1 buffer to Source ring
|
|
|
|
*/
|
2013-08-27 19:08:02 +08:00
|
|
|
int ath10k_ce_send(struct ath10k_ce_pipe *ce_state,
|
2013-06-13 01:52:10 +08:00
|
|
|
void *per_transfer_send_context,
|
2017-12-21 17:00:58 +08:00
|
|
|
dma_addr_t buffer,
|
2013-06-13 01:52:10 +08:00
|
|
|
unsigned int nbytes,
|
|
|
|
/* 14 bits */
|
|
|
|
unsigned int transfer_id,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2014-02-28 00:50:04 +08:00
|
|
|
int ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state,
|
|
|
|
void *per_transfer_context,
|
2017-12-21 17:00:58 +08:00
|
|
|
dma_addr_t buffer,
|
2014-02-28 00:50:04 +08:00
|
|
|
unsigned int nbytes,
|
|
|
|
unsigned int transfer_id,
|
|
|
|
unsigned int flags);
|
|
|
|
|
2014-05-26 18:02:59 +08:00
|
|
|
void __ath10k_ce_send_revert(struct ath10k_ce_pipe *pipe);
|
|
|
|
|
2013-10-02 17:03:41 +08:00
|
|
|
int ath10k_ce_num_free_src_entries(struct ath10k_ce_pipe *pipe);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/*==================Recv=======================*/
|
|
|
|
|
2014-08-22 20:33:14 +08:00
|
|
|
int __ath10k_ce_rx_num_free_bufs(struct ath10k_ce_pipe *pipe);
|
2017-12-21 17:00:58 +08:00
|
|
|
int ath10k_ce_rx_post_buf(struct ath10k_ce_pipe *pipe, void *ctx,
|
|
|
|
dma_addr_t paddr);
|
2016-03-22 19:52:18 +08:00
|
|
|
void ath10k_ce_rx_update_write_idx(struct ath10k_ce_pipe *pipe, u32 nentries);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* recv flags */
|
|
|
|
/* Data is byte-swapped */
|
|
|
|
#define CE_RECV_FLAG_SWAPPED 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Supply data for the next completed unprocessed receive descriptor.
|
|
|
|
* Pops buffer from Dest ring.
|
|
|
|
*/
|
2013-08-27 19:08:02 +08:00
|
|
|
int ath10k_ce_completed_recv_next(struct ath10k_ce_pipe *ce_state,
|
2013-06-13 01:52:10 +08:00
|
|
|
void **per_transfer_contextp,
|
2016-03-22 19:52:17 +08:00
|
|
|
unsigned int *nbytesp);
|
2013-06-13 01:52:10 +08:00
|
|
|
/*
|
|
|
|
* Supply data for the next completed unprocessed send descriptor.
|
|
|
|
* Pops 1 completed send buffer from Source ring.
|
|
|
|
*/
|
2013-08-27 19:08:02 +08:00
|
|
|
int ath10k_ce_completed_send_next(struct ath10k_ce_pipe *ce_state,
|
2015-10-23 20:31:05 +08:00
|
|
|
void **per_transfer_contextp);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2014-09-24 19:16:52 +08:00
|
|
|
int ath10k_ce_completed_send_next_nolock(struct ath10k_ce_pipe *ce_state,
|
2015-10-23 20:31:05 +08:00
|
|
|
void **per_transfer_contextp);
|
2014-09-24 19:16:52 +08:00
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
/*==================CE Engine Initialization=======================*/
|
|
|
|
|
2014-03-28 16:02:38 +08:00
|
|
|
int ath10k_ce_init_pipe(struct ath10k *ar, unsigned int ce_id,
|
2014-10-20 20:14:39 +08:00
|
|
|
const struct ce_attr *attr);
|
2014-03-28 16:02:38 +08:00
|
|
|
void ath10k_ce_deinit_pipe(struct ath10k *ar, unsigned int ce_id);
|
|
|
|
int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
|
2015-10-12 20:57:02 +08:00
|
|
|
const struct ce_attr *attr);
|
2014-03-28 16:02:38 +08:00
|
|
|
void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/*==================CE Engine Shutdown=======================*/
|
|
|
|
/*
|
|
|
|
* Support clean shutdown by allowing the caller to revoke
|
|
|
|
* receive buffers. Target DMA must be stopped before using
|
|
|
|
* this API.
|
|
|
|
*/
|
2013-08-27 19:08:02 +08:00
|
|
|
int ath10k_ce_revoke_recv_next(struct ath10k_ce_pipe *ce_state,
|
2013-06-13 01:52:10 +08:00
|
|
|
void **per_transfer_contextp,
|
2017-12-21 17:00:58 +08:00
|
|
|
dma_addr_t *bufferp);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2014-09-24 19:16:52 +08:00
|
|
|
int ath10k_ce_completed_recv_next_nolock(struct ath10k_ce_pipe *ce_state,
|
|
|
|
void **per_transfer_contextp,
|
2016-03-22 19:52:17 +08:00
|
|
|
unsigned int *nbytesp);
|
2014-09-24 19:16:52 +08:00
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
/*
|
|
|
|
* Support clean shutdown by allowing the caller to cancel
|
|
|
|
* pending sends. Target DMA must be stopped before using
|
|
|
|
* this API.
|
|
|
|
*/
|
2013-08-27 19:08:02 +08:00
|
|
|
int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe *ce_state,
|
2013-06-13 01:52:10 +08:00
|
|
|
void **per_transfer_contextp,
|
2017-12-21 17:00:58 +08:00
|
|
|
dma_addr_t *bufferp,
|
2013-06-13 01:52:10 +08:00
|
|
|
unsigned int *nbytesp,
|
|
|
|
unsigned int *transfer_idp);
|
|
|
|
|
|
|
|
/*==================CE Interrupt Handlers====================*/
|
|
|
|
void ath10k_ce_per_engine_service_any(struct ath10k *ar);
|
|
|
|
void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
|
2013-11-08 15:01:31 +08:00
|
|
|
int ath10k_ce_disable_interrupts(struct ath10k *ar);
|
2014-08-22 20:23:32 +08:00
|
|
|
void ath10k_ce_enable_interrupts(struct ath10k *ar);
|
2017-01-16 23:31:08 +08:00
|
|
|
void ath10k_ce_dump_registers(struct ath10k *ar,
|
|
|
|
struct ath10k_fw_crash_data *crash_data);
|
2018-04-17 20:07:00 +08:00
|
|
|
void ath10k_ce_alloc_rri(struct ath10k *ar);
|
|
|
|
void ath10k_ce_free_rri(struct ath10k *ar);
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* ce_attr.flags values */
|
|
|
|
/* Use NonSnooping PCIe accesses? */
|
2018-09-04 01:07:58 +08:00
|
|
|
#define CE_ATTR_NO_SNOOP BIT(0)
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* Byte swap data words */
|
2018-09-04 01:07:58 +08:00
|
|
|
#define CE_ATTR_BYTE_SWAP_DATA BIT(1)
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* Swizzle descriptors? */
|
2018-09-04 01:07:58 +08:00
|
|
|
#define CE_ATTR_SWIZZLE_DESCRIPTORS BIT(2)
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* no interrupt on copy completion */
|
2018-09-04 01:07:58 +08:00
|
|
|
#define CE_ATTR_DIS_INTR BIT(3)
|
|
|
|
|
|
|
|
/* no interrupt, only polling */
|
|
|
|
#define CE_ATTR_POLL BIT(4)
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
/* Attributes of an instance of a Copy Engine */
|
|
|
|
struct ce_attr {
|
|
|
|
/* CE_ATTR_* values */
|
|
|
|
unsigned int flags;
|
|
|
|
|
|
|
|
/* #entries in source ring - Must be a power of 2 */
|
|
|
|
unsigned int src_nentries;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Max source send size for this CE.
|
|
|
|
* This is also the minimum size of a destination buffer.
|
|
|
|
*/
|
|
|
|
unsigned int src_sz_max;
|
|
|
|
|
|
|
|
/* #entries in destination ring - Must be a power of 2 */
|
|
|
|
unsigned int dest_nentries;
|
2015-10-12 20:57:01 +08:00
|
|
|
|
|
|
|
void (*send_cb)(struct ath10k_ce_pipe *);
|
2015-10-12 20:57:02 +08:00
|
|
|
void (*recv_cb)(struct ath10k_ce_pipe *);
|
2013-06-13 01:52:10 +08:00
|
|
|
};
|
|
|
|
|
2017-12-21 17:00:59 +08:00
|
|
|
struct ath10k_ce_ops {
|
|
|
|
struct ath10k_ce_ring *(*ce_alloc_src_ring)(struct ath10k *ar,
|
|
|
|
u32 ce_id,
|
|
|
|
const struct ce_attr *attr);
|
|
|
|
struct ath10k_ce_ring *(*ce_alloc_dst_ring)(struct ath10k *ar,
|
|
|
|
u32 ce_id,
|
|
|
|
const struct ce_attr *attr);
|
|
|
|
int (*ce_rx_post_buf)(struct ath10k_ce_pipe *pipe, void *ctx,
|
|
|
|
dma_addr_t paddr);
|
|
|
|
int (*ce_completed_recv_next_nolock)(struct ath10k_ce_pipe *ce_state,
|
|
|
|
void **per_transfer_contextp,
|
|
|
|
u32 *nbytesp);
|
|
|
|
int (*ce_revoke_recv_next)(struct ath10k_ce_pipe *ce_state,
|
|
|
|
void **per_transfer_contextp,
|
|
|
|
dma_addr_t *nbytesp);
|
|
|
|
void (*ce_extract_desc_data)(struct ath10k *ar,
|
|
|
|
struct ath10k_ce_ring *src_ring,
|
|
|
|
u32 sw_index, dma_addr_t *bufferp,
|
|
|
|
u32 *nbytesp, u32 *transfer_idp);
|
|
|
|
void (*ce_free_pipe)(struct ath10k *ar, int ce_id);
|
|
|
|
int (*ce_send_nolock)(struct ath10k_ce_pipe *pipe,
|
|
|
|
void *per_transfer_context,
|
|
|
|
dma_addr_t buffer, u32 nbytes,
|
|
|
|
u32 transfer_id, u32 flags);
|
|
|
|
};
|
2018-01-16 18:54:17 +08:00
|
|
|
|
2015-01-24 18:14:49 +08:00
|
|
|
static inline u32 ath10k_ce_base_address(struct ath10k *ar, unsigned int ce_id)
|
2013-06-13 01:52:10 +08:00
|
|
|
{
|
|
|
|
return CE0_BASE_ADDRESS + (CE1_BASE_ADDRESS - CE0_BASE_ADDRESS) * ce_id;
|
|
|
|
}
|
|
|
|
|
2018-04-17 20:07:00 +08:00
|
|
|
#define COPY_ENGINE_ID(COPY_ENGINE_BASE_ADDRESS) (((COPY_ENGINE_BASE_ADDRESS) \
|
|
|
|
- CE0_BASE_ADDRESS) / (CE1_BASE_ADDRESS - CE0_BASE_ADDRESS))
|
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
#define CE_SRC_RING_TO_DESC(baddr, idx) \
|
|
|
|
(&(((struct ce_desc *)baddr)[idx]))
|
|
|
|
|
|
|
|
#define CE_DEST_RING_TO_DESC(baddr, idx) \
|
|
|
|
(&(((struct ce_desc *)baddr)[idx]))
|
|
|
|
|
2017-12-21 17:00:59 +08:00
|
|
|
#define CE_SRC_RING_TO_DESC_64(baddr, idx) \
|
|
|
|
(&(((struct ce_desc_64 *)baddr)[idx]))
|
|
|
|
|
|
|
|
#define CE_DEST_RING_TO_DESC_64(baddr, idx) \
|
|
|
|
(&(((struct ce_desc_64 *)baddr)[idx]))
|
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
/* Ring arithmetic (modulus number of entries in ring, which is a pwr of 2). */
|
|
|
|
#define CE_RING_DELTA(nentries_mask, fromidx, toidx) \
|
2016-04-13 19:13:21 +08:00
|
|
|
(((int)(toidx) - (int)(fromidx)) & (nentries_mask))
|
2013-06-13 01:52:10 +08:00
|
|
|
|
|
|
|
#define CE_RING_IDX_INCR(nentries_mask, idx) (((idx) + 1) & (nentries_mask))
|
2016-03-22 19:52:18 +08:00
|
|
|
#define CE_RING_IDX_ADD(nentries_mask, idx, num) \
|
|
|
|
(((idx) + (num)) & (nentries_mask))
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2015-06-18 15:01:02 +08:00
|
|
|
#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB \
|
|
|
|
ar->regs->ce_wrap_intr_sum_host_msi_lsb
|
|
|
|
#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK \
|
|
|
|
ar->regs->ce_wrap_intr_sum_host_msi_mask
|
2013-06-13 01:52:10 +08:00
|
|
|
#define CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_GET(x) \
|
|
|
|
(((x) & CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_MASK) >> \
|
|
|
|
CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_LSB)
|
|
|
|
#define CE_WRAPPER_INTERRUPT_SUMMARY_ADDRESS 0x0000
|
2018-04-10 23:01:32 +08:00
|
|
|
#define CE_INTERRUPT_SUMMARY (GENMASK(CE_COUNT_MAX - 1, 0))
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2017-06-28 12:48:26 +08:00
|
|
|
static inline u32 ath10k_ce_interrupt_summary(struct ath10k *ar)
|
|
|
|
{
|
|
|
|
struct ath10k_ce *ce = ath10k_ce_priv(ar);
|
|
|
|
|
2018-04-10 23:01:32 +08:00
|
|
|
if (!ar->hw_params.per_ce_irq)
|
|
|
|
return CE_WRAPPER_INTERRUPT_SUMMARY_HOST_MSI_GET(
|
|
|
|
ce->bus_ops->read32((ar), CE_WRAPPER_BASE_ADDRESS +
|
|
|
|
CE_WRAPPER_INTERRUPT_SUMMARY_ADDRESS));
|
|
|
|
else
|
|
|
|
return CE_INTERRUPT_SUMMARY;
|
2017-06-28 12:48:26 +08:00
|
|
|
}
|
2013-06-13 01:52:10 +08:00
|
|
|
|
2018-06-12 05:09:44 +08:00
|
|
|
/* Host software's Copy Engine configuration. */
|
|
|
|
#define CE_ATTR_FLAGS 0
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configuration information for a Copy Engine pipe.
|
|
|
|
* Passed from Host to Target during startup (one per CE).
|
|
|
|
*
|
|
|
|
* NOTE: Structure is shared between Host software and Target firmware!
|
|
|
|
*/
|
|
|
|
struct ce_pipe_config {
|
|
|
|
__le32 pipenum;
|
|
|
|
__le32 pipedir;
|
|
|
|
__le32 nentries;
|
|
|
|
__le32 nbytes_max;
|
|
|
|
__le32 flags;
|
|
|
|
__le32 reserved;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Directions for interconnect pipe configuration.
|
|
|
|
* These definitions may be used during configuration and are shared
|
|
|
|
* between Host and Target.
|
|
|
|
*
|
|
|
|
* Pipe Directions are relative to the Host, so PIPEDIR_IN means
|
|
|
|
* "coming IN over air through Target to Host" as with a WiFi Rx operation.
|
|
|
|
* Conversely, PIPEDIR_OUT means "going OUT from Host through Target over air"
|
|
|
|
* as with a WiFi Tx operation. This is somewhat awkward for the "middle-man"
|
|
|
|
* Target since things that are "PIPEDIR_OUT" are coming IN to the Target
|
|
|
|
* over the interconnect.
|
|
|
|
*/
|
|
|
|
#define PIPEDIR_NONE 0
|
|
|
|
#define PIPEDIR_IN 1 /* Target-->Host, WiFi Rx direction */
|
|
|
|
#define PIPEDIR_OUT 2 /* Host->Target, WiFi Tx direction */
|
|
|
|
#define PIPEDIR_INOUT 3 /* bidirectional */
|
|
|
|
|
|
|
|
/* Establish a mapping between a service/direction and a pipe. */
|
|
|
|
struct service_to_pipe {
|
|
|
|
__le32 service_id;
|
|
|
|
__le32 pipedir;
|
|
|
|
__le32 pipenum;
|
|
|
|
};
|
|
|
|
|
2013-06-13 01:52:10 +08:00
|
|
|
#endif /* _CE_H_ */
|