diff options
author | Xo Wang <xow@google.com> | 2016-12-15 18:29:58 -0800 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-12-22 01:09:09 +0000 |
commit | b13aa51a4300cb6179d9b0acf985f55067ccdc4e (patch) | |
tree | 5eb85b8b4f08315d0d95075551cac370a97bd40f /meta-openbmc-machines | |
parent | 11a822b139c88e3093ddc2e5585e35a3eaf5ae14 (diff) | |
download | talos-openbmc-b13aa51a4300cb6179d9b0acf985f55067ccdc4e.tar.gz talos-openbmc-b13aa51a4300cb6179d9b0acf985f55067ccdc4e.zip |
meta-zaius: Add AVSBus workaround script, services
Add AVSBus control script.
Add systemd services to enable AVSBus after power on and disable AVSBus
at power off.
Add BitBake recipe to install script and services.
Signed-off-by: Xo Wang <xow@google.com>
Change-Id: I3f7a36a6c16d32bb7b648b0f84c9ab3abb922399
Diffstat (limited to 'meta-openbmc-machines')
4 files changed, 131 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb new file mode 100644 index 000000000..0162ede61 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb @@ -0,0 +1,28 @@ +SUMMARY = "Zaius AVSBus control" +DESCRIPTION = "Voltage regulator module (VRM) AVSBus control for Zaius" +PR = "r0" + +inherit obmc-phosphor-systemd +inherit obmc-phosphor-license + +TMPL_OFF = "avsbus-disable@.service" +TMPL_ON = "avsbus-enable@.service" +INSTFMT_OFF = "avsbus-disable@{0}.service" +INSTFMT_ON = "avsbus-enable@{0}.service" +TGTFMT_OFF = "obmc-chassis-stop@{0}.target" +TGTFMT_ON = "obmc-chassis-start@{0}.target" +FMT_OFF = "../${TMPL_OFF}:${TGTFMT_OFF}.wants/${INSTFMT_OFF}" +FMT_ON = "../${TMPL_ON}:${TGTFMT_ON}.wants/${INSTFMT_ON}" + +SYSTEMD_SERVICE_${PN} += "${TMPL_OFF}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_OFF', 'OBMC_CHASSIS_INSTANCES')}" +SYSTEMD_SERVICE_${PN} += "${TMPL_ON}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_ON', 'OBMC_CHASSIS_INSTANCES')}" + +SRC_URI += "file://zaius_avsbus.sh" +RDEPENDS_${PN} += "i2c-tools" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/zaius_avsbus.sh ${D}${bindir}/zaius_avsbus.sh +} diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service new file mode 100644 index 000000000..f9fd42567 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Disable AVSBus on VRMs +Wants=obmc-power-stop-pre@%i.target +Before=obmc-power-stop-pre@%i.target +Conflicts=obmc-chassis-start@%i.target + +[Service] +ExecStart={bindir}/zaius_avsbus.sh disable +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-stop@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service new file mode 100644 index 000000000..58f29d3c5 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Enable AVSBus on VRMs +Wants=obmc-host-start-pre@%i.target +Before=obmc-host-start-pre@%i.target +Conflicts=obmc-chassis-stop@%i.target + +[Service] +ExecStart={bindir}/zaius_avsbus.sh enable +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-chassis-start@%i.target diff --git a/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh new file mode 100755 index 000000000..c946179e0 --- /dev/null +++ b/meta-openbmc-machines/meta-openpower/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh @@ -0,0 +1,77 @@ +#!/bin/sh -e +# AVSBus control for PMBUS voltage regulator modules (VRMs) +# Switches output voltage target between +# - VOUT_COMMAND register (AVSBus disabled, default on Zaius) +# - AVSBus target output (AVSBus enabled, voltage set by host) + +cpu0_i2c_bus="7" +cpu1_i2c_bus="8" +busses="$cpu0_i2c_bus $cpu1_i2c_bus" +vdd_i2c_addr_page="0x60:0x01" +vdn_i2c_addr_page="0x64:0x01" +vcs_i2c_addr_page="0x64:0x00" +addrs_pages="$vdd_i2c_addr_page $vdn_i2c_addr_page $vcs_i2c_addr_page" + +# Usage: vrm_set_page <bus> <i2c_address> <page> +vrm_set_page() +{ + i2cset -y $1 $2 0x00 $3 b +} + +# Usage: vrm_avs_enable <bus> <i2c_address> <page> +# Sets OPERATION PMBUS register to +# - Enable/Disable: On +# - VOUT Source: AVSBus Target Rail Voltage +# - AVSBus Copy: VOUT_COMMAND remains unchanged +vrm_avs_enable() +{ + vrm_set_page "$@" + echo Enabling AVSBus on bus $1 VRM @$2 rail $3... + i2cset -y $1 $2 0x01 0xb0 b +} + +# Usage: vrm_avs_disable <bus> <i2c_address> <page> +# Sets OPERATION PMBUS register to +# - Enable/Disable: On +# - VOUT Source: VOUT_COMMAND +# - AVSBus Copy: VOUT_COMMAND remains unchanged +vrm_avs_disable() +{ + vrm_set_page "$@" + echo Disabling AVSBus on bus $1 VRM @$2 rail $3... + i2cset -y $1 $2 0x01 0x80 b +} + +# Usage: vrm_print <bus> <i2c_address> <page> +vrm_print() +{ + vrm_set_page "$@" + local operation=`i2cget -y $1 $2 0x01 b` + local vout=`i2cget -y $1 $2 0x8b w` + local iout=`i2cget -y $1 $2 0x8c w` + echo VRM on bus $1 @$2 rail $3: OPERATION=$operation VOUT=$vout IOUT=$iout +} + +# Usage: for_each_rail <command> +# <command> will be invoked with <bus> <i2c_address> <page> +for_each_rail() +{ + for bus in $busses + do + for addr_page in $addrs_pages + do + $1 $bus `echo $addr_page | tr : " "` + done + done +} + +if [ "$1" == "enable" ] +then + for_each_rail vrm_avs_enable +elif [ "$1" == "disable" ] +then + for_each_rail vrm_avs_disable +else + for_each_rail vrm_print + echo "\"$0 <enable|disable>\" to control whether VRMs use AVSBus" +fi |