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_NVM_ACCESS_SET_REQ_CMD (0x01)
15 #define MAX_SIZE_PER_TLV_SEGMENT (243)
16 #define QCA_PRE_SHUTDOWN_CMD (0xFC08)
18 #define EDL_CMD_REQ_RES_EVT (0x00)
19 #define EDL_PATCH_VER_RES_EVT (0x19)
20 #define EDL_APP_VER_RES_EVT (0x02)
21 #define EDL_TVL_DNLD_RES_EVT (0x04)
22 #define EDL_CMD_EXE_STATUS_EVT (0x00)
23 #define EDL_SET_BAUDRATE_RSP_EVT (0x92)
24 #define EDL_NVM_ACCESS_CODE_EVT (0x0B)
26 #define EDL_TAG_ID_HCI (17)
27 #define EDL_TAG_ID_DEEP_SLEEP (27)
29 #define QCA_WCN3990_POWERON_PULSE 0xFC
30 #define QCA_WCN3990_POWEROFF_PULSE 0xC0
32 #define QCA_HCI_CC_OPCODE 0xFC00
33 #define QCA_HCI_CC_SUCCESS 0x00
36 QCA_BAUDRATE_115200
= 0,
55 QCA_BAUDRATE_AUTO
= 0xFE,
59 enum qca_tlv_dnld_mode
{
71 struct qca_fw_config
{
74 uint8_t user_baud_rate
;
75 enum qca_tlv_dnld_mode dnld_mode
;
76 enum qca_tlv_dnld_mode dnld_type
;
79 struct edl_event_hdr
{
85 struct qca_btsoc_version
{
96 struct tlv_type_patch
{
105 __le16 patch_version
;
110 struct tlv_type_nvm
{
118 struct tlv_type_hdr
{
123 enum qca_btsoc_type
{
132 #if IS_ENABLED(CONFIG_BT_QCA)
134 int qca_set_bdaddr_rome(struct hci_dev
*hdev
, const bdaddr_t
*bdaddr
);
135 int qca_uart_setup(struct hci_dev
*hdev
, uint8_t baudrate
,
136 enum qca_btsoc_type soc_type
, u32 soc_ver
,
137 const char *firmware_name
);
138 int qca_read_soc_version(struct hci_dev
*hdev
, u32
*soc_version
,
139 enum qca_btsoc_type
);
140 int qca_set_bdaddr(struct hci_dev
*hdev
, const bdaddr_t
*bdaddr
);
141 int qca_send_pre_shutdown_cmd(struct hci_dev
*hdev
);
142 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type
)
144 return soc_type
== QCA_WCN3990
|| soc_type
== QCA_WCN3991
||
145 soc_type
== QCA_WCN3998
;
149 static inline int qca_set_bdaddr_rome(struct hci_dev
*hdev
, const bdaddr_t
*bdaddr
)
154 static inline int qca_uart_setup(struct hci_dev
*hdev
, uint8_t baudrate
,
155 enum qca_btsoc_type soc_type
, u32 soc_ver
,
156 const char *firmware_name
)
161 static inline int qca_read_soc_version(struct hci_dev
*hdev
, u32
*soc_version
,
167 static inline int qca_set_bdaddr(struct hci_dev
*hdev
, const bdaddr_t
*bdaddr
)
172 static inline bool qca_is_wcn399x(enum qca_btsoc_type soc_type
)
177 static inline int qca_send_pre_shutdown_cmd(struct hci_dev
*hdev
)