0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef __T7XX_PORT_H__
0019 #define __T7XX_PORT_H__
0020
0021 #include <linux/bits.h>
0022 #include <linux/device.h>
0023 #include <linux/mutex.h>
0024 #include <linux/sched.h>
0025 #include <linux/skbuff.h>
0026 #include <linux/spinlock.h>
0027 #include <linux/types.h>
0028 #include <linux/wait.h>
0029 #include <linux/wwan.h>
0030
0031 #include "t7xx_hif_cldma.h"
0032 #include "t7xx_pci.h"
0033
0034 #define PORT_CH_ID_MASK GENMASK(7, 0)
0035
0036
0037
0038
0039
0040
0041 enum port_ch {
0042
0043 PORT_CH_CONTROL_RX = 0x2000,
0044 PORT_CH_CONTROL_TX = 0x2001,
0045 PORT_CH_UART1_RX = 0x2006,
0046 PORT_CH_UART1_TX = 0x2008,
0047 PORT_CH_UART2_RX = 0x200a,
0048 PORT_CH_UART2_TX = 0x200c,
0049 PORT_CH_MD_LOG_RX = 0x202a,
0050 PORT_CH_MD_LOG_TX = 0x202b,
0051 PORT_CH_LB_IT_RX = 0x203e,
0052 PORT_CH_LB_IT_TX = 0x203f,
0053 PORT_CH_STATUS_RX = 0x2043,
0054 PORT_CH_MIPC_RX = 0x20ce,
0055 PORT_CH_MIPC_TX = 0x20cf,
0056 PORT_CH_MBIM_RX = 0x20d0,
0057 PORT_CH_MBIM_TX = 0x20d1,
0058 PORT_CH_DSS0_RX = 0x20d2,
0059 PORT_CH_DSS0_TX = 0x20d3,
0060 PORT_CH_DSS1_RX = 0x20d4,
0061 PORT_CH_DSS1_TX = 0x20d5,
0062 PORT_CH_DSS2_RX = 0x20d6,
0063 PORT_CH_DSS2_TX = 0x20d7,
0064 PORT_CH_DSS3_RX = 0x20d8,
0065 PORT_CH_DSS3_TX = 0x20d9,
0066 PORT_CH_DSS4_RX = 0x20da,
0067 PORT_CH_DSS4_TX = 0x20db,
0068 PORT_CH_DSS5_RX = 0x20dc,
0069 PORT_CH_DSS5_TX = 0x20dd,
0070 PORT_CH_DSS6_RX = 0x20de,
0071 PORT_CH_DSS6_TX = 0x20df,
0072 PORT_CH_DSS7_RX = 0x20e0,
0073 PORT_CH_DSS7_TX = 0x20e1,
0074 };
0075
0076 struct t7xx_port;
0077 struct port_ops {
0078 int (*init)(struct t7xx_port *port);
0079 int (*recv_skb)(struct t7xx_port *port, struct sk_buff *skb);
0080 void (*md_state_notify)(struct t7xx_port *port, unsigned int md_state);
0081 void (*uninit)(struct t7xx_port *port);
0082 int (*enable_chl)(struct t7xx_port *port);
0083 int (*disable_chl)(struct t7xx_port *port);
0084 };
0085
0086 struct t7xx_port_conf {
0087 enum port_ch tx_ch;
0088 enum port_ch rx_ch;
0089 unsigned char txq_index;
0090 unsigned char rxq_index;
0091 unsigned char txq_exp_index;
0092 unsigned char rxq_exp_index;
0093 enum cldma_id path_id;
0094 struct port_ops *ops;
0095 char *name;
0096 enum wwan_port_type port_type;
0097 };
0098
0099 struct t7xx_port {
0100
0101 const struct t7xx_port_conf *port_conf;
0102 struct wwan_port *wwan_port;
0103 struct t7xx_pci_dev *t7xx_dev;
0104 struct device *dev;
0105 u16 seq_nums[2];
0106 atomic_t usage_cnt;
0107 struct list_head entry;
0108 struct list_head queue_entry;
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119 struct sk_buff_head rx_skb_list;
0120 spinlock_t port_update_lock;
0121 wait_queue_head_t rx_wq;
0122 int rx_length_th;
0123 bool chan_enable;
0124 struct task_struct *thread;
0125 };
0126
0127 struct sk_buff *t7xx_port_alloc_skb(int payload);
0128 struct sk_buff *t7xx_ctrl_alloc_skb(int payload);
0129 int t7xx_port_enqueue_skb(struct t7xx_port *port, struct sk_buff *skb);
0130 int t7xx_port_send_skb(struct t7xx_port *port, struct sk_buff *skb, unsigned int pkt_header,
0131 unsigned int ex_msg);
0132 int t7xx_port_send_ctl_skb(struct t7xx_port *port, struct sk_buff *skb, unsigned int msg,
0133 unsigned int ex_msg);
0134
0135 #endif