Bluetooth: btintel: Create common function for Intel Reset

The Intel_Reset command is used to reset the device after downloading
the firmware and this is Intel generic command used in both USB and
UART.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
Tedd Ho-Jeong An
2018-01-24 09:19:18 -08:00
zatwierdzone przez Marcel Holtmann
rodzic 965651c16b
commit e5889af62f
4 zmienionych plików z 49 dodań i 16 usunięć

Wyświetl plik

@@ -2009,8 +2009,6 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
static int btusb_setup_intel_new(struct hci_dev *hdev)
{
static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
0x00, 0x08, 0x04, 0x00 };
struct btusb_data *data = hci_get_drvdata(hdev);
struct sk_buff *skb;
struct intel_version ver;
@@ -2018,6 +2016,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
const struct firmware *fw;
const u8 *fw_ptr;
u32 frag_len;
u32 boot_param;
char fwname[64];
ktime_t calltime, delta, rettime;
unsigned long long duration;
@@ -2025,6 +2024,9 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
BT_DBG("%s", hdev->name);
/* The default boot parameter */
boot_param = 0x00040800;
calltime = ktime_get();
/* Read the Intel version information to determine if the device
@@ -2341,12 +2343,9 @@ done:
set_bit(BTUSB_BOOTING, &data->flags);
skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(reset_param), reset_param,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);
kfree_skb(skb);
err = btintel_send_intel_reset(hdev, boot_param);
if (err)
return err;
/* The bootloader will not indicate when the device is ready. This
* is done by the operational firmware sending bootup notification.