1 /* SPDX-License-Identifier: GPL-2.0-only
2  *
3  * Copyright (c) 2021, MediaTek Inc.
4  * Copyright (c) 2021-2022, Intel Corporation.
5  *
6  * Authors:
7  *  Haijun Liu <haijun.liu@mediatek.com>
8  *  Moises Veleta <moises.veleta@intel.com>
9  *
10  * Contributors:
11  *  Amir Hanania <amir.hanania@intel.com>
12  *  Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
13  *  Ricardo Martinez <ricardo.martinez@linux.intel.com>
14  */
15 
16 #ifndef __T7XX_NETDEV_H__
17 #define __T7XX_NETDEV_H__
18 
19 #include <linux/bits.h>
20 #include <linux/netdevice.h>
21 #include <linux/types.h>
22 
23 #include "t7xx_hif_dpmaif.h"
24 #include "t7xx_pci.h"
25 #include "t7xx_state_monitor.h"
26 
27 #define RXQ_NUM				DPMAIF_RXQ_NUM
28 #define NIC_DEV_MAX			21
29 #define NIC_DEV_DEFAULT			2
30 
31 #define CCMNI_NETDEV_WDT_TO		(1 * HZ)
32 #define CCMNI_MTU_MAX			3000
33 
34 struct t7xx_ccmni {
35 	u8				index;
36 	atomic_t			usage;
37 	struct net_device		*dev;
38 	struct t7xx_ccmni_ctrl		*ctlb;
39 };
40 
41 struct t7xx_ccmni_ctrl {
42 	struct t7xx_pci_dev		*t7xx_dev;
43 	struct dpmaif_ctrl		*hif_ctrl;
44 	struct t7xx_ccmni		*ccmni_inst[NIC_DEV_MAX];
45 	struct dpmaif_callbacks		callbacks;
46 	unsigned int			nic_dev_num;
47 	unsigned int			md_sta;
48 	struct t7xx_fsm_notifier	md_status_notify;
49 	bool				wwan_is_registered;
50 };
51 
52 int t7xx_ccmni_init(struct t7xx_pci_dev *t7xx_dev);
53 void t7xx_ccmni_exit(struct t7xx_pci_dev *t7xx_dev);
54 
55 #endif /* __T7XX_NETDEV_H__ */
56