1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2012 GCT Semiconductor, Inc. All rights reserved. */
3 
4 #ifndef _GDM_LTE_H_
5 #define _GDM_LTE_H_
6 
7 #include <linux/netdevice.h>
8 #include <linux/types.h>
9 
10 #include "gdm_endian.h"
11 
12 #define MAX_NIC_TYPE		4
13 #define MAX_RX_SUBMIT_COUNT	3
14 #define DRIVER_VERSION		"3.7.17.0"
15 
16 enum TX_ERROR_CODE {
17 	TX_NO_ERROR = 0,
18 	TX_NO_DEV,
19 	TX_NO_SPC,
20 	TX_NO_BUFFER,
21 };
22 
23 enum CALLBACK_CONTEXT {
24 	KERNEL_THREAD = 0,
25 	USB_COMPLETE,
26 };
27 
28 struct pdn_table {
29 	u8 activate;
30 	u32 dft_eps_id;
31 	u32 nic_type;
32 } __packed;
33 
34 struct nic;
35 
36 struct phy_dev {
37 	void	*priv_dev;
38 	struct net_device *dev[MAX_NIC_TYPE];
39 	int	(*send_hci_func)(void *priv_dev, void *data, int len,
40 				 void (*cb)(void *cb_data), void *cb_data);
41 	int	(*send_sdu_func)(void *priv_dev, void *data, int len,
42 				 unsigned int dft_eps_id, unsigned int eps_id,
43 				 void (*cb)(void *cb_data), void *cb_data,
44 				 int dev_idx, int nic_type);
45 	int	(*rcv_func)(void *priv_dev,
46 			    int (*cb)(void *cb_data, void *data, int len,
47 				      int context),
48 			    void *cb_data, int context);
49 	u8 (*get_endian)(void *priv_dev);
50 };
51 
52 struct nic {
53 	struct net_device *netdev;
54 	struct phy_dev *phy_dev;
55 	struct net_device_stats stats;
56 	struct pdn_table pdn_table;
57 	u8 dest_mac_addr[ETH_ALEN];
58 	u8 src_mac_addr[ETH_ALEN];
59 	u32 nic_id;
60 	u16 vlan_id;
61 };
62 
63 int gdm_lte_event_init(void);
64 void gdm_lte_event_exit(void);
65 
66 void start_rx_proc(struct phy_dev *phy_dev);
67 int register_lte_device(struct phy_dev *phy_dev, struct device *dev,
68 			u8 *mac_address);
69 void unregister_lte_device(struct phy_dev *phy_dev);
70 
71 #endif /* _GDM_LTE_H_ */
72