bluez5-init: disable the HW flow control for qca6564
Add a software workaround to disable the HW flow control because the SOM revision 3 (and older) has swapped the bluetooth TX and RX lines so we need to operate in DTE mode which implies that the HW control lines are swapped. This also implies reducing the baudrate to avoid the need for HW flow control. https://jira.digi.com/browse/DEL-2611 Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
9765192fbd
commit
756ba7b8cf
|
|
@ -24,17 +24,31 @@ fi
|
||||||
SCRIPTNAME="$(basename "${0}")"
|
SCRIPTNAME="$(basename "${0}")"
|
||||||
|
|
||||||
bt_init_qca6564() {
|
bt_init_qca6564() {
|
||||||
if hciattach -t120 ttyBt qca 3000000 flow 2>/dev/null; then
|
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))"
|
||||||
|
|
||||||
|
# Module version older than revision 4 has swapped TX and RX lines
|
||||||
|
if [ "${MOD_VERSION}" -lt "4" ]; then
|
||||||
|
# Workaround to ignore the CTS flow control line
|
||||||
|
BT_GPIO_CTS="18"
|
||||||
|
echo "${BT_GPIO_CTS}" > /sys/class/gpio/export
|
||||||
|
echo "out" > /sys/class/gpio/gpio${BT_GPIO_CTS}/direction
|
||||||
|
echo "0" > /sys/class/gpio/gpio${BT_GPIO_CTS}/value
|
||||||
|
# Reduce the rate to avoid the need for HW flow control
|
||||||
|
BT_RATE="115200"
|
||||||
|
BT_FLOW="noflow"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if hciattach -t120 ttyBt qca ${BT_RATE:-3000000} ${BT_FLOW:-flow} 2>/dev/null; then
|
||||||
: # No-op
|
: # No-op
|
||||||
else
|
else
|
||||||
echo "${SCRIPTNAME}: FAILED (hciattach)"
|
echo "${SCRIPTNAME}: FAILED (hciattach)"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hciconfig hci0 up; then
|
if hciconfig hci0 up; then
|
||||||
echo "${SCRIPTNAME}: OK"
|
echo "${SCRIPTNAME}: OK"
|
||||||
else
|
else
|
||||||
echo "${SCRIPTNAME}: FAILED (hciconfig)"
|
echo "${SCRIPTNAME}: FAILED"
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,6 +128,7 @@ bt_init_ar3k() {
|
||||||
|
|
||||||
# Check if this hardware does support Bluetooth
|
# Check if this hardware does support Bluetooth
|
||||||
if [ -d "/proc/device-tree/bluetooth" ]; then
|
if [ -d "/proc/device-tree/bluetooth" ]; then
|
||||||
|
# Initialize for the specific bluetooth chip
|
||||||
if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then
|
if grep -qs '\<digi,ccimx6ul\>' /proc/device-tree/compatible; then
|
||||||
bt_init_qca6564
|
bt_init_qca6564
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue