1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Copyright (c) 2018 Quantenna Communications, Inc. All rights reserved. */
4 #ifndef _QTN_FMAC_PCIE_H_
5 #define _QTN_FMAC_PCIE_H_
8 #include <linux/spinlock.h>
10 #include <linux/skbuff.h>
11 #include <linux/workqueue.h>
12 #include <linux/interrupt.h>
17 #define SKB_BUF_SIZE 2048
19 #define QTN_FW_DL_TIMEOUT_MS 3000
20 #define QTN_FW_QLINK_TIMEOUT_MS 30000
21 #define QTN_EP_RESET_WAIT_MS 1000
23 struct qtnf_pcie_bus_priv
{
26 int (*probe_cb
)(struct qtnf_bus
*bus
, unsigned int tx_bd_size
,
27 unsigned int rx_bd_size
);
28 void (*remove_cb
)(struct qtnf_bus
*bus
);
29 int (*suspend_cb
)(struct qtnf_bus
*bus
);
30 int (*resume_cb
)(struct qtnf_bus
*bus
);
31 u64 (*dma_mask_get_cb
)(void);
33 spinlock_t tx_reclaim_lock
;
36 struct workqueue_struct
*workqueue
;
37 struct tasklet_struct reclaim_tq
;
39 void __iomem
*sysctl_bar
;
40 void __iomem
*epmem_bar
;
41 void __iomem
*dmareg_bar
;
43 struct qtnf_shm_ipc shm_ipc_ep_in
;
44 struct qtnf_shm_ipc shm_ipc_ep_out
;
49 struct sk_buff
**tx_skb
;
50 struct sk_buff
**rx_skb
;
52 unsigned int fw_blksize
;
60 /* diagnostics stats */
72 int qtnf_pcie_control_tx(struct qtnf_bus
*bus
, struct sk_buff
*skb
);
73 int qtnf_pcie_alloc_skb_array(struct qtnf_pcie_bus_priv
*priv
);
74 int qtnf_pcie_fw_boot_done(struct qtnf_bus
*bus
);
75 void qtnf_pcie_init_shm_ipc(struct qtnf_pcie_bus_priv
*priv
,
76 struct qtnf_shm_ipc_region __iomem
*ipc_tx_reg
,
77 struct qtnf_shm_ipc_region __iomem
*ipc_rx_reg
,
78 const struct qtnf_shm_ipc_int
*ipc_int
);
79 struct qtnf_bus
*qtnf_pcie_pearl_alloc(struct pci_dev
*pdev
);
80 struct qtnf_bus
*qtnf_pcie_topaz_alloc(struct pci_dev
*pdev
);
82 static inline void qtnf_non_posted_write(u32 val
, void __iomem
*basereg
)
86 /* flush posted write */
90 #endif /* _QTN_FMAC_PCIE_H_ */