bluez5: imx6ul: configure baudrate in the BT FW file

Do not use hcitattach to reconfigure the baudrate but set it directly in the
Bluetooth FW file; this work arounds some synchronization problems when not
using HW flow control.

https://jira.digi.com/browse/DEL-3052
https://jira.digi.com/browse/DEL-3057

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2016-09-29 13:09:52 +02:00
parent ec8555f936
commit 702145661c
3 changed files with 46 additions and 2 deletions

View File

@ -23,6 +23,7 @@ fi
SCRIPTNAME="$(basename "${0}")" SCRIPTNAME="$(basename "${0}")"
LOGFILE="/var/log/bluetoothd.log" LOGFILE="/var/log/bluetoothd.log"
FIRMWARE_FILE="/lib/firmware/qca/nvm_tlv_3.2.bin"
bt_init_qca6564() { bt_init_qca6564() {
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))" MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))"
@ -32,8 +33,8 @@ bt_init_qca6564() {
BT_EN_L="/sys/class/gpio/gpio${BT_EN_QCA_GPIO_NR}" BT_EN_L="/sys/class/gpio/gpio${BT_EN_QCA_GPIO_NR}"
[ -d "${BT_EN_L}" ] || printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/export [ -d "${BT_EN_L}" ] || printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_EN_L}/direction && sleep .1 printf out > ${BT_EN_L}/direction && sleep .1
printf 0 > ${BT_EN_L}/value && sleep .1 printf 0 > ${BT_EN_L}/value && sleep .2
printf 1 > ${BT_EN_L}/value && sleep .1 printf 1 > ${BT_EN_L}/value && sleep .2
[ -d "${BT_EN_L}" ] && printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/unexport [ -d "${BT_EN_L}" ] && printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/unexport
# Module version older than revision 4 has swapped TX and RX lines # Module version older than revision 4 has swapped TX and RX lines
@ -47,7 +48,13 @@ bt_init_qca6564() {
[ -d "${BT_CTS_L}" ] && printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/unexport [ -d "${BT_CTS_L}" ] && printf "%s" ${BT_CTS_QCA_GPIO_NR} > /sys/class/gpio/unexport
# Reduce the rate to avoid the need for HW flow control # Reduce the rate to avoid the need for HW flow control
BT_RATE="115200" BT_RATE="115200"
BT_RATE_CODE="00" # 115200 bps
BT_FLOW="noflow" BT_FLOW="noflow"
# Check the current FW file rate
if [ "$(hexdump -s 56 -n 1 -ve '1/1 "%.2x"' ${FIRMWARE_FILE})" != "${BT_RATE_CODE}" ]; then
# Modify the BT FW file rate
printf "\x${BT_RATE_CODE}" | dd of="${FIRMWARE_FILE}" bs=1 seek=56 count=1 conv=notrunc,fsync 2>/dev/null
fi
fi fi
if hciattach -t120 ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} 2>${LOGFILE}; then if hciattach -t120 ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} 2>${LOGFILE}; then

View File

@ -0,0 +1,36 @@
From: Isaac Hermida <isaac.hermida@digi.com>
Date: Fri, 30 Sep 2016 12:46:17 +0200
Subject: [PATCH] hciattach_rome: do not override the baudrate in the NVM file
Do not use hcitattach to override the NMV baudrate because we are
setting it directly in the firmware file.
https://jira.digi.com/browse/DEL-3057
Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
tools/hciattach_rome.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 59bdc16e4e8f..4f0f8c82fa8d 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1903,15 +1903,8 @@ download:
}
fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
- /*
- * Overriding the baud rate value in NVM file with the user
- * requested baud rate, since default baud rate in NVM file is 3M.
- */
- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
- if (err < 0) {
- fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
- goto error;
- }
+ /* Do not override the baudrate in the TLV file */
+ fprintf(stderr, "%s: Skipping Override of baud rate!\n", __FUNCTION__);
/* Perform HCI reset here*/
err = rome_hci_reset_req(fd, local_baud_rate);

View File

@ -28,6 +28,7 @@ SRC_URI_append_ccimx6ul = " \
file://0017-bluetooth-Fix-flow-control-operation.patch \ file://0017-bluetooth-Fix-flow-control-operation.patch \
file://0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \ file://0018-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \
file://0019-Bluetooth-Fix-static-analysis-issues.patch \ file://0019-Bluetooth-Fix-static-analysis-issues.patch \
file://0023-hciattach_rome-do-not-override-the-baudrate-in-the-N.patch \
" "
inherit update-rc.d inherit update-rc.d