summaryrefslogtreecommitdiff
path: root/recipes-kernel/rs9113/files/rs9113
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/rs9113/files/rs9113')
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/mts-rm-rs911351
-rw-r--r--recipes-kernel/rs9113/files/rs9113/rs9113.default66
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/rs9113.init100
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/wpa_supplicant95
4 files changed, 312 insertions, 0 deletions
diff --git a/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 b/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113
new file mode 100755
index 0000000..a7a30c2
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113
@@ -0,0 +1,51 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: mts-rm-rs9113
+# Default-Start: S
+# Default-Stop:
+# Short-Description: remove the rs9113 driver if no rs9113 present
+# Description: If mts-io capability wifi exists, test it and remove
+# the rs9113 related packages if present and no wifi
+# capability. Must run after mts-io but before rs9113.
+### END INIT INFO
+
+# update-rc.d mts-rm-rs9113 start 40 S .
+
+sysdir=/sys/devices/platform/mts-io
+remount=0
+
+function cleanup {
+ if ((remount == 1)) ; then
+ mount -o ro,remount /
+ fi
+}
+
+trap cleanup EXIT
+
+if [[ -f ${sysdir}/capability/wifi ]] ; then
+ if [[ -f /opt/rs9113/onebox_wlan_nongpl.ko ]] && (( $(cat ${sysdir}/capability/wifi) == 0)) ; then
+ logger -sp daemon.info 'Attempting to remove rs9113 drivers from non-wifi device'
+ rmount=$(grep '^/dev/root' /proc/mounts)
+ remount=0
+ if [[ $rmount =~ [[:space:],]ro[[:space:],] ]] ; then
+ remount=1
+ mount -o rw,remount /
+ fi
+ plist="rs9113-autostart rs9113-misc rs9113-noarch rs9113-util rs9113-utils-extra kernel-module-rs9113"
+ for p in $plist ; do
+ opkg remove $p
+ done
+
+ rlist=$(opkg list-installed | grep rs9113)
+
+ for p in $plist ; do
+ # Hopefully the packages have been removed.
+ if [[ $rlist =~ (^|[[:space:]])${p}[[:space:]] ]] ; then
+ exit 1
+ fi
+ done
+
+ fi
+
+ update-rc.d -f mts-rm-rs9113 remove
+fi
diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.default b/recipes-kernel/rs9113/files/rs9113/rs9113.default
new file mode 100644
index 0000000..87b619a
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/rs9113.default
@@ -0,0 +1,66 @@
+#
+# Skip loading the RS9113 related drivers if
+# set to zero.
+#
+RS9113_LOAD=1
+
+# Parameters for rs9113 driver
+#
+# Enable Antenna Diversity (1)
+RSI_ANTENNA_DIVERSITY=0
+
+# COEX_MODE options:
+# 1 WLAN STATION /WIFI-Direct/WLAN PER
+# 2 WLAN ACCESS POINT(including muliple APs on different vaps)
+# 3 WLAN ACCESS POINT + STATION MODE(on multiple vaps)
+# 4 BT CLASSIC MODE/BT CLASSIC PER MODE
+# 5 WLAN STATION + BT CLASSIC MODE
+# 6 WLAN ACCESS POINT + BT CLASSIC MODE
+# 8 BT LE MODE /BT LE PER MODE
+# 9 WLAN STATION + BT LE MODE
+# 12 BT CLASSIC + BT LE MODE
+# 14 WLAN ACCESS POINT + BT CLASSIC MODE+ BT LE MODE
+COEX_MODE=6
+
+# Power selection
+# 0x00 - For Both TX and RX High Power
+# 0x11 - For Both TX and RX Medium Power
+# 0x22 - For Both TX and RX LOW Power
+# 0x10 - For High Power TX and Medium RX Power
+# 0x20 - For High Power TX and LOW RX Power
+# 0x01 - For Medium TX and RX High Power
+# 0x21 - For Medium Power TX and LOW RX Power
+# 0x02 - For Low Power TX and RX High Power
+# 0x12 - For LOW Power TX and Medium RX Power
+WLAN_RF_PWR_MODE=0x00
+BT_RF_PWR_MODE=0x00
+
+#Power_mode type
+# 0 - HIGH POWER MODE
+# 1 - MEDIUM POWER MODE
+# 2 - LOW POWER MODE
+BT_RF_TX_POWER_MODE=0
+BT_RF_RX_POWER_MODE=0
+
+# Country Selection
+# 0 World Domain
+# 840 US Domain Maps to US Region
+# 276 Germany Maps to EU Region
+# 392 Japan Maps to Japan Region
+# from ISO 3166-1
+SET_COUNTRY_CODE=0
+
+# 2 – Select internal antenna
+# 3 – Select external antenna
+ANT_SEL_VAL=2
+
+ONBOARD_ANT_SEL=1
+SET_RETRY_COUNT=15
+
+# Time to hold high, then hold low on reset during driver load reset
+SLEEPTIME=100000
+
+# Time to wait while looping for interrupt and wake-up pins
+# to go high.
+INTSLEEPTIME=100000
+
diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init
new file mode 100755
index 0000000..4ef6f4b
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init
@@ -0,0 +1,100 @@
+#!/bin/bash
+# Note that none of the INIT stuff below works in the current open-embedded.
+### BEGIN INIT INFO
+# Provides: rs9113
+# Required-Start: mts-io
+# Default-Start: S
+# Default-Stop: 0 6
+# X-Start-Before: networking
+# Short-Description: load the rs9113 drivers
+# Description: rs9113 drivers are used to provide access to Bluetooth
+# and WiFi.
+### END INIT INFO
+
+CONFIG=${CONFIG:-/etc/default/rs9113}
+MTS_IODIR=/sys/devices/platform/mts-io
+RS9113_RESET=${MTS_IODIR}/wifi-bt-reset
+RS9113_INT=${MTS_IODIR}/wifi-bt-int
+RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup
+
+[ -f $CONFIG ] || exit 1
+
+. $CONFIG
+
+case "$1" in
+ start)
+ if ((RS9113_LOAD == 0)) ; then
+ # We don't want the driver loaded.
+ exit 0
+ fi
+ # Reset the RS9113 chip is ready, and
+ # wait for it to settle.
+ if [ -f "$RS9113_RESET" ] ; then
+ echo 1 >$RS9113_RESET
+ usleep $SLEEPTIME
+ echo 0 >$RS9113_RESET
+ usleep $SLEEPTIME
+ echo 1 >$RS9113_RESET
+ N=1
+ while [ $N -lt 20 ] ; do
+ INT=$(cat $RS9113_INT)
+ WKUP=$(cat $RS9113_WKUP)
+ if [ $INT -ne 1 -o $WKUP -ne 1 ] ; then
+ usleep $INTSLEEPTIME
+ else
+ break
+ fi
+ done
+ if [ $INT -ne 1 ] ; then
+ logger -t rs9113 -p error -s "$RS9113_INT is $INT"
+ fi
+ if [ $WKUP -ne 1 ] ; then
+ logger -t rs9113 -p error -s "$RS9113_WKUP is $WKUP"
+ fi
+ else
+ # No WiFi BT, so exit quietly
+ exit 0
+ fi
+ /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE"
+ /usr/sbin/rs9113_load_modules.sh $CONFIG
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] ; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ ;;
+
+ stop)
+ /usr/bin/logger -t "rs9113" -p info -s "Unloading rs9113 modules"
+ /usr/sbin/rs9113_remove_modules.sh
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] ; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ for dir in /sys/class/net/rpine[0-9]* ; do
+ if [[ -d ${dir} ]] ; then
+ echo Driver is loaded
+ exit 0
+ fi
+ done
+ echo Driver is not loaded
+ exit 3
+ ;;
+ *)
+ "Usage: $0 {start|stop|status|restart}"
+ exit 2
+ ;;
+esac
+
+exit 0
+
diff --git a/recipes-kernel/rs9113/files/rs9113/wpa_supplicant b/recipes-kernel/rs9113/files/rs9113/wpa_supplicant
new file mode 100755
index 0000000..6aa6456
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/wpa_supplicant
@@ -0,0 +1,95 @@
+#! /bin/sh
+# wpa_supplicant
+# Example for /etc/init.d
+# MTS
+#
+PATH=/sbin:/bin:/usr/bin:/usr/sbin
+PIDFILE=/var/run/wpa_suplicant
+CONF=/etc/wpa_supplicant/psk5g.conf
+TIMELIMIT=60
+DRIVERNAME=wifi0
+upinterface() {
+ ((loopcount=1))
+ while ((loopcount < TIMELIMIT)) ; do
+ if [[ $(iw dev ${DRIVERNAME} link) =~ "Connected to " ]] ; then
+ break;
+ fi
+ sleep 1
+ ((loopcount++))
+ done
+ ((loopcount=1))
+ while ((loopcount < TIMELIMIT)) ; do
+ ldifs="$IFS"
+ IFS=$'\n'
+ result=($(ifup wifi0 2>&1))
+ oldifs="$IFS"
+ show=$(ip addr show)
+ if [[ ${show} =~ [[:space:]]+inet[[:space:]]*[0-9].*[[:space:]]+global[[:space:]]+wifi0[[:space:]] ]] ; then
+ break
+ fi
+ ifdown wifi0
+ sleep 1
+ ((loopcount++))
+ done
+ for (( i=0; i < ${#result[@]}; i++ )); do
+ if [[ ${result[i]} =~ ^[[:space:]]*$ ]] ; then
+ continue;
+ fi
+ logger -t ifup -p daemon.info "${result[i]}"
+ done
+}
+
+# ntpd init.d script for ntpdc from ntp.isc.org
+test -x /usr/sbin/wpa_supplicant -a -r $CONF || exit 0
+if ! [[ -r $CONF ]] ; then
+ logger -s -t wpa_supplicant -p daemon.err "Cannot find configuration file $CONF"
+fi
+test -r /etc/default/rcS && . /etc/default/rcS
+
+# Functions to do individual actions
+startdaemon(){
+ echo -n "Starting wpa_supplicant: "
+ /opt/rs9113/onebox_util rpine0 enable_protocol 1
+ /opt/rs9113/onebox_util rpine0 set_country 840
+ /opt/rs9113/onebox_util rpine0 create_vap ${DRIVERNAME} sta sw_bmiss >/dev/null 2>&1
+ start-stop-daemon --start -x wpa_supplicant -- -i ${DRIVERNAME} -D nl80211 -P $PIDFILE /var/run/ -B -c $CONF
+}
+stopdaemon(){
+ echo -n "Stopping ntpd: "
+ start-stop-daemon --stop -p $PIDFILE
+ echo "done"
+}
+
+case "$1" in
+ start)
+ if ! [[ -f ${CONF} ]] ; then
+ echo "Skipping. Configuration file ${CONF} not found."
+ exit 1
+ fi
+ startdaemon
+ { upinterface & }
+ ;;
+ stop)
+ ifdown ${DRIVERNAME} >/dev/null 2>&1
+ stopdaemon
+ ;;
+ force-reload)
+ stopdaemon
+ startdaemon
+ ;;
+ restart)
+ # Don't reset the tick here
+ stopdaemon
+ startdaemon
+ ;;
+ reload)
+ stopdaemon
+ startdaemon
+ ;;
+ *)
+ echo "Usage: wpa_supplicant { start | stop | restart | reload }" >&2
+ exit 1
+ ;;
+esac
+
+exit 0