summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/multitech/mts-io/mts-io.mtcap.init')
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.mtcap.init122
1 files changed, 0 insertions, 122 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
deleted file mode 100644
index 2642de9..0000000
--- a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/bash
-
-sysdir=/sys/devices/platform/mts-io
-
-i2c=/sys/bus/i2c/devices/
-
-DEVTREE="/sys/kernel/config/device-tree/overlays/"
-SYSFS="/usr/sbin/mts-io-sysfs"
-
-setwificap() {
- WIFICAP=0
- if [[ -f ${sysdir}/capability/wifi ]] && (($(cat ${sysdir}/capability/wifi) == 1)) ; then
- WIFICAP=1
- fi
-}
-
-lora_init() {
- # reset lora chip
- mts-io-sysfs store lora/reset 1
- mts-io-sysfs store lora/reset 0
- usleep 100000
- mts-io-sysfs store lora/reset 1
-}
-
-eth_init() {
- # reset eth phy
- mts-io-sysfs store eth-reset 1
- mts-io-sysfs store eth-reset 0
- usleep 100000
- mts-io-sysfs store eth-reset 1
-}
-
-# Normal state when powered up
-wifi_init1() {
- (($WIFICAP)) || return 0
- # reset wlan
- mts-io-sysfs store wlan-rst 0
- # disable wlan
- mts-io-sysfs store wlan-en 0
-}
-
-wifi_init2() {
- (($WIFICAP)) || return 0
- mts-io-sysfs store wlan-en 1
- usleep 30000 # 30mS according to WILC1000 spec.
- mts-io-sysfs store wlan-rst 1
-}
-
-
-cell_init() {
- # remove /dev/modem_at[0,1] symlinks
- rm -f /dev/modem_at[0,1]
-
- if [ -w /sys/devices/platform/mts-io/radio-power ] ; then
- # power down the cellular chip gracefully
- mts-io-sysfs store radio-power 0
- # power up the cellular chip
- mts-io-sysfs store radio-power 1
- fi
-}
-
-start_lora_led_updater() {
- lora-led-updater &
-}
-
-setdevtree() {
- hw=$(${SYSFS} show hw-version)
-
- # add device tree overlays, if they exist.
- [[ -d /lib/dtoverlays ]] || return 1
- (
- cd /lib/dtoverlays
- for f in $(ls ${hw}*) ; do
- if ! [[ -d ${DEVTREE} ]] ; then
- mount configfs
- fi
- f1=${f/#${hw}-/}
- f2=${f1/%.dtbo}
- # f2 is the extracted device name
- /bin/mkdir ${DEVTREE}/$f2
- /bin/cat $f >${DEVTREE}/$f2/dtbo
- done
- )
-}
-
-case $1 in
- start)
- # SPI driver for LoRa
- modprobe spidev
- # Point the firmware API at our i2c EEPROMs
- echo -n ${i2c} > /sys/module/firmware_class/parameters/path
- echo "Loading mts-io module"
- modprobe -r atmel_mci
- # Point the firmware API at our i2c EEPROMs
- echo -n ${i2c} > /sys/module/firmware_class/parameters/path
- modprobe mts_io
- setdevtree
- setwificap
- wifi_init1
- lora_init
- eth_init
- cell_init &
- start_lora_led_updater
- wifi_init2
- modprobe atmel_mci
- (($WIFICAP)) && modprobe wilc1000
- (($WIFICAP)) && modprobe wilc1000-sdio
- ;;
-
- stop)
- echo "Unloading mts-io module"
- wifi_init1 # Power down wifi
- modprobe -r wilc1000 >/dev/null 2>&1
- modprobe -r wilc1000-sdio >/dev/null 2>&1
- modprobe -r mts_io >/dev/null 2>&1
- ;;
-
- *)
- echo "Usage: $0 {start|stop}"
- exit 2
- ;;
-esac