summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mt-dt-overlay/init
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2021-10-14 15:27:23 -0500
committerHarsh Sharma <harsh.sharma@multitech.com>2021-10-14 15:27:23 -0500
commitd390864f59232db90b80e5e65705c03687db2f1a (patch)
tree86a1a80e6c2587f9bcc448413c0b9150ef610a40 /recipes-bsp/multitech/mt-dt-overlay/init
parentcba0437d85be754c0f06d4ad92628e0ae6403eba (diff)
downloadmeta-multitech-d390864f59232db90b80e5e65705c03687db2f1a.tar.gz
meta-multitech-d390864f59232db90b80e5e65705c03687db2f1a.tar.bz2
meta-multitech-d390864f59232db90b80e5e65705c03687db2f1a.zip
Added support for mtac-003
Diffstat (limited to 'recipes-bsp/multitech/mt-dt-overlay/init')
-rwxr-xr-xrecipes-bsp/multitech/mt-dt-overlay/init44
1 files changed, 30 insertions, 14 deletions
diff --git a/recipes-bsp/multitech/mt-dt-overlay/init b/recipes-bsp/multitech/mt-dt-overlay/init
index 5114e4e..5bd8523 100755
--- a/recipes-bsp/multitech/mt-dt-overlay/init
+++ b/recipes-bsp/multitech/mt-dt-overlay/init
@@ -5,24 +5,39 @@
# device tree.
sysdir=/sys/devices/platform/mts-io
-i2c=/sys/bus/i2c/devices/
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"
install_dtbo_dir() {
- for f in *.dtbo ; do
- if ! [[ -f $f ]] ; then
- continue
- fi
- if ! [[ -d ${DEVTREE} ]] ; then
- mount configfs
- fi
- # f2 is the extracted device name
- base=$(basename $f .dtbo)
- /bin/mkdir ${DEVTREE}/$base || true
- /bin/cat $f >${DEVTREE}/$base/dtbo
- done
+ 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
+ else
+ for f in *lora.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
+ fi
}
# Device tree format:
@@ -57,7 +72,7 @@ setdevtree() {
done
if [[ $best == -1 ]] ; then
# No overlay found
- exit 0
+ exit 0
fi
cd $best
install_dtbo_dir
@@ -93,3 +108,4 @@ case $1 in
exit 2
;;
esac
+