diff options
3 files changed, 35 insertions, 0 deletions
diff --git a/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere_host_check.sh b/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere_host_check.sh index 9759b880cc..ea60fcf697 100644 --- a/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere_host_check.sh +++ b/meta-ampere/meta-common/recipes-ampere/host/ampere-hostctrl/ampere_host_check.sh @@ -18,6 +18,10 @@ do Get ss xyz.openbmc_project.Condition.HostFirmware \ CurrentFirmwareCondition | cut -d"." -f6) if [ "$st" == "Running\"" ]; then + if command -v ampere_driver_binder.sh; + then + ampere_driver_binder.sh + fi exit 0 fi sleep 1 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 |