1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Bluetooth support for Intel devices
6 * Copyright (C) 2015 Intel Corporation
11 INTEL_TLV_CNVI_TOP = 0x10,
18 INTEL_TLV_USB_VENDOR_ID,
19 INTEL_TLV_USB_PRODUCT_ID,
20 INTEL_TLV_PCIE_VENDOR_ID,
21 INTEL_TLV_PCIE_DEVICE_ID,
22 INTEL_TLV_PCIE_SUBSYSTEM_ID,
27 INTEL_TLV_FW_BUILD_PRODUCT,
28 INTEL_TLV_FW_BUILD_HW,
34 INTEL_TLV_OTP_PATCH_VER,
35 INTEL_TLV_SECURE_BOOT,
36 INTEL_TLV_KEY_FROM_HDR,
41 INTEL_TLV_LIMITED_CCE,
44 INTEL_TLV_UNLOCKED_STATE
53 struct intel_version_tlv {
75 struct intel_version {
88 struct intel_boot_params {
101 __u8 min_fw_build_nn;
102 __u8 min_fw_build_cw;
103 __u8 min_fw_build_yy;
108 struct intel_bootup {
117 struct intel_secure_send_result {
131 struct intel_debug_features {
135 #define INTEL_HW_PLATFORM(cnvx_bt) ((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
136 #define INTEL_HW_VARIANT(cnvx_bt) ((u8)(((cnvx_bt) & 0x003f0000) >> 16))
137 #define INTEL_CNVX_TOP_TYPE(cnvx_top) ((cnvx_top) & 0x00000fff)
138 #define INTEL_CNVX_TOP_STEP(cnvx_top) (((cnvx_top) & 0x0f000000) >> 24)
139 #define INTEL_CNVX_TOP_PACK_SWAB(t, s) __swab16(((__u16)(((t) << 4) | (s))))
141 #if IS_ENABLED(CONFIG_BT_INTEL)
143 int btintel_check_bdaddr(struct hci_dev *hdev);
144 int btintel_enter_mfg(struct hci_dev *hdev);
145 int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
146 int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
147 int btintel_set_diag(struct hci_dev *hdev, bool enable);
148 int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable);
149 void btintel_hw_error(struct hci_dev *hdev, u8 code);
151 int btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
152 int btintel_version_info_tlv(struct hci_dev *hdev, struct intel_version_tlv *version);
153 int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
155 int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
156 int btintel_set_event_mask(struct hci_dev *hdev, bool debug);
157 int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
158 int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
159 int btintel_read_version_tlv(struct hci_dev *hdev, struct intel_version_tlv *ver);
161 struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
163 int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param);
164 int btintel_read_boot_params(struct hci_dev *hdev,
165 struct intel_boot_params *params);
166 int btintel_download_firmware(struct hci_dev *dev, struct intel_version *ver,
167 const struct firmware *fw, u32 *boot_param);
168 int btintel_download_firmware_newgen(struct hci_dev *hdev,
169 struct intel_version_tlv *ver,
170 const struct firmware *fw,
171 u32 *boot_param, u8 hw_variant,
173 void btintel_reset_to_bootloader(struct hci_dev *hdev);
174 int btintel_read_debug_features(struct hci_dev *hdev,
175 struct intel_debug_features *features);
176 int btintel_set_debug_features(struct hci_dev *hdev,
177 const struct intel_debug_features *features);
180 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
185 static inline int btintel_enter_mfg(struct hci_dev *hdev)
190 static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
195 static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
200 static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
205 static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable)
210 static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
214 static inline int btintel_version_info(struct hci_dev *hdev,
215 struct intel_version *ver)
220 static inline int btintel_version_info_tlv(struct hci_dev *hdev,
221 struct intel_version_tlv *version)
226 static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
227 u32 plen, const void *param)
232 static inline int btintel_load_ddc_config(struct hci_dev *hdev,
233 const char *ddc_name)
238 static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
243 static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
248 static inline int btintel_read_version(struct hci_dev *hdev,
249 struct intel_version *ver)
254 static inline int btintel_read_version_tlv(struct hci_dev *hdev,
255 struct intel_version_tlv *ver)
260 static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
264 return ERR_PTR(-EINVAL);
267 static inline int btintel_send_intel_reset(struct hci_dev *hdev,
273 static inline int btintel_read_boot_params(struct hci_dev *hdev,
274 struct intel_boot_params *params)
279 static inline int btintel_download_firmware(struct hci_dev *dev,
280 const struct firmware *fw,
286 static inline int btintel_download_firmware_newgen(struct hci_dev *hdev,
287 const struct firmware *fw,
289 u8 hw_variant, u8 sbe_type)
294 static inline void btintel_reset_to_bootloader(struct hci_dev *hdev)
298 static inline int btintel_read_debug_features(struct hci_dev *hdev,
299 struct intel_debug_features *features)
304 static inline int btintel_set_debug_features(struct hci_dev *hdev,
305 const struct intel_debug_features *features)