75 lines
2.6 KiB
Diff
75 lines
2.6 KiB
Diff
From: Anantha Krishnan <ananthk@codeaurora.org>
|
|
Date: Wed, 4 Feb 2015 12:29:07 +0530
|
|
Subject: [PATCH] bluetooth: Vote UART CLK ON prior to firmware download
|
|
process
|
|
|
|
Before starting the firmware download process, vote UART CLK ON
|
|
to avoid triggering the dynamic suspend of UART driver. Post
|
|
firmware download and in error scenarios vote UART CLK OFF.
|
|
|
|
As per design, the UART driver enters into dynamic suspend if
|
|
there are no activity on the UART lines for 100ms. Depending upon
|
|
the rampatch size, the BT Controller takes time to apply the
|
|
downloaded rampatch segments and in sending the vendor specific
|
|
event. If the BT Controller takes > 100ms time in sending the
|
|
vendor specific event, the UART driver enters into suspend state.
|
|
|
|
As a result, UART driver fails to process the last vendor specific
|
|
event sent by the BT Controller. The VSE sent by BT Controller
|
|
wakes up the UART driver, but the data is not processed causing
|
|
firmware download failures.
|
|
|
|
Hence, vote UART CLK ON prior to firmware download process and
|
|
vote UART CLK OFF post firmware download proess and in error
|
|
scenarios.
|
|
|
|
Change-Id: I447ded33ad1cfaa020b491effce368fbfe41f894
|
|
---
|
|
tools/hciattach_rome.c | 13 +++++++++++++
|
|
tools/hciattach_rome.h | 2 ++
|
|
2 files changed, 15 insertions(+)
|
|
|
|
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
|
|
index fee36f904e04..574ceac6c750 100644
|
|
--- a/tools/hciattach_rome.c
|
|
+++ b/tools/hciattach_rome.c
|
|
@@ -1762,6 +1762,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
|
|
int size, local_baud_rate = 0, controller_baud_rate = 0;
|
|
|
|
vnd_userial.fd = fd;
|
|
+
|
|
+ /* Vote for UART CLK prior to FW download */
|
|
+ err = ioctl(fd, USERIAL_OP_CLK_ON);
|
|
+ if (err < 0) {
|
|
+ fprintf(stderr, "%s: Failed to vote UART CLK ON\n", __func__);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
/* Get Rome version information */
|
|
if((err = rome_patch_ver_req(fd)) <0){
|
|
fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err);
|
|
@@ -1899,5 +1907,10 @@ download:
|
|
}
|
|
|
|
error:
|
|
+ /* Vote UART CLK OFF post to FW download */
|
|
+ err = ioctl(fd, USERIAL_OP_CLK_OFF);
|
|
+ if (err < 0)
|
|
+ fprintf(stderr, "%s: Failed to vote UART CLK OFF!!!\n", __func__);
|
|
+
|
|
return err;
|
|
}
|
|
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
|
|
index 95d5f1e8a5c2..20264f9978d9 100644
|
|
--- a/tools/hciattach_rome.h
|
|
+++ b/tools/hciattach_rome.h
|
|
@@ -42,6 +42,8 @@
|
|
#define BD_ADDR_LEN 6
|
|
#define MSM_ENABLE_FLOW_CTRL 16
|
|
#define MSM_DISABLE_FLOW_CTRL 17
|
|
+#define USERIAL_OP_CLK_ON 0x5441
|
|
+#define USERIAL_OP_CLK_OFF 0x5442
|
|
|
|
unsigned char vnd_local_bd_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
typedef enum {
|