summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mts-io
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2016-11-04 14:55:32 -0500
committerJohn Klug <john.klug@multitech.com>2016-11-04 14:55:32 -0500
commit398ef28d10af33fc98b77f716afb4b65e33bcce9 (patch)
treebeaadfa387579903fe3dd6f8083bb9acfab02f8a /recipes-bsp/multitech/mts-io
parent217574f63808e312587bc9f8bfce34fa44b9e6fe (diff)
downloadmeta-multitech-398ef28d10af33fc98b77f716afb4b65e33bcce9.tar.gz
meta-multitech-398ef28d10af33fc98b77f716afb4b65e33bcce9.tar.bz2
meta-multitech-398ef28d10af33fc98b77f716afb4b65e33bcce9.zip
Add mts-io cdone & optional gnss-reset, debug configuration
Diffstat (limited to 'recipes-bsp/multitech/mts-io')
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.conf9
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.init38
2 files changed, 41 insertions, 6 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.conf b/recipes-bsp/multitech/mts-io/mts-io.conf
new file mode 100644
index 0000000..b5b4275
--- /dev/null
+++ b/recipes-bsp/multitech/mts-io/mts-io.conf
@@ -0,0 +1,9 @@
+# GPS GNSS reset when loading driver
+# 1 Reset the GPS on driver load (default)
+# 0 Do not reset
+GPSGNSSRESET=1
+
+# DEBUG
+# 0 is off
+# 1 is on
+DEBUG=0
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index 45d45df..550cc85 100644
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -9,10 +9,12 @@
# Conduit features.
### END INIT INFO
+. /etc/default/mts-io
((fail=0))
# To log debug, set LOGDBG to /usr/bin/LOGGER
if ((DEBUG)) ; then
LOGDBG=/usr/bin/logger
+ ${LOGDBG} -t "mts-io" -p daemon.info -s "LOGDBG turned on"
else
LOGDBG=":"
fi
@@ -29,15 +31,38 @@ RST[2]="${sysdir}/ap1/reset"
RST[3]="${sysdir}/ap1/creset"
RST[4]="${sysdir}/ap2/reset"
RST[5]="${sysdir}/ap2/creset"
-RST[6]="${sysdir}/gnss-reset"
-RST[7]="${sysdir}/secure-reset"
-RST[8]="${sysdir}/eth-reset"
-RST[9]="${sysdir}/sm1-reset"
+RST[6]="${sysdir}/secure-reset"
+RST[7]="${sysdir}/eth-reset"
+RST[8]="${sysdir}/sm1-reset"
+if ((GPSGNSSRESET)) ; then
+ RST[9]="${sysdir}/gnss-reset"
+fi
+WPIN[0]="${sysdir}/ap1/cdone"
+WPIN[1]="${sysdir}/ap2/cdone"
USLPTIME=60000 # 30 milliseconds from Redpine Signals Reset Spec
WAIT="/bin/busybox usleep ${USLPTIME}"
+# Wait 10 WAIT intervals for pins to come high
+waitpins() {
+ ((i=0))
+ while((i < ${#WPIN[@]})) ; do
+ ((j=0))
+ while [[ -r ${WPIN[$i]} ]] && ! (($(cat ${WPIN[$i]}))) ; do
+ logger -t "mts-io" -p daemon.error -s "Wait on ${WPIN[$i]}"
+ ${WAIT}
+ ((j++))
+ if ((j > 10)) ; then
+ ((fail++))
+ ${LOGDBG} -t "mts-io" -p daemon.error -s "Ready failure on ${WPIN[$i]}"
+ break
+ fi
+ done
+ ((i++))
+ done
+}
+
reset_path() {
pin=$1
${LOGDBG} -t "mts-io" -p daemon.info Reset $pin
@@ -55,7 +80,6 @@ reset_path() {
return 0
}
reset_array() {
- fail=0
((i=${#RST[@]}-1))
while ((i>=0)) ; do
if [[ -f ${RST[$i]} ]] ; then
@@ -158,7 +182,9 @@ case $1 in
if ! reset_path $RS9113RST ; then
((fail++))
fi
-
+
+ waitpins
+
if ((fail == 0)) ; then
echo "OK"
else