summaryrefslogtreecommitdiff
path: root/recipes-bsp
diff options
context:
space:
mode:
authorVyacheslav Pedash <vyacheslav.pedash@globallogic.com>2022-09-02 15:25:44 +0300
committerVyacheslav Pedash <vyacheslav.pedash@globallogic.com>2022-09-02 15:25:44 +0300
commit5c53f99e443f06cd10a90488c42ffea630d3ebd3 (patch)
tree2ef477c43c0f479aa3b84944c037719e21689cb0 /recipes-bsp
parent67c5678a972497a7a25102c41ec281e969b7dbf2 (diff)
downloadmeta-multitech-5c53f99e443f06cd10a90488c42ffea630d3ebd3.tar.gz
meta-multitech-5c53f99e443f06cd10a90488c42ffea630d3ebd3.tar.bz2
meta-multitech-5c53f99e443f06cd10a90488c42ffea630d3ebd3.zip
MTX-4590 MTCDT3AC: Probe I2C GPIO to load device tree overlay on SD manufacturing image
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/multitech/mt-dt-overlay/init-mtcpmhs-sdmfg69
-rw-r--r--recipes-bsp/multitech/mt-dt-overlay_1.2.9.bb15
2 files changed, 79 insertions, 5 deletions
diff --git a/recipes-bsp/multitech/mt-dt-overlay/init-mtcpmhs-sdmfg b/recipes-bsp/multitech/mt-dt-overlay/init-mtcpmhs-sdmfg
new file mode 100644
index 0000000..2a0e03d
--- /dev/null
+++ b/recipes-bsp/multitech/mt-dt-overlay/init-mtcpmhs-sdmfg
@@ -0,0 +1,69 @@
+#!/bin/bash
+# This script must be run only to set up device tree on new devices
+# as part of manufacturing process when EEPROMs are empty
+
+
+DEVTREE="/sys/kernel/config/device-tree/overlays/"
+
+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
+}
+
+load_overlay() {
+ if ! pushd /lib/dtoverlays ; then
+ echo "Can't find device tree overlays"
+ return 1
+ fi
+
+ # Detect PCA9557 I2C GPIO at 0x19 on I2C bus 1
+ RES_="$(/usr/sbin/i2cdetect -r -y 1 0x19 0x19)"
+ if [[ "$RES_" =~ .*(^10:[[:blank:]]+19).* ]]; then
+ if ! pushd MTCDT3/0.2 ; then
+ echo "Can't find MTCDT3/0.2 direcotry"
+ popd
+ return 1
+ fi
+ echo "Loading device tree overlay for MTCDT3 v 0.2"
+ install_all_dtbo
+ popd
+ fi
+
+ # Detect MCP23008 I2C GPIO at 0x21 on I2C bus 1
+ RES_="$(/usr/sbin/i2cdetect -r -y 1 0x21 0x21)"
+ if [[ "$RES_" =~ .*(^20:[[:blank:]]+21).* ]]; then
+ if ! pushd MTCDT3/0.0 ; then
+ echo "Can't find MTCDT3/0.0 direcotry"
+ popd
+ return 1
+ fi
+ echo "Loading device tree overlay for MTCDT3 v 0.0"
+ install_all_dtbo
+ popd
+ fi
+
+ popd
+}
+
+case $1 in
+ start)
+ echo "Loading device tree overlay"
+ load_overlay
+ ;;
+
+ stop)
+ echo "Not implemented"
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 2
+ ;;
+esac
diff --git a/recipes-bsp/multitech/mt-dt-overlay_1.2.9.bb b/recipes-bsp/multitech/mt-dt-overlay_1.2.9.bb
index 02e3d2d..356357d 100644
--- a/recipes-bsp/multitech/mt-dt-overlay_1.2.9.bb
+++ b/recipes-bsp/multitech/mt-dt-overlay_1.2.9.bb
@@ -24,12 +24,13 @@ COMPATIBLE_MACHINE = "(mtcap|mtrv1|mtcdt|mtcpmhs)"
dt_dir = "/lib/dtoverlays"
-PR = "r1"
+PR = "r2"
SRC_URI = " \
- git://git.multitech.net/cgit/mt-dt-overlay.git;protocol=https \
- file://init-default \
- file://init-mtcpmhs \
+ git://git.multitech.net/cgit/mt-dt-overlay.git;protocol=https \
+ file://init-default \
+ file://init-mtcpmhs \
+ file://init-mtcpmhs-sdmfg \
"
SRCREV = "${PV}"
@@ -63,7 +64,11 @@ addtask install after do_compile
do_install () {
install -d ${D}/${sysconfdir}/init.d
if [ ${MACHINE} = "mtcpmhs" ] ; then
- install -m 0755 ${WORKDIR}/init-mtcpmhs ${D}/${sysconfdir}/init.d/${PN}
+ if [ "${SDMFG}" = "" ]; then
+ install -m 0755 ${WORKDIR}/init-mtcpmhs ${D}/${sysconfdir}/init.d/${PN}
+ else
+ install -m 0755 ${WORKDIR}/init-mtcpmhs-sdmfg ${D}/${sysconfdir}/init.d/${PN}
+ fi
else
install -m 0755 ${WORKDIR}/init-default ${D}/${sysconfdir}/init.d/${PN}
fi