hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/bluetooth/btqca.h
....@@ -1,30 +1,20 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Bluetooth supports for Qualcomm Atheros ROME chips
34 *
45 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2
8
- * as published by the Free Software Foundation
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
- *
196 */
207
218 #define EDL_PATCH_CMD_OPCODE (0xFC00)
229 #define EDL_NVM_ACCESS_OPCODE (0xFC0B)
10
+#define EDL_WRITE_BD_ADDR_OPCODE (0xFC14)
2311 #define EDL_PATCH_CMD_LEN (1)
2412 #define EDL_PATCH_VER_REQ_CMD (0x19)
2513 #define EDL_PATCH_TLV_REQ_CMD (0x1E)
2614 #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)
2715 #define MAX_SIZE_PER_TLV_SEGMENT (243)
16
+#define QCA_PRE_SHUTDOWN_CMD (0xFC08)
17
+#define QCA_DISABLE_LOGGING (0xFC17)
2818
2919 #define EDL_CMD_REQ_RES_EVT (0x00)
3020 #define EDL_PATCH_VER_RES_EVT (0x19)
....@@ -33,6 +23,7 @@
3323 #define EDL_CMD_EXE_STATUS_EVT (0x00)
3424 #define EDL_SET_BAUDRATE_RSP_EVT (0x92)
3525 #define EDL_NVM_ACCESS_CODE_EVT (0x0B)
26
+#define QCA_DISABLE_LOGGING_SUB_OP (0x14)
3627
3728 #define EDL_TAG_ID_HCI (17)
3829 #define EDL_TAG_ID_DEEP_SLEEP (27)
....@@ -40,7 +31,10 @@
4031 #define QCA_WCN3990_POWERON_PULSE 0xFC
4132 #define QCA_WCN3990_POWEROFF_PULSE 0xC0
4233
43
-enum qca_bardrate {
34
+#define QCA_HCI_CC_OPCODE 0xFC00
35
+#define QCA_HCI_CC_SUCCESS 0x00
36
+
37
+enum qca_baudrate {
4438 QCA_BAUDRATE_115200 = 0,
4539 QCA_BAUDRATE_57600,
4640 QCA_BAUDRATE_38400,
....@@ -64,35 +58,36 @@
6458 QCA_BAUDRATE_RESERVED
6559 };
6660
67
-enum rome_tlv_dnld_mode {
68
- ROME_SKIP_EVT_NONE,
69
- ROME_SKIP_EVT_VSE,
70
- ROME_SKIP_EVT_CC,
71
- ROME_SKIP_EVT_VSE_CC
61
+enum qca_tlv_dnld_mode {
62
+ QCA_SKIP_EVT_NONE,
63
+ QCA_SKIP_EVT_VSE,
64
+ QCA_SKIP_EVT_CC,
65
+ QCA_SKIP_EVT_VSE_CC
7266 };
7367
74
-enum rome_tlv_type {
68
+enum qca_tlv_type {
7569 TLV_TYPE_PATCH = 1,
7670 TLV_TYPE_NVM
7771 };
7872
79
-struct rome_config {
73
+struct qca_fw_config {
8074 u8 type;
8175 char fwname[64];
8276 uint8_t user_baud_rate;
83
- enum rome_tlv_dnld_mode dnld_mode;
77
+ enum qca_tlv_dnld_mode dnld_mode;
78
+ enum qca_tlv_dnld_mode dnld_type;
8479 };
8580
8681 struct edl_event_hdr {
8782 __u8 cresp;
8883 __u8 rtype;
89
- __u8 data[0];
84
+ __u8 data[];
9085 } __packed;
9186
92
-struct rome_version {
87
+struct qca_btsoc_version {
9388 __le32 product_id;
9489 __le16 patch_ver;
95
- __le16 rome_ver;
90
+ __le16 rom_ver;
9691 __le32 soc_id;
9792 } __packed;
9893
....@@ -119,28 +114,39 @@
119114 __le16 tag_len;
120115 __le32 reserve1;
121116 __le32 reserve2;
122
- __u8 data[0];
117
+ __u8 data[];
123118 } __packed;
124119
125120 struct tlv_type_hdr {
126121 __le32 type_len;
127
- __u8 data[0];
122
+ __u8 data[];
128123 } __packed;
129124
130125 enum qca_btsoc_type {
131126 QCA_INVALID = -1,
132127 QCA_AR3002,
133128 QCA_ROME,
134
- QCA_WCN3990
129
+ QCA_WCN3990,
130
+ QCA_WCN3998,
131
+ QCA_WCN3991,
132
+ QCA_QCA6390,
135133 };
136134
137135 #if IS_ENABLED(CONFIG_BT_QCA)
138136
139137 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
140138 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
141
- enum qca_btsoc_type soc_type, u32 soc_ver);
142
-int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version);
143
-
139
+ enum qca_btsoc_type soc_type, u32 soc_ver,
140
+ const char *firmware_name);
141
+int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version,
142
+ enum qca_btsoc_type);
143
+int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
144
+int qca_send_pre_shutdown_cmd(struct hci_dev *hdev);
145
+static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
146
+{
147
+ return soc_type == QCA_WCN3990 || soc_type == QCA_WCN3991 ||
148
+ soc_type == QCA_WCN3998;
149
+}
144150 #else
145151
146152 static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
....@@ -149,14 +155,30 @@
149155 }
150156
151157 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
152
- enum qca_btsoc_type soc_type, u32 soc_ver)
158
+ enum qca_btsoc_type soc_type, u32 soc_ver,
159
+ const char *firmware_name)
153160 {
154161 return -EOPNOTSUPP;
155162 }
156163
157
-static inline int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version)
164
+static inline int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version,
165
+ enum qca_btsoc_type)
158166 {
159167 return -EOPNOTSUPP;
160168 }
161169
170
+static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
171
+{
172
+ return -EOPNOTSUPP;
173
+}
174
+
175
+static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type)
176
+{
177
+ return false;
178
+}
179
+
180
+static inline int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
181
+{
182
+ return -EOPNOTSUPP;
183
+}
162184 #endif