meta-digi/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.41/ccimx6ul/0015-Add-support-for-Tufell...

170 lines
7.9 KiB
Diff

From: Rupesh Tatiya <rtatiya@codeaurora.org>
Date: Thu, 29 Jan 2015 15:36:27 +0530
Subject: [PATCH] Add support for Tufello 1.1 SOC
Enable mechanism to download firmware for Tufello 1.1 SOC.
Also, use correct firmware file path for Tufello 1.0.
Change-Id: I915e48023e45de9e2550336a3de9a07f2b788189
Signed-off-by: Rupesh Tatiya <rtatiya@codeaurora.org>
---
tools/hciattach_rome.c | 29 ++++++++++++++++++-----------
tools/hciattach_rome.h | 10 +++++++---
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 99866e23e99e..fee36f904e04 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -621,7 +621,7 @@ int rome_edl_set_patch_request(int fd)
-1, PATCH_HDR_LEN + 1);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -670,7 +670,7 @@ int rome_edl_patch_download_request(int fd)
index, MAX_DATA_PER_SEGMENT);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Initialize the RSP packet everytime to 0 */
memset(rsp, 0x0, HCI_MAX_EVENT_SIZE);
@@ -707,7 +707,7 @@ int rome_edl_patch_download_request(int fd)
memset(rsp, 0x0, HCI_MAX_EVENT_SIZE);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -824,7 +824,7 @@ int rome_attach_rampatch(int fd)
-1, EDL_PATCH_CMD_LEN);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + cmd[PLEN]);
/* Send HCI Command packet to Controller */
err = hci_send_vs_cmd(fd, (unsigned char *)cmd, rsp, size);
@@ -854,7 +854,7 @@ int rome_rampatch_reset(int fd)
-1, EDL_PATCH_CMD_LEN);
/* Total length of the packet to be sent to the Controller */
- size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
+ size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
/* Send HCI Command packet to Controller */
err = write(fd, cmd, size);
@@ -1058,7 +1058,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
unsigned char cmd[HCI_MAX_CMD_SIZE];
unsigned char rsp[HCI_MAX_EVENT_SIZE];
- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d\n", __FUNCTION__, index, seg_size);
+ fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
/* Frame the HCI CMD PKT to be sent to Controller*/
frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size);
@@ -1092,6 +1092,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
{
int total_segment, remain_size, i, err = -1;
unsigned char wait_cc_evt;
+ unsigned int rom = rome_ver >> 16;
total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT;
remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\
@@ -1132,14 +1133,15 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
for(i = 0; i < total_segment; i++) {
if((i+1) == total_segment) {
- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) &&
+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) &&
(gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is from 1.1 to 3.1
* 1. No CCE for the last command segment but all other segment
* 2. All the command segments get VSE including the last one
*/
wait_cc_evt = !remain_size ? FALSE: TRUE;
- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ } else if ((rom == ROME_PATCH_VER_0302) &&
+ (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is 3.2
* 1. None of the command segments receive CCE
* 2. No command segments receive VSE except the last one
@@ -1158,13 +1160,14 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
goto error;
}
- if ((rome_ver >= ROME_VER_1_1) && (rome_ver < ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ if ((rom >= ROME_PATCH_VER_0100) && (rom < ROME_PATCH_VER_0302) &&
+ (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is from 1.1 to 3.1
* 1. No CCE for the last command segment but all other segment
* 2. All the command segments get VSE including the last one
*/
wait_cc_evt = remain_size ? FALSE: TRUE;
- } else if ((rome_ver == ROME_VER_3_2) && (gTlv_type == TLV_TYPE_PATCH)) {
+ } else if ((rom == ROME_PATCH_VER_0302) && (gTlv_type == TLV_TYPE_PATCH)) {
/* If the Rome version is 3.2
* 1. None of the command segments receive CCE
* 2. No command segments receive VSE except the last one
@@ -1837,6 +1840,10 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
case TUFELLO_VER_1_0:
rampatch_file_path = TF_RAMPATCH_TLV_1_0_0_PATH;
nvm_file_path = TF_NVM_TLV_1_0_0_PATH;
+ goto download;
+ case TUFELLO_VER_1_1:
+ rampatch_file_path = TF_RAMPATCH_TLV_1_0_1_PATH;
+ nvm_file_path = TF_NVM_TLV_1_0_1_PATH;
download:
/* Check if user requested for 115200 kbps */
@@ -1881,7 +1888,7 @@ download:
fprintf(stderr, "HCI Reset Failed !!!\n");
goto error;
}
- fprintf(stderr, "HCI Reset is done\n");
+ fprintf(stderr, "HCI Reset is done\n");
break;
case ROME_VER_UNKNOWN:
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index f591c10e4f2b..95d5f1e8a5c2 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -238,8 +238,10 @@ typedef struct
#define ROME_NVM_TLV_3_0_0_PATH "/lib/firmware/qca/nvm_tlv_3.0.bin"
#define ROME_RAMPATCH_TLV_3_0_2_PATH "/lib/firmware/qca/rampatch_tlv_3.2.tlv"
#define ROME_NVM_TLV_3_0_2_PATH "/lib/firmware/qca/nvm_tlv_3.2.bin"
-#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/rampatch_tlv_tf_1.0.tlv"
-#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/nvm_tlv_tf_1.0.bin"
+#define TF_RAMPATCH_TLV_1_0_0_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.0.tlv"
+#define TF_NVM_TLV_1_0_0_PATH "/lib/firmware/qca/nvm_tlv_tf_1.0.bin"
+#define TF_RAMPATCH_TLV_1_0_1_PATH "/lib/firmware/qca/rampatch_tlv_tf_1.1.tlv"
+#define TF_NVM_TLV_1_0_1_PATH "/lib/firmware/qca/nvm_tlv_tf_1.1.bin"
/* This header value in rampatch file decides event handling mechanism in the HOST */
#define ROME_SKIP_EVT_NONE 0x00
@@ -357,6 +359,7 @@ enum{
ROME_SOC_ID_11 = 0x00000011,
ROME_SOC_ID_13 = 0x00000013,
ROME_SOC_ID_22 = 0x00000022,
+ ROME_SOC_ID_23 = 0x00000023,
ROME_SOC_ID_44 = 0x00000044
};
@@ -368,6 +371,7 @@ enum{
ROME_VER_2_1 = ((ROME_PATCH_VER_0200 << 16 ) | ROME_SOC_ID_11 ),
ROME_VER_3_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_22 ),
ROME_VER_3_2 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_44 ),
- TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 )
+ TUFELLO_VER_1_0 = ((ROME_PATCH_VER_0300 << 16 ) | ROME_SOC_ID_13 ),
+ TUFELLO_VER_1_1 = ((ROME_PATCH_VER_0302 << 16 ) | ROME_SOC_ID_23 )
};
#endif /* HW_ROME_H */