diff options
-rw-r--r-- | recipes-bsp/multitech/mts-io/mts-io.mtcap.init | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init index 1366f28..8a597d7 100644 --- a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init +++ b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init @@ -1,5 +1,6 @@ #!/bin/bash +sysdir=/sys/devices/platform/mts-io lora_init() { # reset lora chip mts-io-sysfs store lora/reset 1 @@ -16,6 +17,23 @@ eth_init() { mts-io-sysfs store eth-reset 1 } +# Normal state when powered up +wifi_init1() { + [[ -f ${sysdir}/capability/wifi ]] || return 0 + # reset wlan + mts-io-sysfs store wlan-rst 0 + # disable wlan + mts-io-sysfs store wlan-en 0 +} + +wifi_init2() { + [[ -f ${sysdir}/capability/wifi ]] || 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] @@ -34,16 +52,23 @@ start_lora_led_updater() { case $1 in start) echo "Loading mts-io module" + modprobe -r atmel_mci modprobe mts_io + wifi_init1 lora_init eth_init cell_init & start_lora_led_updater + wifi_init2 + modprobe atmel_mci + [[ -f ${sysdir}/capability/wifi ]] && modprobe wilc1000 ;; stop) echo "Unloading mts-io module" - modprobe -r mts_io + wifi_init1 # Power down wifi + [[ -f ${sysdir}/capability/wifi ]] && modprobe -r wilc1000 >/dev/null 2>&1 + modprobe -r mts_io >/dev/null 2>&1 ;; *) |