Linux 4.19.133
[linux/fpc-iii.git] / drivers / bluetooth / btqca.h
blob0c01f375fe8331908b9bdede207e3a0af38ed0b8
1 /*
2 * Bluetooth supports for Qualcomm Atheros ROME chips
4 * Copyright (c) 2015 The Linux Foundation. All rights reserved.
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
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.
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
21 #define EDL_PATCH_CMD_OPCODE (0xFC00)
22 #define EDL_NVM_ACCESS_OPCODE (0xFC0B)
23 #define EDL_PATCH_CMD_LEN (1)
24 #define EDL_PATCH_VER_REQ_CMD (0x19)
25 #define EDL_PATCH_TLV_REQ_CMD (0x1E)
26 #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)
27 #define MAX_SIZE_PER_TLV_SEGMENT (243)
29 #define EDL_CMD_REQ_RES_EVT (0x00)
30 #define EDL_PATCH_VER_RES_EVT (0x19)
31 #define EDL_APP_VER_RES_EVT (0x02)
32 #define EDL_TVL_DNLD_RES_EVT (0x04)
33 #define EDL_CMD_EXE_STATUS_EVT (0x00)
34 #define EDL_SET_BAUDRATE_RSP_EVT (0x92)
35 #define EDL_NVM_ACCESS_CODE_EVT (0x0B)
37 #define EDL_TAG_ID_HCI (17)
38 #define EDL_TAG_ID_DEEP_SLEEP (27)
40 #define QCA_WCN3990_POWERON_PULSE 0xFC
41 #define QCA_WCN3990_POWEROFF_PULSE 0xC0
43 enum qca_bardrate {
44 QCA_BAUDRATE_115200 = 0,
45 QCA_BAUDRATE_57600,
46 QCA_BAUDRATE_38400,
47 QCA_BAUDRATE_19200,
48 QCA_BAUDRATE_9600,
49 QCA_BAUDRATE_230400,
50 QCA_BAUDRATE_250000,
51 QCA_BAUDRATE_460800,
52 QCA_BAUDRATE_500000,
53 QCA_BAUDRATE_720000,
54 QCA_BAUDRATE_921600,
55 QCA_BAUDRATE_1000000,
56 QCA_BAUDRATE_1250000,
57 QCA_BAUDRATE_2000000,
58 QCA_BAUDRATE_3000000,
59 QCA_BAUDRATE_4000000,
60 QCA_BAUDRATE_1600000,
61 QCA_BAUDRATE_3200000,
62 QCA_BAUDRATE_3500000,
63 QCA_BAUDRATE_AUTO = 0xFE,
64 QCA_BAUDRATE_RESERVED
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
74 enum rome_tlv_type {
75 TLV_TYPE_PATCH = 1,
76 TLV_TYPE_NVM
79 struct rome_config {
80 u8 type;
81 char fwname[64];
82 uint8_t user_baud_rate;
83 enum rome_tlv_dnld_mode dnld_mode;
86 struct edl_event_hdr {
87 __u8 cresp;
88 __u8 rtype;
89 __u8 data[0];
90 } __packed;
92 struct rome_version {
93 __le32 product_id;
94 __le16 patch_ver;
95 __le16 rome_ver;
96 __le32 soc_id;
97 } __packed;
99 struct tlv_seg_resp {
100 __u8 result;
101 } __packed;
103 struct tlv_type_patch {
104 __le32 total_size;
105 __le32 data_length;
106 __u8 format_version;
107 __u8 signature;
108 __u8 download_mode;
109 __u8 reserved1;
110 __le16 product_id;
111 __le16 rom_build;
112 __le16 patch_version;
113 __le16 reserved2;
114 __le32 entry;
115 } __packed;
117 struct tlv_type_nvm {
118 __le16 tag_id;
119 __le16 tag_len;
120 __le32 reserve1;
121 __le32 reserve2;
122 __u8 data[0];
123 } __packed;
125 struct tlv_type_hdr {
126 __le32 type_len;
127 __u8 data[0];
128 } __packed;
130 enum qca_btsoc_type {
131 QCA_INVALID = -1,
132 QCA_AR3002,
133 QCA_ROME,
134 QCA_WCN3990
137 #if IS_ENABLED(CONFIG_BT_QCA)
139 int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr);
140 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);
144 #else
146 static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
148 return -EOPNOTSUPP;
151 static inline int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
152 enum qca_btsoc_type soc_type, u32 soc_ver)
154 return -EOPNOTSUPP;
157 static inline int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version)
159 return -EOPNOTSUPP;
162 #endif