| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Bluetooth support for Intel devices |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2015 Intel Corporation |
|---|
| 6 | | - * |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 21 | | - * |
|---|
| 22 | 7 | */ |
|---|
| 8 | + |
|---|
| 9 | +/* List of tlv type */ |
|---|
| 10 | +enum { |
|---|
| 11 | + INTEL_TLV_CNVI_TOP = 0x10, |
|---|
| 12 | + INTEL_TLV_CNVR_TOP, |
|---|
| 13 | + INTEL_TLV_CNVI_BT, |
|---|
| 14 | + INTEL_TLV_CNVR_BT, |
|---|
| 15 | + INTEL_TLV_CNVI_OTP, |
|---|
| 16 | + INTEL_TLV_CNVR_OTP, |
|---|
| 17 | + INTEL_TLV_DEV_REV_ID, |
|---|
| 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, |
|---|
| 23 | + INTEL_TLV_IMAGE_TYPE, |
|---|
| 24 | + INTEL_TLV_TIME_STAMP, |
|---|
| 25 | + INTEL_TLV_BUILD_TYPE, |
|---|
| 26 | + INTEL_TLV_BUILD_NUM, |
|---|
| 27 | + INTEL_TLV_FW_BUILD_PRODUCT, |
|---|
| 28 | + INTEL_TLV_FW_BUILD_HW, |
|---|
| 29 | + INTEL_TLV_FW_STEP, |
|---|
| 30 | + INTEL_TLV_BT_SPEC, |
|---|
| 31 | + INTEL_TLV_MFG_NAME, |
|---|
| 32 | + INTEL_TLV_HCI_REV, |
|---|
| 33 | + INTEL_TLV_LMP_SUBVER, |
|---|
| 34 | + INTEL_TLV_OTP_PATCH_VER, |
|---|
| 35 | + INTEL_TLV_SECURE_BOOT, |
|---|
| 36 | + INTEL_TLV_KEY_FROM_HDR, |
|---|
| 37 | + INTEL_TLV_OTP_LOCK, |
|---|
| 38 | + INTEL_TLV_API_LOCK, |
|---|
| 39 | + INTEL_TLV_DEBUG_LOCK, |
|---|
| 40 | + INTEL_TLV_MIN_FW, |
|---|
| 41 | + INTEL_TLV_LIMITED_CCE, |
|---|
| 42 | + INTEL_TLV_SBE_TYPE, |
|---|
| 43 | + INTEL_TLV_OTP_BDADDR, |
|---|
| 44 | + INTEL_TLV_UNLOCKED_STATE |
|---|
| 45 | +}; |
|---|
| 46 | + |
|---|
| 47 | +struct intel_tlv { |
|---|
| 48 | + u8 type; |
|---|
| 49 | + u8 len; |
|---|
| 50 | + u8 val[]; |
|---|
| 51 | +} __packed; |
|---|
| 52 | + |
|---|
| 53 | +struct intel_version_tlv { |
|---|
| 54 | + u32 cnvi_top; |
|---|
| 55 | + u32 cnvr_top; |
|---|
| 56 | + u32 cnvi_bt; |
|---|
| 57 | + u32 cnvr_bt; |
|---|
| 58 | + u16 dev_rev_id; |
|---|
| 59 | + u8 img_type; |
|---|
| 60 | + u16 timestamp; |
|---|
| 61 | + u8 build_type; |
|---|
| 62 | + u32 build_num; |
|---|
| 63 | + u8 secure_boot; |
|---|
| 64 | + u8 otp_lock; |
|---|
| 65 | + u8 api_lock; |
|---|
| 66 | + u8 debug_lock; |
|---|
| 67 | + u8 min_fw_build_nn; |
|---|
| 68 | + u8 min_fw_build_cw; |
|---|
| 69 | + u8 min_fw_build_yy; |
|---|
| 70 | + u8 limited_cce; |
|---|
| 71 | + u8 sbe_type; |
|---|
| 72 | + bdaddr_t otp_bd_addr; |
|---|
| 73 | +}; |
|---|
| 23 | 74 | |
|---|
| 24 | 75 | struct intel_version { |
|---|
| 25 | 76 | u8 status; |
|---|
| .. | .. |
|---|
| 77 | 128 | __le32 boot_param; |
|---|
| 78 | 129 | } __packed; |
|---|
| 79 | 130 | |
|---|
| 131 | +struct intel_debug_features { |
|---|
| 132 | + __u8 page1[16]; |
|---|
| 133 | +} __packed; |
|---|
| 134 | + |
|---|
| 80 | 135 | #if IS_ENABLED(CONFIG_BT_INTEL) |
|---|
| 81 | 136 | |
|---|
| 82 | 137 | int btintel_check_bdaddr(struct hci_dev *hdev); |
|---|
| .. | .. |
|---|
| 88 | 143 | void btintel_hw_error(struct hci_dev *hdev, u8 code); |
|---|
| 89 | 144 | |
|---|
| 90 | 145 | void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver); |
|---|
| 146 | +void btintel_version_info_tlv(struct hci_dev *hdev, struct intel_version_tlv *version); |
|---|
| 91 | 147 | int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen, |
|---|
| 92 | 148 | const void *param); |
|---|
| 93 | 149 | int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name); |
|---|
| 94 | 150 | int btintel_set_event_mask(struct hci_dev *hdev, bool debug); |
|---|
| 95 | 151 | int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug); |
|---|
| 96 | 152 | int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver); |
|---|
| 153 | +int btintel_read_version_tlv(struct hci_dev *hdev, struct intel_version_tlv *ver); |
|---|
| 97 | 154 | |
|---|
| 98 | 155 | struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read, |
|---|
| 99 | 156 | u16 opcode_write); |
|---|
| .. | .. |
|---|
| 102 | 159 | struct intel_boot_params *params); |
|---|
| 103 | 160 | int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw, |
|---|
| 104 | 161 | u32 *boot_param); |
|---|
| 162 | +int btintel_download_firmware_newgen(struct hci_dev *hdev, |
|---|
| 163 | + const struct firmware *fw, |
|---|
| 164 | + u32 *boot_param, u8 hw_variant, |
|---|
| 165 | + u8 sbe_type); |
|---|
| 166 | +void btintel_reset_to_bootloader(struct hci_dev *hdev); |
|---|
| 167 | +int btintel_read_debug_features(struct hci_dev *hdev, |
|---|
| 168 | + struct intel_debug_features *features); |
|---|
| 169 | +int btintel_set_debug_features(struct hci_dev *hdev, |
|---|
| 170 | + const struct intel_debug_features *features); |
|---|
| 105 | 171 | #else |
|---|
| 106 | 172 | |
|---|
| 107 | 173 | static inline int btintel_check_bdaddr(struct hci_dev *hdev) |
|---|
| .. | .. |
|---|
| 143 | 209 | { |
|---|
| 144 | 210 | } |
|---|
| 145 | 211 | |
|---|
| 212 | +static inline void btintel_version_info_tlv(struct hci_dev *hdev, |
|---|
| 213 | + struct intel_version_tlv *version) |
|---|
| 214 | +{ |
|---|
| 215 | +} |
|---|
| 216 | + |
|---|
| 146 | 217 | static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, |
|---|
| 147 | 218 | u32 plen, const void *param) |
|---|
| 148 | 219 | { |
|---|
| .. | .. |
|---|
| 167 | 238 | |
|---|
| 168 | 239 | static inline int btintel_read_version(struct hci_dev *hdev, |
|---|
| 169 | 240 | struct intel_version *ver) |
|---|
| 241 | +{ |
|---|
| 242 | + return -EOPNOTSUPP; |
|---|
| 243 | +} |
|---|
| 244 | + |
|---|
| 245 | +static inline int btintel_read_version_tlv(struct hci_dev *hdev, |
|---|
| 246 | + struct intel_version_tlv *ver) |
|---|
| 170 | 247 | { |
|---|
| 171 | 248 | return -EOPNOTSUPP; |
|---|
| 172 | 249 | } |
|---|
| .. | .. |
|---|
| 196 | 273 | { |
|---|
| 197 | 274 | return -EOPNOTSUPP; |
|---|
| 198 | 275 | } |
|---|
| 276 | + |
|---|
| 277 | +static inline int btintel_download_firmware_newgen(struct hci_dev *hdev, |
|---|
| 278 | + const struct firmware *fw, |
|---|
| 279 | + u32 *boot_param, |
|---|
| 280 | + u8 hw_variant, u8 sbe_type) |
|---|
| 281 | +{ |
|---|
| 282 | + return -EOPNOTSUPP; |
|---|
| 283 | +} |
|---|
| 284 | + |
|---|
| 285 | +static inline void btintel_reset_to_bootloader(struct hci_dev *hdev) |
|---|
| 286 | +{ |
|---|
| 287 | +} |
|---|
| 288 | + |
|---|
| 289 | +static inline int btintel_read_debug_features(struct hci_dev *hdev, |
|---|
| 290 | + struct intel_debug_features *features) |
|---|
| 291 | +{ |
|---|
| 292 | + return -EOPNOTSUPP; |
|---|
| 293 | +} |
|---|
| 294 | + |
|---|
| 295 | +static inline int btintel_set_debug_features(struct hci_dev *hdev, |
|---|
| 296 | + const struct intel_debug_features *features) |
|---|
| 297 | +{ |
|---|
| 298 | + return -EOPNOTSUPP; |
|---|
| 299 | +} |
|---|
| 300 | + |
|---|
| 199 | 301 | #endif |
|---|