diff options
author | Christopher Bostic <cbostic@linux.vnet.ibm.com> | 2017-06-07 16:12:27 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-06-14 07:11:32 +0000 |
commit | 1fd06ed3f000caab3abb140a1dab155a6f7a2d28 (patch) | |
tree | 18bdbaa9395dbc468df302f5fc54d58fe23a110b | |
parent | 35cfa8430e5800c159d69fe06158b3b019414981 (diff) | |
download | talos-openbmc-1fd06ed3f000caab3abb140a1dab155a6f7a2d28.tar.gz talos-openbmc-1fd06ed3f000caab3abb140a1dab155a6f7a2d28.zip |
Add ir35221 bind/unbind service to vrm control
Add service to bind and unbind ir35221 devices so that i2cset/get
won't run into problems with device conflicts during power on/off
script execution.
Resolves openbmc/openbmc#1702
Change-Id: I77020313f11700acaecf0c04f2c67b7ea7b4da6b
Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
6 files changed, 94 insertions, 5 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control.bb b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control.bb index acb4002a0..e2c09e1bf 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control.bb +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control.bb @@ -8,17 +8,41 @@ inherit obmc-phosphor-license RDEPENDS_${PN} += "i2c-tools bash" S = "${WORKDIR}" -SRC_URI += "file://vrm-control.sh" +SRC_URI += "file://vrm-control.sh \ + file://ir35221-unbind-bind.sh" do_install() { install -d ${D}${bindir} install -m 0755 ${WORKDIR}/vrm-control.sh ${D}${bindir}/vrm-control.sh + install -m 0755 ${WORKDIR}/ir35221-unbind-bind.sh ${D}${bindir}/ir35221-unbind-bind.sh } TMPL = "vrm-control@.service" INSTFMT = "vrm-control@{0}.service" -TGTFMT = "obmc-chassis-poweron@{0}.target" -FMT = "../${TMPL}:${TGTFMT}.requires/${INSTFMT}" +TGTFMT_ON = "obmc-chassis-poweron@{0}.target" +FMT_ON = "../${TMPL}:${TGTFMT_ON}.requires/${INSTFMT}" -SYSTEMD_SERVICE_${PN} += "${TMPL}" -SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}" +TMPL_ON_IRBIND = "ir35221-on-bind@.service" +INSTFMT_ON_IRBIND = "ir35221-on-bind@{0}.service" +FMT_ON_IRBIND = "../${TMPL_ON_IRBIND}:${TGTFMT_ON}.requires/${INSTFMT_ON_IRBIND}" + +TMPL_ON_IRUNBIND = "ir35221-on-unbind@.service" +INSTFMT_ON_IRUNBIND = "ir35221-on-unbind@{0}.service" +FMT_ON_IRUNBIND = "../${TMPL_ON_IRUNBIND}:${TGTFMT_ON}.requires/${INSTFMT_ON_IRUNBIND}" + +TGTFMT_OFF = "obmc-chassis-poweroff@{0}.target" + +TMPL_OFF_IRBIND = "ir35221-off-bind@.service" +INSTFMT_OFF_IRBIND = "ir35221-off-bind@{0}.service" +FMT_OFF_IRBIND = "../${TMPL_OFF_IRBIND}:${TGTFMT_OFF}.requires/${INSTFMT_OFF_IRBIND}" + +TMPL_OFF_IRUNBIND = "ir35221-off-unbind@.service" +INSTFMT_OFF_IRUNBIND = "ir35221-off-unbind@{0}.service" +FMT_OFF_IRUNBIND = "../${TMPL_OFF_IRUNBIND}:${TGTFMT_OFF}.requires/${INSTFMT_OFF_IRUNBIND}" + +SYSTEMD_SERVICE_${PN} += "${TMPL} ${TMPL_ON_IRUNBIND} ${TMPL_ON_IRBIND} ${TMPL_OFF_IRUNBIND} ${TMPL_OFF_IRBIND}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON_IRBIND', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON_IRUNBIND', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_OFF_IRBIND', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_OFF_IRUNBIND', 'OBMC_CHASSIS_INSTANCES')}" diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-bind@.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-bind@.service new file mode 100644 index 000000000..aa5a079a2 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-bind@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Power off mode bind ir35221 device driver devs +After=obmc-power-stop@%i.target +Wants=obmc-power-stop@i.target +After=vcs_off_poweroff@%i.service +Conflicts=obmc-chassis-poweron@%i.target + +[Service] +ExecStart=/usr/bin/ir35221-unbind-bind.sh bind +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-poweroff@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-unbind@.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-unbind@.service new file mode 100644 index 000000000..ef461343c --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-off-unbind@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Power off mode unbind ir35221 device driver devs +After=obmc-host-stop-pre@%i.target +Before=vcs_off_poweroff@%i.service +Conflicts=obmc-chassis-poweron@%i.target + +[Service] +ExecStart=/usr/bin/ir35221-unbind-bind.sh unbind +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-poweroff@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-bind@.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-bind@.service new file mode 100644 index 000000000..49d16389d --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-bind@.service @@ -0,0 +1,15 @@ +[Unit] +Description=Power on bind ir35221 device driver devs +After=vcs_on@%i.service +Wants=obmc-host-start-pre@%i.target +Before=obmc-host-start-pre@%i.target +Conflicts=obmc-chassis-poweroff@%i.target +ConditionPathExists=!/run/openbmc/chassis@%i-on + +[Service] +ExecStart=/usr/bin/ir35221-unbind-bind.sh bind +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-poweron@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-unbind@.service b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-unbind@.service new file mode 100644 index 000000000..7638538d1 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-on-unbind@.service @@ -0,0 +1,14 @@ +[Unit] +Description=power on mode unbind ir35221 device driver devs +Wants=obmc-power-start-pre@%i.target +Before=obmc-power-start-pre@%i.target +Conflicts=obmc-chassis-poweroff@%i.target +ConditionPathExists=!/run/openbmc/chassis@%i-on + +[Service] +ExecStart=/usr/bin/ir35221-unbind-bind.sh unbind +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-poweron@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-unbind-bind.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-unbind-bind.sh new file mode 100644 index 000000000..eea5070f7 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/vrm-control/ir35221-unbind-bind.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# ######################################################### +# Script to run on witherspoon BMC to unbind/bind the ir35221 +# driver's devices + +echo 4-0070 > /sys/bus/i2c/drivers/ir35221/$1 +echo 4-0071 > /sys/bus/i2c/drivers/ir35221/$1 +echo 5-0070 > /sys/bus/i2c/drivers/ir35221/$1 +echo 5-0071 > /sys/bus/i2c/drivers/ir35221/$1 |