summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade
diff options
context:
space:
mode:
authorThang Q. Nguyen <thang@os.amperecomputing.com>2022-11-24 10:48:51 +0300
committerThang Q. Nguyen <thang@os.amperecomputing.com>2022-11-24 12:27:43 +0300
commit267615d40583cb345d1be49dda4f9d1ab92cba8c (patch)
treedf1fc81a2bcb8fd30e1ff2eef9138d482b59739c /meta-ampere/meta-jade
parent88f0431e59d7335e8c627d1dfcba1c9667e50705 (diff)
downloadopenbmc-267615d40583cb345d1be49dda4f9d1ab92cba8c.tar.xz
meta-ampere: mtjade: bind smpro driver
Add script to bind smpro driver when the Host is available but it is not bound before. This helps applications that use smpro driver works. Tested: 1. Do A/C the system. 2. Turn ON the Host 3. Check if smpro nodes are available # ls /sys/bus/i2c/drivers/smpro-core/ 2-004e 2-004f bind uevent unbind Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com> Change-Id: I6f96dc1f78ab77dae29bdc266949dcf7845de68c
Diffstat (limited to 'meta-ampere/meta-jade')
-rw-r--r--meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils.bbappend2
-rw-r--r--meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_driver_binder.sh29
2 files changed, 31 insertions, 0 deletions
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils.bbappend b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils.bbappend
index d3f4f1a021..e3a63f1d64 100644
--- a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils.bbappend
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils.bbappend
@@ -6,6 +6,7 @@ SRC_URI:append = " \
file://ampere_power_util.sh \
file://ampere_firmware_upgrade.sh \
file://ampere_flash_bios.sh \
+ file://ampere_driver_binder.sh \
"
do_install:append() {
@@ -15,4 +16,5 @@ do_install:append() {
install -m 0755 ${WORKDIR}/ampere_power_util.sh ${D}/${sbindir}/
install -m 0755 ${WORKDIR}/ampere_firmware_upgrade.sh ${D}/${sbindir}/
install -m 0755 ${WORKDIR}/ampere_flash_bios.sh ${D}/${sbindir}/
+ install -m 0755 ${WORKDIR}/ampere_driver_binder.sh ${D}/${sbindir}/
}
diff --git a/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_driver_binder.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_driver_binder.sh
new file mode 100644
index 0000000000..d41901968a
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-utils/ampere_driver_binder.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+DELAY_BEFORE_BIND=5000000
+# Each driver include driver name and driver path
+declare -a DRIVER_NAMEs=("2-004f"
+ "2-004e"
+ )
+# Driver path should include / at the end
+declare -a DRIVER_PATHs=("/sys/bus/i2c/drivers/smpro-core/"
+ "/sys/bus/i2c/drivers/smpro-core/"
+ )
+
+# get length of an array
+arraylength=${#DRIVER_NAMEs[@]}
+
+usleep $DELAY_BEFORE_BIND
+# use for loop to read all values and indexes
+for (( i=0; i<"${arraylength}"; i++ ));
+do
+ bindFile="${DRIVER_PATHs[$i]}bind"
+ driverDir="${DRIVER_PATHs[$i]}${DRIVER_NAMEs[$i]}"
+ if [ -d "$driverDir" ]; then
+ echo "Driver ${DRIVER_NAMEs[$i]} is already bound."
+ continue;
+ fi
+ echo "${DRIVER_NAMEs[$i]}" > "$bindFile"
+done
+
+exit 0