diff options
author | John Klug <john.klug@multitech.com> | 2022-02-24 14:23:55 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2022-02-24 14:23:55 -0600 |
commit | 3aa6fa307425933c3e73ffa713f58cb60650ccc4 (patch) | |
tree | 0da93daf2ee9930e4dc3d74c58d0e0b07ea405c0 | |
parent | 59bb64c05292cd9630b55f7fdd1ba29101a585bc (diff) | |
download | meta-multitech-3aa6fa307425933c3e73ffa713f58cb60650ccc4.tar.gz meta-multitech-3aa6fa307425933c3e73ffa713f58cb60650ccc4.tar.bz2 meta-multitech-3aa6fa307425933c3e73ffa713f58cb60650ccc4.zip |
MTAC-GPIOB and LoRa overlays
-rwxr-xr-x | recipes-bsp/multitech/mt-dt-overlay/init | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/recipes-bsp/multitech/mt-dt-overlay/init b/recipes-bsp/multitech/mt-dt-overlay/init index 00af9f8..4c82e12 100755 --- a/recipes-bsp/multitech/mt-dt-overlay/init +++ b/recipes-bsp/multitech/mt-dt-overlay/init @@ -5,41 +5,54 @@ # device tree. sysdir=/sys/devices/platform/mts-io -i2c=/sys/bus/i2c/devices/ -eepromPath="/sys/bus/i2c/devices/0-0056/eeprom" +I2CDIR="/sys/bus/i2c/devices" +eepromPath="${I2CDIR}/0-0056/eeprom" DEVTREE="/sys/kernel/config/device-tree/overlays/" SYSFS="/usr/sbin/mts-io-sysfs" -I2CDIR="/sys/bus/i2c/devices" -AP1_EEPROM=$I2CDIR"/1-0050/eeprom" -AP2_EEPROM=$I2CDIR"/1-0052/eeprom" +AP1_EEPROM=${I2CDIR}"/1-0050/eeprom" +AP2_EEPROM=${I2CDIR}"/1-0052/eeprom" + +install_all_dtbo() { + for f in *.dtbo ; do + if ! [[ -f $f ]] ; then + continue + fi + # f2 is the extracted device name + base=$(basename $f .dtbo) + /bin/mkdir ${DEVTREE}/$base || true + /bin/cat $f >${DEVTREE}/$base/dtbo + done +} install_dtbo_dir() { if ! [[ -d ${DEVTREE} ]] ; then mount configfs fi - if ([ -f "$AP1_EEPROM" ] && grep -q GPIOB "$AP1_EEPROM") || ([ -f "$AP2_EEPROM" ] && grep -q GPIOB "$AP2_EEPROM"); then - for f in *gpiob.dtbo ; do - if ! [[ -f $f ]] ; then - continue - fi - # f2 is the extracted device name - base=$(basename $f .dtbo) - /bin/mkdir ${DEVTREE}/$base || true - /bin/cat $f >${DEVTREE}/$base/dtbo - done - modprobe mt_ac_gpiob + install_all_dtbo + gpiob1=0 + gpiob2=0 + if [[ -f $AP1_EEPROM ]] ; then + eeprom1=$(mts-id-eeprom --accessory-card --in-file "$AP1_EEPROM" 2>/dev/null) + if [[ $eeprom1 =~ [[:space:]]hw-version:[[:space:]]*\"MTAC-GPIOB- ]] ; then + gpiob1=1 + fi + fi + if [[ -f $AP2_EEPROM ]] ; then + eeprom2=$(mts-id-eeprom --accessory-card --in-file "$AP2_EEPROM" 2>/dev/null) + if [[ $eeprom2 =~ [[:space:]]hw-version:[[:space:]]*\"MTAC-GPIOB- ]] ; then + gpiob2=1 + fi + fi + + if ((gpiob1 == 1)) || ((gpiob2 == 1)) ; then + /usr/bin/logger -t "mts-io" -p daemon.info -s 'Loading MTAC-GPIOB Device Tree' + cd gpiob else - for f in *.dtbo ; do - if ! [[ -f $f ]] ; then - continue - fi - # f2 is the extracted device name - base=$(basename $f .dtbo) - /bin/mkdir ${DEVTREE}/$base || true - /bin/cat $f >${DEVTREE}/$base/dtbo - done + /usr/bin/logger -t "mts-io" -p daemon.info -s 'Loading standard SPI Device Tree' + cd lora fi + install_all_dtbo } # Device tree format: |