From 194ff4f1f5d44b12e9cb06ddafa6adb20174a13c Mon Sep 17 00:00:00 2001 From: Dave Cobbley Date: Wed, 22 Aug 2018 21:40:54 -0400 Subject: [Subtree] Bring openbmc machines to top level The new subtree model brings the subtrees up from the openbmc-machines layer. Change-Id: I58a03ae1be374bc79ae1438e65e888375d12d0c0 Signed-off-by: Dave Cobbley Signed-off-by: Brad Bishop --- .../recipes-phosphor/chassis/avsbus-control.bb | 28 +++++++ .../chassis/avsbus-control/avsbus-disable@.service | 15 ++++ .../chassis/avsbus-control/avsbus-enable@.service | 16 ++++ .../chassis/avsbus-control/zaius_avsbus.sh | 98 ++++++++++++++++++++++ .../recipes-phosphor/chassis/refclock-fixup.bb | 21 +++++ .../chassis/refclock-fixup/fix_zaius_refclock.sh | 27 ++++++ .../refclock-fixup/op-refclock-fixup@.service | 19 +++++ .../recipes-phosphor/chassis/vcs-control.bb | 31 +++++++ .../chassis/vcs-control/vcs-off@.service | 14 ++++ .../chassis/vcs-control/vcs-on@.service | 16 ++++ .../chassis/vcs-control/zaius_vcs.sh | 72 ++++++++++++++++ 11 files changed, 357 insertions(+) create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service create mode 100755 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup.bb create mode 100755 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/fix_zaius_refclock.sh create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/op-refclock-fixup@.service create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control.bb create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-off@.service create mode 100644 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-on@.service create mode 100755 meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh (limited to 'meta-ingrasys/meta-zaius/recipes-phosphor/chassis') diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control.bb new file mode 100644 index 000000000..29f36a4f2 --- /dev/null +++ b/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-host-stop@{0}.target" +TGTFMT_ON = "obmc-chassis-poweron@{0}.target" +FMT_OFF = "../${TMPL_OFF}:${TGTFMT_OFF}.wants/${INSTFMT_OFF}" +FMT_ON = "../${TMPL_ON}:${TGTFMT_ON}.requires/${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-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service new file mode 100644 index 000000000..9cf322b2d --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-disable@.service @@ -0,0 +1,15 @@ +[Unit] +Description=Disable AVSBus on VRMs +Wants=obmc-power-stop-pre@%i.target +Before=obmc-power-stop-pre@%i.target +Conflicts=obmc-host-startmin@%i.target +ConditionPathExists=!/run/openbmc/chassis@%i-on + +[Service] +ExecStart=/usr/bin/env zaius_avsbus.sh disable +SyslogIdentifier=zaius_avsbus.sh +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-host-stop@%i.target diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service new file mode 100644 index 000000000..24aadf5ad --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Enable AVSBus on VRMs +Wants=obmc-host-start-pre@%i.target +Before=obmc-host-start-pre@%i.target +Conflicts=obmc-host-stop@%i.target +ConditionPathExists=!/run/openbmc/chassis@%i-on + +[Service] +ExecStart=/usr/bin/env zaius_avsbus.sh vdn_max +ExecStart=/usr/bin/env zaius_avsbus.sh enable +SyslogIdentifier=zaius_avsbus.sh +Type=oneshot +RemainAfterExit=yes + +[Install] +RequiredBy=obmc-chassis-poweron@%i.target diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh new file mode 100755 index 000000000..45e60664a --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/avsbus-control/zaius_avsbus.sh @@ -0,0 +1,98 @@ +#!/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" +buses="$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 +vrm_set_page() +{ + i2cset -y $1 $2 0x00 $3 b +} + +# Usage: vrm_avs_enable +# Initializes the AVSBus VOUT setpoint to the value in PMBus VOUT_COMMAND +# Sets OPERATION PMBUS register to +# - Enable/Disable: On +# - VOUT Source: AVSBus Target Rail Voltage +# - AVSBus Copy: VOUT_COMMAND remains unchanged +# Writes to VOUT setpoint over AVSBus will persist after the VRM is switched to +# PMBus control. Switching back to AVSBus control restores this persisted +# setpoint rather than re-initializing to PMBus VOUT_COMMAND. This behavior is +# known to Intersil and writing VOUT_COMMAND over PMBus is the only workaround. +vrm_avs_enable() +{ + vrm_set_page "$@" + echo Enabling AVSBus on bus $1 VRM @$2 rail $3... + local vout_command=`i2cget -y $1 $2 0x21 w` + i2cset -y $1 $2 0x21 $vout_command w + i2cset -y $1 $2 0x01 0xb0 b +} + +# Usage: vrm_avs_disable +# 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_vout_max_1v1 +# Sets VOUT_MAX to 1.1V +vrm_vout_max_1v1() +{ + vrm_set_page "$@" + echo Setting VOUT_MAX=[1.1V] on bus $1 VRM @$2 rail $3... + i2cset -y $1 $2 0x24 0x44c w +} + +# Usage: vrm_print +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 +# will be invoked with +for_each_rail() +{ + for bus in $buses + 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 +elif [ "$1" == "vdn_max" ] +then + addrs_pages="$vdn_i2c_addr_page" + for_each_rail vrm_vout_max_1v1 +else + for_each_rail vrm_print + echo "\"$0 \" to control whether VRMs use AVSBus" + echo "\"$0 \" to set VDN rails VOUT_MAX to 1.1V" +fi diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup.bb b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup.bb new file mode 100644 index 000000000..bd33c6382 --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup.bb @@ -0,0 +1,21 @@ +DESCRIPTION = "Zaius host reference clock fixup" +PR = "r0" + +inherit obmc-phosphor-systemd +inherit obmc-phosphor-license + +TMPL = "op-refclock-fixup@.service" +INSTFMT = "op-refclock-fixup@{0}.service" +TGTFMT = "obmc-chassis-poweron@{0}.target" +FMT = "../${TMPL}:${TGTFMT}.requires/${INSTFMT}" + +SYSTEMD_SERVICE_${PN} += "${TMPL}" +SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT', 'OBMC_CHASSIS_INSTANCES')}" + +SRC_URI += "file://fix_zaius_refclock.sh" +RDEPENDS_${PN} += "i2c-tools" + +do_install() { + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/fix_zaius_refclock.sh ${D}${sbindir}/fix_zaius_refclock.sh +} diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/fix_zaius_refclock.sh b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/fix_zaius_refclock.sh new file mode 100755 index 000000000..01eb72b71 --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/fix_zaius_refclock.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# fix up refclock by reconfiguring output of Si5338C clock generator + +i2cset="i2cset" +clkgen_i2c_bus="0" +clkgen_i2c_addr="0x70" + +# Usage: clkgen_write
[write length] +clkgen_write() +{ + $i2cset -y $clkgen_i2c_bus $clkgen_i2c_addr $1 $2 $3 +} + +# disable outputs +clkgen_write 230 0x10 b + +# set output configurations of each of the four channels to 3.3V HCSL +clkgen_write 36 0x07 b +clkgen_write 37 0x07 b +clkgen_write 38 0x07 b +clkgen_write 39 0x07 b +clkgen_write 40 0xe7 b +clkgen_write 41 0x9c b +clkgen_write 42 0x27 b + +# enable outputs +clkgen_write 230 0x00 b diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/op-refclock-fixup@.service b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/op-refclock-fixup@.service new file mode 100644 index 000000000..9444b367f --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/refclock-fixup/op-refclock-fixup@.service @@ -0,0 +1,19 @@ +[Unit] +Description=Fix up Zaius host refclock +Wants=obmc-host-start-pre@%i.target +Before=obmc-host-start-pre@%i.target +Wants=obmc-power-on@%i.target +After=obmc-power-on@%i.target +Before=fsi-scan@%i.service +Conflicts=obmc-host-stop@%i.target +ConditionPathExists=!/run/openbmc/chassis@%i-on + +[Service] +Restart=no +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/env fix_zaius_refclock.sh +SyslogIdentifier=fix_zaius_refclock.sh + +[Install] +RequiredBy=obmc-chassis-poweron@%i.target diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control.bb b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control.bb new file mode 100644 index 000000000..98fb89b5c --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control.bb @@ -0,0 +1,31 @@ +SUMMARY = "Zaius VCS rail control" +DESCRIPTION = "VCS voltage rail control implementation for Zaius" +PR = "r0" + +inherit obmc-phosphor-systemd +inherit obmc-phosphor-license + +PROVIDES += 'virtual/p9-vcs-workaround' +RPROVIDES_${PN} += 'virtual-p9-vcs-workaround' + +TMPL_OFF = "vcs-off@.service" +TMPL_ON = "vcs-on@.service" +INSTFMT_OFF = "vcs-off@{0}.service" +INSTFMT_ON = "vcs-on@{0}.service" +TGTFMT_OFF = "obmc-host-stop@{0}.target" +TGTFMT_ON = "obmc-chassis-poweron@{0}.target" +FMT_OFF = "../${TMPL_OFF}:${TGTFMT_OFF}.wants/${INSTFMT_OFF}" +FMT_ON = "../${TMPL_ON}:${TGTFMT_ON}.requires/${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_vcs.sh" +RDEPENDS_${PN} += "i2c-tools" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/zaius_vcs.sh ${D}${bindir}/zaius_vcs.sh +} diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-off@.service b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-off@.service new file mode 100644 index 000000000..d230781b4 --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-off@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Turn VCS rails off +Wants=obmc-power-stop-pre@%i.target +Before=obmc-power-stop-pre@%i.target +Conflicts=obmc-host-startmin@%i.target + +[Service] +ExecStart=/usr/bin/env zaius_vcs.sh off +SyslogIdentifier=zaius_vcs.sh +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=obmc-host-stop@%i.target diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-on@.service b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-on@.service new file mode 100644 index 000000000..17c7cf640 --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/vcs-on@.service @@ -0,0 +1,16 @@ +[Unit] +Description=Turn VCS rails on +Wants=vcs_workaround@%i.service +After=vcs_workaround@%i.service +Wants=obmc-host-start-pre@%i.target +Before=obmc-host-start-pre@%i.target +Conflicts=obmc-host-stop@%i.target + +[Service] +ExecStart=/usr/bin/env zaius_vcs.sh on +SyslogIdentifier=zaius_vcs.sh +Type=oneshot +RemainAfterExit=yes + +[Install] +RequiredBy=obmc-chassis-poweron@%i.target diff --git a/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh new file mode 100755 index 000000000..49bf0b04f --- /dev/null +++ b/meta-ingrasys/meta-zaius/recipes-phosphor/chassis/vcs-control/zaius_vcs.sh @@ -0,0 +1,72 @@ +#!/bin/sh -e +# Read and control VCS rails by sending the UCD power sequencer I2C commands. +# This script assumes that the UCD is controlling VCS rails as GPIOs 5 and 6. +# Also assumes that those GPIOs are already enabled. + +ucd_bus="0" +ucd_addr="0x64" +ucd_path="/sys/bus/i2c/drivers/ucd9000" +ucd_driver="${ucd_bus}-00${ucd_addr#0x}" +ucd_retries="5" + +retry() +{ + local i=0 + until [ $i -ge $ucd_retries ]; do + i=$((i+1)) + retry_output=`$@` && break + done + local ret=$? + if [ $i -eq $ucd_retries ]; then exit $ret; fi +} + +# Usage: ucd_get address +# Result stored in $ucd_reg +ucd_get() +{ + retry i2cget -f -y $ucd_bus $ucd_addr $1 b + ucd_reg=$retry_output +} + +# Usage: ucd_get address value +ucd_set() +{ + retry i2cset -f -y $ucd_bus $ucd_addr $1 $2 b +} + +vcs_set_gpios() +{ + echo -e "\tSetting UCD GPIO 5 to $1" + ucd_set 0xFA 5 + ucd_set 0xFB $1 + ucd_set 0xFB $1 + echo -e "\tSetting UCD GPIO 6 to $1" + ucd_set 0xFA 6 + ucd_set 0xFB $1 + ucd_set 0xFB $1 +} + +vcs_get() +{ + echo Reading VCS settings + ucd_set 0xFA 5 + ucd_get 0xFB + local val=`echo $ucd_reg | grep -i -c 0x0f` + echo -e "\tUCD GPIO 5 state=$val" + ucd_set 0xFA 6 + ucd_get 0xFB + local val=`echo $ucd_reg | grep -i -c 0x0f` + echo -e "\tUCD GPIO 6 state=$val" +} + + +if [ "$1" == "on" ]; then + echo Turning on VCS + vcs_set_gpios 0x7 +elif [ "$1" == "off" ]; then + echo Turning off VCS + vcs_set_gpios 0x3 +else + vcs_get + echo "$0 " to set state +fi -- cgit v1.2.1