diff options
Diffstat (limited to 'recipes-bsp/multitech/mts-io/mts-io.init')
-rwxr-xr-x | recipes-bsp/multitech/mts-io/mts-io.init | 72 |
1 files changed, 49 insertions, 23 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init index 966d5ae..fee8f61 100755 --- a/recipes-bsp/multitech/mts-io/mts-io.init +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -14,6 +14,9 @@ i2c=/sys/bus/i2c/devices/ GPSCONFIGTYPE="/var/run/config/gpstype" DEVTREE="/sys/kernel/config/device-tree/overlays/" +HWPATH="/sys/devices/platform/mts-io/hw-version" +MTSIOMODPATH="/lib/modules/$(uname -r)/extra/" +MTCDTBB="${MTSIOMODPATH}/mtcdt3b.ko" ((fail=0)) # To log debug, set LOGDBG to /usr/bin/LOGGER @@ -28,9 +31,11 @@ hw="" hw_name="" MTAC_MODULES="" ((HASAP=0)) +((HASBB=0)) sethwtype() { # mts-io must be loaded before trying this + # Also, mtcdt3b should be loaded if it exists hw=$(${SYSFS} show hw-version) hw_name=(${hw//-/ }) @@ -43,10 +48,15 @@ sethwtype() { MTCDT|MTCDTIP) ((HASAP = 1)) ;; + MTCDT3) + ((HASBB = 1)) + ;; *) ;; esac - MTAC_MODULES=$(cd /lib/modules/$(uname -r)/extra/;ls mtac_* 2>/dev/null) + MTAC_MODULES=$(cd ${MTSIOMODPATH};ls mtac_* 2>/dev/null) + MTBB_MODULES=$(cd ${MTSIOMODPATH};ls mtcdt3b_* 2>/dev/null) + } setdevtree() { @@ -93,14 +103,18 @@ RST[5]="${sysdir}/ap2/creset" RST[6]="${sysdir}/secure-reset" RST[7]="${sysdir}/eth-reset" RST[8]="${sysdir}/sm1-reset" - -# GPSGNSSRESET is now set low during boot and is special cased. -#if ((GPSGNSSRESET)) ; then -# RST[9]="${sysdir}/gnss-reset" -#fi +RST[9]="${sysdir}/slot1/reset" +RST[10]="${sysdir}/slot1/creset" +RST[11]="${sysdir}/slot2/reset" +RST[12]="${sysdir}/slot2/creset" +if ((GPSGNSSRESET)) ; then + RST[13]="${sysdir}/gnss-reset" +fi WPIN[0]="${sysdir}/ap1/cdone" WPIN[1]="${sysdir}/ap2/cdone" +WPIN[2]="${sysdir}/slot1/cdone" +WPIN[3]="${sysdir}/slot2/cdone" USLPTIME=60000 # 30 milliseconds from Redpine Signals Reset Spec WAIT="/bin/busybox usleep ${USLPTIME}" @@ -257,11 +271,18 @@ set_gpslink() { return fi - if [[ ${hw_name} == MTR ]] || [[ ${hw_name} == MTRV1 ]] || [[ ${hw_name} == MTHS ]] ; then - ln -sf /dev/ttyS1 /dev/gps0 - echo "venus" >"$GPSCONFIGTYPE" - return - fi + case ${hw_name} in + MTR|MTRV1|MTHS) + ln -sf /dev/ttyS1 /dev/gps0 + echo "venus" >"$GPSCONFIGTYPE" + return + ;; + MTCDT3) + ln -sf /dev/ttyS1 /dev/gps0 + echo "u-blox" >"$GPSCONFIGTYPE" + return + ;; + esac if [[ ${hw} == MTCDT ]] && [[ ${HWLVL} == 0.0 ]] ; then # No GPS @@ -286,7 +307,13 @@ case $1 in if ! modprobe mts_io ; then ((fail++)) fi - + # MTCDTBB driver is needed to determine the product type on MTCDT3 + if [[ -f ${MTCDTBB} ]] ; then + if ! modprobe mtcdt3b ; then + ((fail++)) + fi + fi + sethwtype setdevtree @@ -298,22 +325,20 @@ case $1 in modprobe ${f//.ko} 2>&1 | grep -v 'No such device or address' done fi + + if ((${#MTBB_MODULES})) ; then + # install mcdt3b explicitly or any unused modules will cause + # junk to the log as mtcdt3b is loaded and unloaded each time. + modprobe mtcdt3b + for f in ${MTBB_MODULES} ; do + modprobe ${f//.ko} 2>&1 | grep -v 'No such device or address' + done + fi set_gpslink # Set GPS symlink. /usr/bin/logger -t "mts-io" -p daemon.info -s "Resetting system modules" read_card_info - has_gnss_reset=0 - # On boot, gnss-reset will be low - if [[ -f ${sysdir}/gnss-reset ]] ; then - if (($(mts-io-sysfs show gnss-reset) == 1)) ; then - mts-io-sysfs store gnss-reset 0 - fi - has_gnss_reset=1 - fi /bin/busybox usleep $USLPTIME reset_array - if ((has_gnss_reset)) ; then - mts-io-sysfs store gnss-reset 1 - fi # use radio-reset init script for radio-reset mfser_init @@ -347,6 +372,7 @@ case $1 in stop) /usr/bin/logger -t "mts-io" -p daemon.info -s "Unloading mtac modules and mts-io module" MTAC_MODULES=$(lsmod | grep '^mtac_' | sed -e 's/_/-/' -e 's/ .*//') + MTCDT3B_MODULES=$(lsmod | grep '^mtcdt3b_' | sed -e 's/_/-/' -e 's/ .*//') for f in ${MTAC_MODULES} ; do if ! modprobe -r "$f" ; then |