summaryrefslogtreecommitdiff
path: root/recipes-kernel/rs9113/files
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2016-11-10 19:07:42 -0600
committerJohn Klug <john.klug@multitech.com>2016-11-10 19:07:42 -0600
commite27bfd67df0d435dfe06424373a0036029dc1c02 (patch)
tree4e54df16318e6be38ac7ff5c91b62f060a937d6c /recipes-kernel/rs9113/files
parent669f722c8f65748dbc7ce516cdb0284710390365 (diff)
downloadmeta-multitech-e27bfd67df0d435dfe06424373a0036029dc1c02.tar.gz
meta-multitech-e27bfd67df0d435dfe06424373a0036029dc1c02.tar.bz2
meta-multitech-e27bfd67df0d435dfe06424373a0036029dc1c02.zip
Move MTC written code into .net (eventually).
Diffstat (limited to 'recipes-kernel/rs9113/files')
-rw-r--r--recipes-kernel/rs9113/files/rs9113/rs9113.default53
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/rs9113.init93
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/wpa_supplicant95
3 files changed, 241 insertions, 0 deletions
diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.default b/recipes-kernel/rs9113/files/rs9113/rs9113.default
new file mode 100644
index 0000000..9d474bc
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/rs9113.default
@@ -0,0 +1,53 @@
+# 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
+
diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init
new file mode 100755
index 0000000..2351ae4
--- /dev/null
+++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init
@@ -0,0 +1,93 @@
+#!/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=/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)
+ # Reset the RS9113 chip is ready, and
+ # wait for it to settle.
+ if [ -f "$RS9113_RESET" ] ; then
+ echo 1 >$RS9113_RESET
+ usleep 100
+ echo 0 >$RS9113_RESET
+ usleep 100
+ 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 100
+ 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
+ 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