1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Bluetooth supports for Qualcomm Atheros ROME chips
5 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
8 #define EDL_PATCH_CMD_OPCODE (0xFC00)
9 #define EDL_NVM_ACCESS_OPCODE (0xFC0B)
10 #define EDL_WRITE_BD_ADDR_OPCODE (0xFC14)
11 #define EDL_PATCH_CMD_LEN (1)
12 #define EDL_PATCH_VER_REQ_CMD (0x19)
13 #define EDL_PATCH_TLV_REQ_CMD (0x1E)
14 #define EDL_GET_BUILD_INFO_CMD (0x20)
15 #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)
16 #define EDL_PATCH_CONFIG_CMD (0x28)
17 #define MAX_SIZE_PER_TLV_SEGMENT (243)
18 #define QCA_PRE_SHUTDOWN_CMD (0xFC08)
19 #define QCA_DISABLE_LOGGING (0xFC17)
21 #define EDL_CMD_REQ_RES_EVT (0x00)
22 #define EDL_PATCH_VER_RES_EVT (0x19)
23 #define EDL_APP_VER_RES_EVT (0x02)
24 #define EDL_TVL_DNLD_RES_EVT (0x04)
25 #define EDL_CMD_EXE_STATUS_EVT (0x00)
26 #define EDL_SET_BAUDRATE_RSP_EVT (0x92)
27 #define EDL_NVM_ACCESS_CODE_EVT (0x0B)
28 #define EDL_PATCH_CONFIG_RES_EVT (0x00)
29 #define QCA_DISABLE_LOGGING_SUB_OP (0x14)
31 #define EDL_TAG_ID_HCI (17)
32 #define EDL_TAG_ID_DEEP_SLEEP (27)
34 #define QCA_WCN3990_POWERON_PULSE 0xFC
35 #define QCA_WCN3990_POWEROFF_PULSE 0xC0
37 #define QCA_HCI_CC_OPCODE 0xFC00
38 #define QCA_HCI_CC_SUCCESS 0x00
40 #define QCA_WCN3991_SOC_ID (0x40014320)
42 /* QCA chipset version can be decided by patch and SoC
43 * version, combination with upper 2 bytes from SoC
44 * and lower 2 bytes from patch will be used.
46 #define get_soc_ver(soc_id, rom_ver) \
47 ((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver)))
49 #define QCA_FW_BUILD_VER_LEN 255
53 QCA_BAUDRATE_115200 = 0,
72 QCA_BAUDRATE_AUTO = 0xFE,
76 enum qca_tlv_dnld_mode {
89 struct qca_fw_config {
92 uint8_t user_baud_rate;
93 enum qca_tlv_dnld_mode dnld_mode;
94 enum qca_tlv_dnld_mode dnld_type;
97 struct edl_event_hdr {
103 struct qca_btsoc_version {
110 struct tlv_seg_resp {
114 struct tlv_type_patch {
123 __le16 patch_version;
128 struct tlv_type_nvm {
136 struct tlv_type_hdr {
141 enum qca_btsoc_type {
155 #if IS_ENABLED(CONFIG_BT_QCA)
157 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
158 int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
159 enum qca_btsoc_type soc_type, struct qca_btsoc_version ver,
160 const char *firmware_name);
161 int qca_read_soc_version(struct hci_dev *hdev, struct qca_btsoc_version *ver,
162 enum qca_btsoc_type);
163 int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
164 int qca_send_pre_shutdown_cmd(struct hci_dev *hdev);
167 static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
172 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
173 enum qca_btsoc_type soc_type,
174 struct qca_btsoc_version ver,
175 const char *firmware_name)
180 static inline int qca_read_soc_version(struct hci_dev *hdev,
181 struct qca_btsoc_version *ver,
187 static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
192 static inline int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)