1 /* SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2021, MediaTek Inc.
4 * Copyright (c) 2021-2022, Intel Corporation.
18 #ifndef __T7XX_PORT_PROXY_H__
19 #define __T7XX_PORT_PROXY_H__
21 #include <linux/bits.h>
22 #include <linux/device.h>
23 #include <linux/skbuff.h>
24 #include <linux/types.h>
26 #include "t7xx_hif_cldma.h"
27 #include "t7xx_modem_ops.h"
28 #include "t7xx_port.h"
31 #define RX_QUEUE_MAXLEN 32
32 #define CTRL_QUEUE_MAXLEN 16
36 struct list_head rx_ch_ports[PORT_CH_ID_MASK + 1];
37 struct list_head queue_ports[CLDMA_NUM][MTK_QUEUES];
39 struct t7xx_port ports[];
49 /* Coupled with HW - indicates if there is data following the CCCI header or not */
50 #define CCCI_HEADER_NO_DATA 0xffffffff
52 #define CCCI_H_AST_BIT BIT(31)
53 #define CCCI_H_SEQ_FLD GENMASK(30, 16)
54 #define CCCI_H_CHN_FLD GENMASK(15, 0)
56 struct ctrl_msg_header {
62 /* Control identification numbers for AP<->MD messages */
63 #define CTL_ID_HS1_MSG 0x0
64 #define CTL_ID_HS2_MSG 0x1
65 #define CTL_ID_HS3_MSG 0x2
66 #define CTL_ID_MD_EX 0x4
67 #define CTL_ID_DRV_VER_ERROR 0x5
68 #define CTL_ID_MD_EX_ACK 0x6
69 #define CTL_ID_MD_EX_PASS 0x8
70 #define CTL_ID_PORT_ENUM 0x9
72 /* Modem exception check identification code - "EXCP" */
73 #define MD_EX_CHK_ID 0x45584350
74 /* Modem exception check acknowledge identification code - "EREC" */
75 #define MD_EX_CHK_ACK_ID 0x45524543
77 #define PORT_INFO_RSRVD GENMASK(31, 16)
78 #define PORT_INFO_ENFLG BIT(15)
79 #define PORT_INFO_CH_ID GENMASK(14, 0)
81 #define PORT_ENUM_VER 0
82 #define PORT_ENUM_HEAD_PATTERN 0x5a5a5a5a
83 #define PORT_ENUM_TAIL_PATTERN 0xa5a5a5a5
84 #define PORT_ENUM_VER_MISMATCH 0x00657272
86 /* Port operations mapping */
87 extern struct port_ops wwan_sub_port_ops;
88 extern struct port_ops ctl_port_ops;
90 #ifdef CONFIG_WWAN_DEBUGFS
91 extern struct port_ops t7xx_trace_port_ops;
94 void t7xx_port_proxy_reset(struct port_proxy *port_prox);
95 void t7xx_port_proxy_uninit(struct port_proxy *port_prox);
96 int t7xx_port_proxy_init(struct t7xx_modem *md);
97 void t7xx_port_proxy_md_status_notify(struct port_proxy *port_prox, unsigned int state);
98 int t7xx_port_enum_msg_handler(struct t7xx_modem *md, void *msg);
99 int t7xx_port_proxy_chl_enable_disable(struct port_proxy *port_prox, unsigned int ch_id,
102 #endif /* __T7XX_PORT_PROXY_H__ */