Add the firmware and broadcom's tool for Artik 10/66610/2 accepted/tizen/common/20160420.142021 accepted/tizen/ivi/20160421.011153 accepted/tizen/mobile/20160421.011314 accepted/tizen/tv/20160421.011201 accepted/tizen/wearable/20160421.011209 submit/tizen/20160420.082832
authorTaejin Woo <tt.woo@samsung.com>
Wed, 20 Apr 2016 00:14:03 +0000 (09:14 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Wed, 20 Apr 2016 07:17:26 +0000 (16:17 +0900)
Change-Id: I27e107a261aed30a394ccd8838540845a2e0d5b0
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
firmware/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd [new file with mode: 0644]
firmware/CMakeLists.txt
firmware/artik_bcmtool/brcm_patchram_plus [new file with mode: 0755]
packaging/bluetooth-firmware-bcm.spec
scripts/CMakeLists.txt
scripts/bt-dev-start-artik.sh [new file with mode: 0644]

diff --git a/firmware/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd b/firmware/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
new file mode 100644 (file)
index 0000000..1a7e626
Binary files /dev/null and b/firmware/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd differ
index b27a0db..aa6eb02 100755 (executable)
@@ -1,6 +1,8 @@
 # install firmware
 #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4358A1_001.002.005.0032.0066.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/artik_bcmtool/brcm_patchram_plus DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin)
 
 # Gear S2
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0035.0096_ORC_Orbis_WC1-S.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
diff --git a/firmware/artik_bcmtool/brcm_patchram_plus b/firmware/artik_bcmtool/brcm_patchram_plus
new file mode 100755 (executable)
index 0000000..0a0871d
Binary files /dev/null and b/firmware/artik_bcmtool/brcm_patchram_plus differ
index a1928b6..0a35398 100644 (file)
@@ -16,11 +16,18 @@ BuildRequires:  cmake
 
 %package exynos3250
 Summary:    bcm firmware and tools for exynos3250
-Group:      TO_BE/FILLED
+Group:      Hardware Support/Handset
 
 %description exynos3250
 bcm firmware and tools for exynos3250
 
+%package artik
+Summary:    bcm firmware and tools for artik
+Group:      Hardware Support/Handset
+
+%description artik
+bcm firmware and tools for artik
+
 %prep
 %setup -q
 
@@ -59,3 +66,17 @@ cat %{_builddir}/%{name}-%{version}/LICENSE.Broadcom >> %{buildroot}/usr/share/l
 %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-exynos3250.sh
 %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
 /usr/share/license/%{name}
+
+%post artik
+rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
+ln -s %{_prefix}/etc/bluetooth/bt-dev-start-artik.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
+
+%files artik
+%defattr(644,root,root,-)
+%{_bindir}/brcm_patchram_plus
+%{_bindir}/setbd
+%{_prefix}/etc/bluetooth/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
+%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh
+%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-artik.sh
+%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
+/usr/share/license/%{name}
index 240b6f0..d14dac4 100755 (executable)
@@ -5,4 +5,5 @@ INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-set-addr.sh DESTINATION ${PLUGIN
 
 #IF (TIZEN_WEARABLE)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-exynos3250.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-#ENDIF (TIZEN_WEARABLE)
\ No newline at end of file
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-artik.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+#ENDIF (TIZEN_WEARABLE)
diff --git a/scripts/bt-dev-start-artik.sh b/scripts/bt-dev-start-artik.sh
new file mode 100644 (file)
index 0000000..000860a
--- /dev/null
@@ -0,0 +1,149 @@
+#!/bin/sh
+
+# Script for registering Broadcom UART BT device
+BT_UART_DEVICE=/dev/ttySAC3
+BT_CHIP_TYPE=bcm2035
+BCM_TOOL=/usr/bin/brcm_patchram_plus
+
+BT_PLATFORM_DEFAULT_HCI_NAME="TIZEN-Mobile"
+UART_SPEED=3000000
+TIMEOUT=24
+
+#set default firmware
+BCM_FIRMWARE=BT_FW_BCM4358A1_001.002.005.0032.0066.hcd
+
+REVISION_NUM=`grep Revision /proc/cpuinfo | awk "{print \\$3}"`
+REVISION_HIGH=`echo $REVISION_NUM| cut -c1-2`
+REVISION_LOW=`echo $REVISION_NUM| cut -c3-`
+
+HARDWARE=`grep Hardware /proc/cpuinfo | awk "{print \\$3}"`
+
+check_hw_dt()
+{
+       HARDWARE=`cat /proc/device-tree/model | awk "{print \\$2}"`
+
+       case $HARDWARE in
+
+               "ARTIK10")
+                       BT_UART_DEVICE=/dev/ttySAC2
+                       BCM_TOOL=/usr/bin/brcm_patchram_plus
+                       BCM_FIRMWARE=BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
+                       ;;
+
+               "ARTIK5")
+                       BT_UART_DEVICE=/dev/ttySAC0
+                       BCM_TOOL=/usr/bin/brcm_patchram_plus
+                       BCM_FIRMWARE=BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
+                       ;;
+       esac
+}
+
+parse_bd_addr()
+{
+       for x in $(cat /proc/cmdline); do
+               case $x in
+                       bd_addr=*)
+                               BD_ADDR=${x#bd_addr=}
+                               ;;
+               esac
+       done
+}
+
+check_hw_dt
+if [ -z "${HARDWARE##ARTIK*}" ]; then
+       parse_bd_addr
+fi
+
+if [ ! -e "$BT_UART_DEVICE" ]
+then
+       mknod $BT_UART_DEVICE c 204 64
+fi
+
+if [ ! -e /opt/etc/.bd_addr ]
+then
+       # Set BT address
+       /usr/bin/setbd
+fi
+
+# Trun-on Bluetooth Chip
+/usr/sbin/rfkill unblock bluetooth
+
+echo "Check for Bluetooth device status"
+if (/usr/bin/hciconfig | grep hci); then
+       echo "Bluetooth device is UP"
+       /usr/bin/hciconfig hci0 up
+else
+       echo "Bluetooth device is DOWN"
+       echo "Registering Bluetooth device"
+       echo "change auth of brodcom tool"
+       chmod 755 $BCM_TOOL
+
+       # In tizenW hardware first time bcmtool download may not success, hence we need to try more times
+       MAXBCMTOOLTRY=5
+       flag=0
+       for (( c=1; c<=$MAXBCMTOOLTRY; c++))
+       do
+               echo "******* Bcmtool download attempt $c ********"
+
+       $BCM_TOOL $BT_UART_DEVICE --patchram /usr/etc/bluetooth/$BCM_FIRMWARE --no2bytes --baudrate $UART_SPEED --use_baudrate_for_download $BT_UART_DEVICE --bd_addr ${BD_ADDR} > /dev/null 2>&1 &
+               bcmtool_pid=$!
+               #Check next timeout seconds for bcmtool success
+               for (( i=1; i<=$TIMEOUT; i++))
+               do
+                       /bin/sleep 0.1
+                       kill -0 $bcmtool_pid
+                       bcmtool_alive=$?
+
+                       if [ $i -eq $TIMEOUT ]
+                       then
+                               echo "time expired happen $i"
+                               kill -TERM $bcmtool_pid
+                               break
+#                              ${RFKILL} block bluetooth
+#                              exit 1
+                       fi
+
+                       if [ $bcmtool_alive -eq 0 ]
+                       then
+                               echo "Continue....$i"
+                               continue
+                       else
+                               echo "Break.......$i"
+                               flag=1
+                               break
+                       fi
+               done
+
+               if [ $flag -eq 1 ]
+               then
+                       echo "Break bcmtool download loop on $c attempt"
+                       break
+               else
+                       /bin/sleep 1
+                       echo "sleep done"
+               fi
+
+
+               if [ $c -eq $MAXBCMTOOLTRY ]
+               then
+                       echo "***** No Chance to activate, count=$c ******"
+                       ${RFKILL} block bluetooth
+                       exit 1
+               fi
+
+       done
+
+       echo "Try for hciattach"
+
+       # Attaching Broadcom device
+       if (/usr/bin/hciattach $BT_UART_DEVICE -s $UART_SPEED $BT_CHIP_TYPE $UART_SPEED flow); then
+               sleep 0.1
+               /usr/bin/hciconfig hci0 up
+               /usr/bin/hciconfig hci0 name $BT_PLATFORM_DEFAULT_HCI_NAME
+               /usr/bin/hciconfig hci0 sspmode 1
+               echo "HCIATTACH success"
+       else
+               echo "HCIATTACH failed"
+               /usr/sbin/rfkill block bluetooth
+       fi
+fi