.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Bluetooth supports for Qualcomm Atheros ROME chips |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
19 | 6 | */ |
---|
20 | 7 | |
---|
21 | 8 | #define EDL_PATCH_CMD_OPCODE (0xFC00) |
---|
22 | 9 | #define EDL_NVM_ACCESS_OPCODE (0xFC0B) |
---|
| 10 | +#define EDL_WRITE_BD_ADDR_OPCODE (0xFC14) |
---|
23 | 11 | #define EDL_PATCH_CMD_LEN (1) |
---|
24 | 12 | #define EDL_PATCH_VER_REQ_CMD (0x19) |
---|
25 | 13 | #define EDL_PATCH_TLV_REQ_CMD (0x1E) |
---|
26 | 14 | #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01) |
---|
27 | 15 | #define MAX_SIZE_PER_TLV_SEGMENT (243) |
---|
| 16 | +#define QCA_PRE_SHUTDOWN_CMD (0xFC08) |
---|
| 17 | +#define QCA_DISABLE_LOGGING (0xFC17) |
---|
28 | 18 | |
---|
29 | 19 | #define EDL_CMD_REQ_RES_EVT (0x00) |
---|
30 | 20 | #define EDL_PATCH_VER_RES_EVT (0x19) |
---|
.. | .. |
---|
33 | 23 | #define EDL_CMD_EXE_STATUS_EVT (0x00) |
---|
34 | 24 | #define EDL_SET_BAUDRATE_RSP_EVT (0x92) |
---|
35 | 25 | #define EDL_NVM_ACCESS_CODE_EVT (0x0B) |
---|
| 26 | +#define QCA_DISABLE_LOGGING_SUB_OP (0x14) |
---|
36 | 27 | |
---|
37 | 28 | #define EDL_TAG_ID_HCI (17) |
---|
38 | 29 | #define EDL_TAG_ID_DEEP_SLEEP (27) |
---|
.. | .. |
---|
40 | 31 | #define QCA_WCN3990_POWERON_PULSE 0xFC |
---|
41 | 32 | #define QCA_WCN3990_POWEROFF_PULSE 0xC0 |
---|
42 | 33 | |
---|
43 | | -enum qca_bardrate { |
---|
| 34 | +#define QCA_HCI_CC_OPCODE 0xFC00 |
---|
| 35 | +#define QCA_HCI_CC_SUCCESS 0x00 |
---|
| 36 | + |
---|
| 37 | +enum qca_baudrate { |
---|
44 | 38 | QCA_BAUDRATE_115200 = 0, |
---|
45 | 39 | QCA_BAUDRATE_57600, |
---|
46 | 40 | QCA_BAUDRATE_38400, |
---|
.. | .. |
---|
64 | 58 | QCA_BAUDRATE_RESERVED |
---|
65 | 59 | }; |
---|
66 | 60 | |
---|
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 |
---|
72 | 66 | }; |
---|
73 | 67 | |
---|
74 | | -enum rome_tlv_type { |
---|
| 68 | +enum qca_tlv_type { |
---|
75 | 69 | TLV_TYPE_PATCH = 1, |
---|
76 | 70 | TLV_TYPE_NVM |
---|
77 | 71 | }; |
---|
78 | 72 | |
---|
79 | | -struct rome_config { |
---|
| 73 | +struct qca_fw_config { |
---|
80 | 74 | u8 type; |
---|
81 | 75 | char fwname[64]; |
---|
82 | 76 | 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; |
---|
84 | 79 | }; |
---|
85 | 80 | |
---|
86 | 81 | struct edl_event_hdr { |
---|
87 | 82 | __u8 cresp; |
---|
88 | 83 | __u8 rtype; |
---|
89 | | - __u8 data[0]; |
---|
| 84 | + __u8 data[]; |
---|
90 | 85 | } __packed; |
---|
91 | 86 | |
---|
92 | | -struct rome_version { |
---|
| 87 | +struct qca_btsoc_version { |
---|
93 | 88 | __le32 product_id; |
---|
94 | 89 | __le16 patch_ver; |
---|
95 | | - __le16 rome_ver; |
---|
| 90 | + __le16 rom_ver; |
---|
96 | 91 | __le32 soc_id; |
---|
97 | 92 | } __packed; |
---|
98 | 93 | |
---|
.. | .. |
---|
119 | 114 | __le16 tag_len; |
---|
120 | 115 | __le32 reserve1; |
---|
121 | 116 | __le32 reserve2; |
---|
122 | | - __u8 data[0]; |
---|
| 117 | + __u8 data[]; |
---|
123 | 118 | } __packed; |
---|
124 | 119 | |
---|
125 | 120 | struct tlv_type_hdr { |
---|
126 | 121 | __le32 type_len; |
---|
127 | | - __u8 data[0]; |
---|
| 122 | + __u8 data[]; |
---|
128 | 123 | } __packed; |
---|
129 | 124 | |
---|
130 | 125 | enum qca_btsoc_type { |
---|
131 | 126 | QCA_INVALID = -1, |
---|
132 | 127 | QCA_AR3002, |
---|
133 | 128 | QCA_ROME, |
---|
134 | | - QCA_WCN3990 |
---|
| 129 | + QCA_WCN3990, |
---|
| 130 | + QCA_WCN3998, |
---|
| 131 | + QCA_WCN3991, |
---|
| 132 | + QCA_QCA6390, |
---|
135 | 133 | }; |
---|
136 | 134 | |
---|
137 | 135 | #if IS_ENABLED(CONFIG_BT_QCA) |
---|
138 | 136 | |
---|
139 | 137 | int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr); |
---|
140 | 138 | 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 | +} |
---|
144 | 150 | #else |
---|
145 | 151 | |
---|
146 | 152 | static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) |
---|
.. | .. |
---|
149 | 155 | } |
---|
150 | 156 | |
---|
151 | 157 | 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) |
---|
153 | 160 | { |
---|
154 | 161 | return -EOPNOTSUPP; |
---|
155 | 162 | } |
---|
156 | 163 | |
---|
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) |
---|
158 | 166 | { |
---|
159 | 167 | return -EOPNOTSUPP; |
---|
160 | 168 | } |
---|
161 | 169 | |
---|
| 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 | +} |
---|
162 | 184 | #endif |
---|