Swift: Put in avsbus-enable

As on Witherspoon, some VRMs on Swift need their AVS buses enabled
as part of the power on sequence.  The AVS bus connects those VRMs
to the processors so the processors can set voltages.

On Witherspoon, the sequence was
1. Disable the AVS bus
2. Manually set VRM voltages
3. Enable AVS bus

Currently on Swift there is no need to manually set voltages, so
the AVS bus disable service and script isn't required.

Tested:  Tested on swift, and ensured both witherspoon and
         witherspoon-128 still have all avs scripts and
         services installed.

(From meta-ibm rev: f1ceece0b75a4522ef3089319b12d22fd83ed9ef)

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ifd7ebdd5ec3dcdfef97c04e666d83fcb4991b452
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control.bb b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control.bb
index d2804df..74e0968 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control.bb
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control.bb
@@ -10,15 +10,18 @@
 
 S = "${WORKDIR}"
 
-SRC_URI += "file://avsbus-disable.sh \
-            file://avsbus-enable.sh"
+SRC_URI += "file://avsbus-enable.sh"
+SRC_URI_append_witherspoon = " file://avsbus-disable.sh"
 
 do_install() {
         install -d ${D}${bindir}
-        install -m 0755 ${S}/avsbus-disable.sh ${D}${bindir}/avsbus-disable.sh
         install -m 0755 ${S}/avsbus-enable.sh ${D}${bindir}/avsbus-enable.sh
 }
 
+do_install_append_witherspoon() {
+        install -m 0755 ${S}/avsbus-disable.sh ${D}${bindir}/avsbus-disable.sh
+}
+
 TMPL_EN= "avsbus-enable@.service"
 TMPL_DIS= "avsbus-disable@.service"
 INSTFMT_EN= "avsbus-enable@{0}.service"
@@ -29,5 +32,5 @@
 
 SYSTEMD_SERVICE_${PN} += "${TMPL_EN}"
 SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_EN', 'OBMC_CHASSIS_INSTANCES')}"
-SYSTEMD_SERVICE_${PN} += "${TMPL_DIS}"
-SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_DIS', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_SERVICE_${PN}_append_witherspoon = " ${TMPL_DIS}"
+SYSTEMD_LINK_${PN}_append_witherspoon = " ${@compose_list(d, 'FMT_DIS', 'OBMC_CHASSIS_INSTANCES')}"
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable.sh b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable.sh
deleted file mode 100644
index 61d8516..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-# For each AVSBus attached rail go back to using VOUT_COMMAND (PMBus voltage)
-# instead of AVSBus and do *not* update VOUT_COMMAND with last voltage sent via
-# AVSBus. This should be run after power-down. This is platform specific
-# settings  that must be updated/removed if not Swift.
-
-i2cset -y 9 0x70 0x00 0x00 b    # VDD 0  - PAGE set
-i2cset -y 9 0x70 0x01 0x80 b    # VDD 0
-i2cset -y 9 0x71 0x00 0x01 b    # VCS 0  - PAGE set
-i2cset -y 9 0x71 0x01 0x80 b    # VCS 0
-i2cset -y 9 0x71 0x00 0x00 b    # VDN 0  - PAGE set
-i2cset -y 9 0x71 0x01 0x80 b    # VDN 0
-i2cset -y 10 0x70 0x00 0x00 b    # VDD 1  - PAGE set
-i2cset -y 10 0x70 0x01 0x80 b    # VDD 1
-i2cset -y 10 0x71 0x00 0x01 b    # VCS 1  - PAGE set
-i2cset -y 10 0x71 0x01 0x80 b    # VCS 1
-i2cset -y 10 0x71 0x00 0x00 b    # VDN 1  - PAGE set
-i2cset -y 10 0x71 0x01 0x80 b    # VDN 1
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable@.service b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable@.service
deleted file mode 100644
index fbab180..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-disable@.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Disable the AVS bus on the VRMs
-Before=vrm-control@%i.service
-Conflicts=obmc-chassis-poweroff@%i.target
-ConditionPathExists=!/run/openbmc/chassis@%i-on
-
-[Service]
-ExecStart=/usr/bin/env avsbus-disable.sh
-SyslogIdentifier=avsbus-disable.sh
-Type=oneshot
-RemainAfterExit=yes
-
-[Install]
-WantedBy=obmc-chassis-poweron@%i.target
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable.sh b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable.sh
index d384091..7ff607a 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable.sh
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable.sh
@@ -6,20 +6,15 @@
 # updated/removed if not Swift.
 
 i2cset -y 9 0x70 0x00 0x00 b    # VDD 0  - PAGE set
-i2cset -y 9 0x70 0x21 0xE6 0x00 i    # VDD 0  - Set default HW boot voltage to 0.9V
 i2cset -y 9 0x70 0x01 0xB0 b    # VDD 0
 i2cset -y 9 0x71 0x00 0x01 b    # VCS 0  - PAGE set
-i2cset -y 9 0x71 0x21 0x00 0x01 i    # VCS 0  - Set default HW boot voltage to 1.0V
 i2cset -y 9 0x71 0x01 0xB0 b    # VCS 0
 i2cset -y 9 0x71 0x00 0x00 b    # VDN 0  - PAGE set
-i2cset -y 9 0x71 0x21 0xCD 0x00 i    # VDN 0  - Set default HW boot voltage to 0.8V
 i2cset -y 9 0x71 0x01 0xB0 b    # VDN 0
+
 i2cset -y 10 0x70 0x00 0x00 b    # VDD 1  - PAGE set
-i2cset -y 10 0x70 0x21 0xE6 0x00 i    # VDD 1  - Set default HW boot voltage to 0.9V
 i2cset -y 10 0x70 0x01 0xB0 b    # VDD 1
 i2cset -y 10 0x71 0x00 0x01 b    # VCS 1  - PAGE set
-i2cset -y 10 0x71 0x21 0x00 0x01 i    # VCS 1  - Set default HW boot voltage to 1.0V
 i2cset -y 10 0x71 0x01 0xB0 b    # VCS 1
 i2cset -y 10 0x71 0x00 0x00 b    # VDN 1  - PAGE set
-i2cset -y 10 0x71 0x21 0xCD 0x00 i   # VDN 1  - Set default HW boot voltage to 0.8V
 i2cset -y 10 0x71 0x01 0xB0 b    # VDN 1
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable@.service b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable@.service
new file mode 100644
index 0000000..45776aa
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/swift/avsbus-enable@.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Enable the AVS bus on VRMs
+Wants=op-power-start@%i.service
+Before=op-power-start@%i.service
+Conflicts=obmc-chassis-poweroff@%i.target
+ConditionPathExists=!/run/openbmc/chassis@%i-on
+
+[Service]
+ExecStart={bindir}/avsbus-enable.sh
+SyslogIdentifier=avsbus-enable.sh
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=obmc-chassis-poweron@%i.target
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service b/meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/witherspoon/avsbus-enable@.service
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/avsbus-enable@.service
rename to meta-ibm/meta-witherspoon/recipes-phosphor/chassis/avsbus-control/witherspoon/avsbus-enable@.service
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/host/p9-host-start.bbappend b/meta-ibm/meta-witherspoon/recipes-phosphor/host/p9-host-start.bbappend
index 3ae8bcb..4b978c9 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/host/p9-host-start.bbappend
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/host/p9-host-start.bbappend
@@ -1,4 +1,4 @@
-RDEPENDS_${PN}_append_witherspoon = " avsbus-control"
+RDEPENDS_${PN}_append_ibm-ac-server = " avsbus-control"
 RDEPENDS_${PN}_append_witherspoon = " vrm-control"
 RDEPENDS_${PN}_append_ibm-ac-server = " power-workarounds"
 RDEPENDS_${PN}_remove_ibm-ac-server = "p9-vcs-workaround"