From: Tedd Ho-Jeong An <tedd.an@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Tedd Ho-Jeong An <tedd.an@linux.intel.com>,
tedd.an@intel.com, amit.k.bag@intel.com
Subject: [PATCH 3/5] Bluetooth: btintel: Use boot parameter from firmware file
Date: Tue, 23 Jan 2018 19:17:47 -0800 [thread overview]
Message-ID: <1516763869-12411-3-git-send-email-tedd.an@linux.intel.com> (raw)
In-Reply-To: <1516763869-12411-1-git-send-email-tedd.an@linux.intel.com>
Each RAM SKU has a different boot parameter which is used in
HCI_Intel_Reset command after downloading the firmware.
The boot parameter is embedded in the firmware data and to support
multiple SKUs, driver reads the boot parameter while downloading
the firmware instead of using static values per SKU.
Signed-off-by: Tedd Ho-Jeong An <tedd.an@linux.intel.com>
---
drivers/bluetooth/btusb.c | 22 ++++++++++++++++++++--
drivers/bluetooth/hci_intel.c | 23 +++++++++++++++++++++--
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 93db5b9..979d530 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2024,8 +2024,11 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
BT_DBG("%s", hdev->name);
- /* The default boot parameter */
- boot_param = 0x00040800;
+ /* Set the default boot parameter to 0x0 and it is updated to
+ * SKU specific boot parameter after reading Intel_Write_Boot_Params
+ * command while downloading the firmware.
+ */
+ boot_param = 0x00000000;
calltime = ktime_get();
@@ -2269,6 +2272,21 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
while (fw_ptr - fw->data < fw->size) {
struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len);
+ /* Each SKU has a different reset parameter to use in the
+ * HCI_Intel_Reset command and it is embedded in the firmware
+ * data. So, instead of using static value per SKU, check
+ * the firmware data and save it for later use.
+ */
+ if (cmd->opcode == 0xfc0e) {
+
+ /* The boot parameter is the first 32-bit value
+ * and rest of 3 octets are reserved.
+ */
+ boot_param = get_unaligned_le32(fw_ptr + sizeof(*cmd));
+
+ bt_dev_dbg(hdev, "boot_param=0x%x", boot_param);
+ }
+
frag_len += sizeof(*cmd) + cmd->plen;
/* The parameter length of the secure send command requires
diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index acac48d..2053d73 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -33,6 +33,7 @@
#include <linux/acpi.h>
#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
+#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -562,8 +563,11 @@ static int intel_setup(struct hci_uart *hu)
hu->hdev->set_diag = btintel_set_diag;
hu->hdev->set_bdaddr = btintel_set_bdaddr;
- /* Default boot parameter */
- boot_param = 0x00040800;
+ /* Set the default boot parameter to 0x0 and it is updated to
+ * SKU specific boot parameter after reading Intel_Write_Boot_Params
+ * command while downloading the firmware.
+ */
+ boot_param = 0x00000000;
calltime = ktime_get();
@@ -824,6 +828,21 @@ static int intel_setup(struct hci_uart *hu)
while (fw_ptr - fw->data < fw->size) {
struct hci_command_hdr *cmd = (void *)(fw_ptr + frag_len);
+ /* Each SKU has a different reset parameter to use in the
+ * HCI_Intel_Reset command and it is embedded in the firmware
+ * data. So, instead of using static value per SKU, check
+ * the firmware data and save it for later use.
+ */
+ if (cmd->opcode == 0xfc0e) {
+
+ /* The boot parameter is the first 32-bit value
+ * and rest of 3 octets are reserved.
+ */
+ boot_param = get_unaligned_le32(fw_ptr + sizeof(*cmd));
+
+ bt_dev_dbg(hdev, "boot_param=0x%x", boot_param);
+ }
+
frag_len += sizeof(*cmd) + cmd->plen;
bt_dev_dbg(hdev, "Patching %td/%zu", (fw_ptr - fw->data),
--
2.7.4
next prev parent reply other threads:[~2018-01-24 3:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-24 3:17 [PATCH 1/5] Bluetooth: hci_intel: Update firmware filename for Intel 9x60 and later Tedd Ho-Jeong An
2018-01-24 3:17 ` [PATCH 2/5] Bluetooth: btintel: Create common function for Intel Reset Tedd Ho-Jeong An
2018-01-24 7:34 ` Marcel Holtmann
2018-01-24 3:17 ` Tedd Ho-Jeong An [this message]
2018-01-24 7:34 ` [PATCH 3/5] Bluetooth: btintel: Use boot parameter from firmware file Marcel Holtmann
2018-01-24 3:17 ` [PATCH 4/5] Bluetooth: btintel: Create common Intel Read Boot Params function Tedd Ho-Jeong An
2018-01-24 3:17 ` [PATCH 5/5] Bluetooth: btintel: Create common function for firmware download Tedd Ho-Jeong An
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516763869-12411-3-git-send-email-tedd.an@linux.intel.com \
--to=tedd.an@linux.intel.com \
--cc=amit.k.bag@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=tedd.an@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).