Use hciattach tool for the RPI3 target 03/210803/3 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.014400 accepted/tizen/5.5/unified/mobile/hotfix/20201027.082000 accepted/tizen/5.5/unified/wearable/hotfix/20201027.123305 accepted/tizen/unified/20190729.081007 submit/tizen/20190725.232630 submit/tizen_5.5/20191031.000001 submit/tizen_5.5_mobile_hotfix/20201026.185101 submit/tizen_5.5_wearable_hotfix/20201026.184301 tizen_5.5.m2_release
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 25 Jul 2019 03:37:59 +0000 (12:37 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 25 Jul 2019 05:05:43 +0000 (14:05 +0900)
There is an UART HW differnece between RPI3 B and RPI3 B+
model such as cts pin setting. Because of this we should
use the different value for Uart Speed and flow control.
btattach tool operates the firmware download and Uart
setting in the kernel driver as the proto. So we can't
use the btattach tool for RPI3 target.

Change-Id: I2c57b6fb53d95e4363fb27db78b1d21b522dc832
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
firmware/CMakeLists.txt
packaging/bluetooth-firmware-bcm.spec
scripts/bt-dev-start-rpi3.sh

index c9855fe..d047afb 100755 (executable)
@@ -13,5 +13,5 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0022.00
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm43012/BCM43012B0_002.001.021.0081.0087.hex DESTINATION /lib/firmware/bcm43012/)
 
 # RPI3
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM43430A1.hcd DESTINATION /lib/firmware/brcm)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM4345C0.hcd DESTINATION /lib/firmware/brcm)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM43430A1.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM4345C0.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
index 1672264..ae22671 100644 (file)
@@ -143,13 +143,16 @@ rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
 rm -rf %{_prefix}/etc/bluetooth/bt-dev-end.sh
 ln -s %{_prefix}/etc/bluetooth/bt-dev-start-rpi3.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
 ln -s %{_prefix}/etc/bluetooth/bt-dev-end-rpi3.sh %{_prefix}/etc/bluetooth/bt-dev-end.sh
+mkdir -p /lib/firmware/brcm
+ln -s %{_prefix}/etc/bluetooth/BCM43430A1.hcd /lib/firmware/brcm/
+ln -s %{_prefix}/etc/bluetooth/BCM4345C0.hcd /lib/firmware/brcm/
 
 %files rpi3
 %manifest %{name}.manifest
 %license LICENSE.APLv2 LICENSE.Broadcom
 %defattr(-,root,root,-)
-/lib/firmware/brcm/BCM43430A1.hcd
-/lib/firmware/brcm/BCM4345C0.hcd
+%{_prefix}/etc/bluetooth/BCM43430A1.hcd
+%{_prefix}/etc/bluetooth/BCM4345C0.hcd
 %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end-rpi3.sh
 %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-rpi3.sh
 %manifest %{name}.manifest
index dc2f600..aab1b91 100644 (file)
@@ -3,14 +3,13 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 # Script for registering Broadcom UART BT device
 BT_UART_DEVICE=/dev/ttyAMA0
-BT_CHIP_TYPE=bcm
+BT_CHIP_TYPE=bcm43xx
 BT_MAC_FILE=/opt/etc/.bd_addr
 
 BT_PLATFORM_DEFAULT_HCI_NAME="TIZEN-Mobile"
-UART_SPEED=3000000
 
 HCI_CONFIG=/usr/bin/hciconfig
-BT_ATTACH=/usr/bin/btattach
+HCI_ATTACH=/usr/bin/hciattach
 
 if [ ! -e "$BT_UART_DEVICE" ]
 then
@@ -30,6 +29,19 @@ GEN_BDADDR(){
        BT_MAC=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))`
 }
 
+PIMODEL=`cat /proc/device-tree/model | awk '{print $5}'`
+echo "$PIMODEL"
+
+if [ "$PIMODEL" = "B" ]
+then
+       FLOW_CONTROL=noflow
+       UART_SPEED=460800
+else
+       FLOW_CONTROL=flow
+       UART_SPEED=2000000
+
+fi
+
 if [ ! -e "$BT_MAC_FILE" ]
 then
        # Set BT address
@@ -50,11 +62,20 @@ else
        echo "Registering Bluetooth device"
 
        # Attaching Broadcom device
-       $BT_ATTACH -B $BT_UART_DEVICE -P $BT_CHIP_TYPE -S $UART_SPEED > /dev/null 2>&1 &
+       flag=0
+       for ((i=0; i<2; i++))
+       do
+               if ($HCI_ATTACH $BT_UART_DEVICE $BT_CHIP_TYPE $UART_SPEED $FLOW_CONTROL nosleep $BT_MAC -t 5); then
+                       sleep 0.1
+                       $HCI_CONFIG hci0 up
+                       echo "HCIATTACH success"
+                       flag=1
+                       break
+               fi
+       done
 
-       sleep 0.02
-
-       $HCI_CONFIG hci0 up
-       $HCI_CONFIG hci0 name $BT_PLATFORM_DEFAULT_HCI_NAME
-       echo "HCIATTACH success"
+       if [ $flag -eq 0 ]
+       then
+               echo "HCIATTACH failed"
+       fi
 fi