Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * Bluetooth support for Intel devices |
| 5 | * |
| 6 | * Copyright (C) 2015 Intel Corporation |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Marcel Holtmann | 59a077c | 2015-04-06 00:52:13 -0700 | [diff] [blame] | 9 | struct intel_version { |
| 10 | u8 status; |
| 11 | u8 hw_platform; |
| 12 | u8 hw_variant; |
| 13 | u8 hw_revision; |
| 14 | u8 fw_variant; |
| 15 | u8 fw_revision; |
| 16 | u8 fw_build_num; |
| 17 | u8 fw_build_ww; |
| 18 | u8 fw_build_yy; |
| 19 | u8 fw_patch_num; |
| 20 | } __packed; |
| 21 | |
| 22 | struct intel_boot_params { |
| 23 | __u8 status; |
| 24 | __u8 otp_format; |
| 25 | __u8 otp_content; |
| 26 | __u8 otp_patch; |
| 27 | __le16 dev_revid; |
| 28 | __u8 secure_boot; |
| 29 | __u8 key_from_hdr; |
| 30 | __u8 key_type; |
| 31 | __u8 otp_lock; |
| 32 | __u8 api_lock; |
| 33 | __u8 debug_lock; |
| 34 | bdaddr_t otp_bdaddr; |
| 35 | __u8 min_fw_build_nn; |
| 36 | __u8 min_fw_build_cw; |
| 37 | __u8 min_fw_build_yy; |
| 38 | __u8 limited_cce; |
| 39 | __u8 unlocked_state; |
| 40 | } __packed; |
| 41 | |
Marcel Holtmann | ccd6da2 | 2015-04-09 00:35:19 -0700 | [diff] [blame] | 42 | struct intel_bootup { |
| 43 | __u8 zero; |
| 44 | __u8 num_cmds; |
| 45 | __u8 source; |
| 46 | __u8 reset_type; |
| 47 | __u8 reset_reason; |
| 48 | __u8 ddc_status; |
| 49 | } __packed; |
| 50 | |
| 51 | struct intel_secure_send_result { |
| 52 | __u8 result; |
| 53 | __le16 opcode; |
| 54 | __u8 status; |
| 55 | } __packed; |
| 56 | |
Tedd Ho-Jeong An | e5889af | 2018-01-24 09:19:18 -0800 | [diff] [blame] | 57 | struct intel_reset { |
| 58 | __u8 reset_type; |
| 59 | __u8 patch_enable; |
| 60 | __u8 ddc_reload; |
| 61 | __u8 boot_option; |
| 62 | __le32 boot_param; |
| 63 | } __packed; |
| 64 | |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 65 | #if IS_ENABLED(CONFIG_BT_INTEL) |
| 66 | |
| 67 | int btintel_check_bdaddr(struct hci_dev *hdev); |
Loic Poulain | 28dc4b9 | 2015-12-03 16:10:22 +0100 | [diff] [blame] | 68 | int btintel_enter_mfg(struct hci_dev *hdev); |
| 69 | int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched); |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 70 | int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); |
Marcel Holtmann | 6d2e50d | 2015-10-09 14:42:08 +0200 | [diff] [blame] | 71 | int btintel_set_diag(struct hci_dev *hdev, bool enable); |
Marcel Holtmann | 3e24767 | 2015-10-17 16:00:28 +0200 | [diff] [blame] | 72 | int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable); |
Marcel Holtmann | 973bb97 | 2015-07-05 14:37:38 +0200 | [diff] [blame] | 73 | void btintel_hw_error(struct hci_dev *hdev, u8 code); |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 74 | |
Marcel Holtmann | 7feb99e | 2015-07-05 15:02:07 +0200 | [diff] [blame] | 75 | void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver); |
Marcel Holtmann | 09df123 | 2015-07-05 14:55:36 +0200 | [diff] [blame] | 76 | int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen, |
| 77 | const void *param); |
Loic Poulain | 145f236 | 2015-09-04 17:54:34 +0200 | [diff] [blame] | 78 | int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name); |
Marcel Holtmann | 213445b | 2015-10-21 02:45:19 +0200 | [diff] [blame] | 79 | int btintel_set_event_mask(struct hci_dev *hdev, bool debug); |
| 80 | int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug); |
Loic Poulain | 6c483de | 2015-12-06 16:18:34 +0100 | [diff] [blame] | 81 | int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver); |
Marcel Holtmann | 09df123 | 2015-07-05 14:55:36 +0200 | [diff] [blame] | 82 | |
Loic Poulain | d06f107 | 2015-10-01 18:16:21 +0200 | [diff] [blame] | 83 | struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read, |
| 84 | u16 opcode_write); |
Tedd Ho-Jeong An | e5889af | 2018-01-24 09:19:18 -0800 | [diff] [blame] | 85 | int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param); |
Tedd Ho-Jeong An | faf174d | 2018-01-24 09:19:20 -0800 | [diff] [blame] | 86 | int btintel_read_boot_params(struct hci_dev *hdev, |
| 87 | struct intel_boot_params *params); |
Tedd Ho-Jeong An | fbbe83c | 2018-01-24 09:19:21 -0800 | [diff] [blame] | 88 | int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw, |
| 89 | u32 *boot_param); |
Amit K Bag | b9a2562 | 2019-10-17 13:52:29 +0530 | [diff] [blame] | 90 | void btintel_reset_to_bootloader(struct hci_dev *hdev); |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 91 | #else |
| 92 | |
| 93 | static inline int btintel_check_bdaddr(struct hci_dev *hdev) |
| 94 | { |
| 95 | return -EOPNOTSUPP; |
| 96 | } |
| 97 | |
Loic Poulain | 28dc4b9 | 2015-12-03 16:10:22 +0100 | [diff] [blame] | 98 | static inline int btintel_enter_mfg(struct hci_dev *hdev) |
| 99 | { |
| 100 | return -EOPNOTSUPP; |
| 101 | } |
| 102 | |
| 103 | static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched) |
| 104 | { |
| 105 | return -EOPNOTSUPP; |
| 106 | } |
| 107 | |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 108 | static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) |
| 109 | { |
| 110 | return -EOPNOTSUPP; |
| 111 | } |
| 112 | |
Marcel Holtmann | 6d2e50d | 2015-10-09 14:42:08 +0200 | [diff] [blame] | 113 | static inline int btintel_set_diag(struct hci_dev *hdev, bool enable) |
| 114 | { |
| 115 | return -EOPNOTSUPP; |
| 116 | } |
| 117 | |
Marcel Holtmann | 3e24767 | 2015-10-17 16:00:28 +0200 | [diff] [blame] | 118 | static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable) |
| 119 | { |
| 120 | return -EOPNOTSUPP; |
| 121 | } |
| 122 | |
Marcel Holtmann | 973bb97 | 2015-07-05 14:37:38 +0200 | [diff] [blame] | 123 | static inline void btintel_hw_error(struct hci_dev *hdev, u8 code) |
| 124 | { |
| 125 | } |
| 126 | |
Vincent Stehlé | 0eee53c | 2015-09-03 23:08:45 +0200 | [diff] [blame] | 127 | static inline void btintel_version_info(struct hci_dev *hdev, |
| 128 | struct intel_version *ver) |
Marcel Holtmann | 7feb99e | 2015-07-05 15:02:07 +0200 | [diff] [blame] | 129 | { |
| 130 | } |
| 131 | |
Marcel Holtmann | 09df123 | 2015-07-05 14:55:36 +0200 | [diff] [blame] | 132 | static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, |
| 133 | u32 plen, const void *param) |
| 134 | { |
| 135 | return -EOPNOTSUPP; |
| 136 | } |
| 137 | |
Loic Poulain | 145f236 | 2015-09-04 17:54:34 +0200 | [diff] [blame] | 138 | static inline int btintel_load_ddc_config(struct hci_dev *hdev, |
| 139 | const char *ddc_name) |
| 140 | { |
| 141 | return -EOPNOTSUPP; |
| 142 | } |
| 143 | |
Marcel Holtmann | 213445b | 2015-10-21 02:45:19 +0200 | [diff] [blame] | 144 | static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug) |
| 145 | { |
| 146 | return -EOPNOTSUPP; |
| 147 | } |
| 148 | |
| 149 | static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug) |
| 150 | { |
| 151 | return -EOPNOTSUPP; |
| 152 | } |
| 153 | |
Loic Poulain | 6c483de | 2015-12-06 16:18:34 +0100 | [diff] [blame] | 154 | static inline int btintel_read_version(struct hci_dev *hdev, |
| 155 | struct intel_version *ver) |
| 156 | { |
| 157 | return -EOPNOTSUPP; |
| 158 | } |
| 159 | |
Loic Poulain | d06f107 | 2015-10-01 18:16:21 +0200 | [diff] [blame] | 160 | static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev, |
| 161 | u16 opcode_read, |
| 162 | u16 opcode_write) |
| 163 | { |
| 164 | return ERR_PTR(-EINVAL); |
| 165 | } |
Tedd Ho-Jeong An | e5889af | 2018-01-24 09:19:18 -0800 | [diff] [blame] | 166 | |
| 167 | static inline int btintel_send_intel_reset(struct hci_dev *hdev, |
| 168 | u32 reset_param) |
| 169 | { |
| 170 | return -EOPNOTSUPP; |
| 171 | } |
Tedd Ho-Jeong An | faf174d | 2018-01-24 09:19:20 -0800 | [diff] [blame] | 172 | |
| 173 | static inline int btintel_read_boot_params(struct hci_dev *hdev, |
| 174 | struct intel_boot_params *params) |
| 175 | { |
| 176 | return -EOPNOTSUPP; |
| 177 | } |
Tedd Ho-Jeong An | fbbe83c | 2018-01-24 09:19:21 -0800 | [diff] [blame] | 178 | |
| 179 | static inline int btintel_download_firmware(struct hci_dev *dev, |
| 180 | const struct firmware *fw, |
| 181 | u32 *boot_param) |
| 182 | { |
| 183 | return -EOPNOTSUPP; |
| 184 | } |
Amit K Bag | b9a2562 | 2019-10-17 13:52:29 +0530 | [diff] [blame] | 185 | |
| 186 | static inline void btintel_reset_to_bootloader(struct hci_dev *hdev) |
| 187 | { |
Amit K Bag | b9a2562 | 2019-10-17 13:52:29 +0530 | [diff] [blame] | 188 | } |
Marcel Holtmann | 48f0ed1 | 2015-04-06 00:52:11 -0700 | [diff] [blame] | 189 | #endif |