diff options
author | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2022-03-06 16:12:46 +0200 |
---|---|---|
committer | Serhii Kostiuk <serhii.o.kostiuk@globallogic.com> | 2022-03-06 16:12:46 +0200 |
commit | d1a5bc4ea36ba9cd56fd9951870e4dc8db0e4c80 (patch) | |
tree | 7bda730a3a37e8adcea6d1f89da2e0fabf162522 /recipes-bsp/multitech/mt-dt-overlay/init | |
parent | 309117e7ff1663eb2b1cb3dba0073e9ef6d67282 (diff) | |
parent | 2000a04054bebf674357de12365853b58ec9137e (diff) | |
download | meta-multitech-d1a5bc4ea36ba9cd56fd9951870e4dc8db0e4c80.tar.gz meta-multitech-d1a5bc4ea36ba9cd56fd9951870e4dc8db0e4c80.tar.bz2 meta-multitech-d1a5bc4ea36ba9cd56fd9951870e4dc8db0e4c80.zip |
Merge remote-tracking branch 'origin/6' into mpower-dev-nxp
Diffstat (limited to 'recipes-bsp/multitech/mt-dt-overlay/init')
-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: |