Service to scan hub chip on second processor
New openfsi driver code requires user space to explicitly
scan the second processors fsi hub to ensure no conflict
between it and the host.
User space code will use this service to do this scan
at the appropriate time.
Change-Id: I6806ec637e3b00cbba63b7dfd49a14e19cc8f713
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/common/recipes-phosphor/fsi/op-fsi.bb b/common/recipes-phosphor/fsi/op-fsi.bb
index 26cab2c..0638c3d 100644
--- a/common/recipes-phosphor/fsi/op-fsi.bb
+++ b/common/recipes-phosphor/fsi/op-fsi.bb
@@ -15,7 +15,12 @@
INSTFMT_BIND = "fsi-bind@{0}.service"
FMT_BIND = "../${TMPL_BIND}:${TGTFMT}.requires/${INSTFMT_BIND}"
-SYSTEMD_SERVICE_${PN} += "${TMPL_SCAN} ${TMPL_BIND} fsi-enable.service fsi-disable.service"
+TMPL_HUB = "fsi-hub-scan@.service"
+INSTFMT_HUB = "fsi-hub-scan@{0}.service"
+FMT_HUB = "../${TMPL_HUB}:${TGTFMT}.requires/${INSTFMT_HUB}"
+
+SYSTEMD_SERVICE_${PN} += "${TMPL_SCAN} ${TMPL_BIND} fsi-enable.service fsi-disable.service ${TMPL_HUB}"
SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_SCAN', 'OBMC_CHASSIS_INSTANCES')}"
SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_BIND', 'OBMC_CHASSIS_INSTANCES')}"
+SYSTEMD_LINK_${PN} += "${@compose_list(d, 'FMT_HUB', 'OBMC_CHASSIS_INSTANCES')}"
diff --git a/common/recipes-phosphor/fsi/op-fsi/fsi-enable.service b/common/recipes-phosphor/fsi/op-fsi/fsi-enable.service
index 2cf65a3..4e95b25 100644
--- a/common/recipes-phosphor/fsi/op-fsi/fsi-enable.service
+++ b/common/recipes-phosphor/fsi/op-fsi/fsi-enable.service
@@ -1,6 +1,8 @@
[Unit]
Description=Enable FSI
Conflicts=fsi-disable.service
+Wants=fsi-hub-scan@0.service
+Before=fsi-hub-scan@0.service
[Service]
ExecStart=/bin/sh -c "echo 0 > /sys/devices/platform/gpio-fsi/external_mode"
diff --git a/common/recipes-phosphor/fsi/op-fsi/fsi-hub-scan@.service b/common/recipes-phosphor/fsi/op-fsi/fsi-hub-scan@.service
new file mode 100644
index 0000000..edb79d7
--- /dev/null
+++ b/common/recipes-phosphor/fsi/op-fsi/fsi-hub-scan@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Scan FSI hub device
+Wants=fsi-scan@%i.service
+After=fsi-scan@%i.service
+Conflicts=obmc-chassis-poweroff@%i.target
+
+[Service]
+ExecStart=/bin/sh -c "echo 1 > /sys/devices/platform/gpio-fsi/fsi0/slave@00:00/00:00:00:0a/fsi1/rescan"
+Type=oneshot
+RemainAfterExit=yes
diff --git a/common/recipes-phosphor/host/op-host-control/cfam_override@.service b/common/recipes-phosphor/host/op-host-control/cfam_override@.service
index b1343a3..4433fd0 100644
--- a/common/recipes-phosphor/host/op-host-control/cfam_override@.service
+++ b/common/recipes-phosphor/host/op-host-control/cfam_override@.service
@@ -4,8 +4,8 @@
Before=obmc-host-start-pre@%i.target
Wants=obmc-power-on@%i.target
After=obmc-power-on@%i.target
-Wants=fsi-scan@%i.service
-After=fsi-scan@%i.service
+Wants=fsi-hub-scan@%i.service
+After=fsi-hub-scan@%i.service
Conflicts=obmc-chassis-poweroff@%i.target
ConditionPathExists=!/run/openbmc/chassis@%i-on
ConditionPathExists=/var/lib/obmc/cfam_overrides
diff --git a/common/recipes-phosphor/host/op-host-control/vcs_workaround@.service b/common/recipes-phosphor/host/op-host-control/vcs_workaround@.service
index 0819d97..acad945 100644
--- a/common/recipes-phosphor/host/op-host-control/vcs_workaround@.service
+++ b/common/recipes-phosphor/host/op-host-control/vcs_workaround@.service
@@ -4,8 +4,8 @@
Before=obmc-host-start-pre@%i.target
Wants=obmc-power-on@%i.target
After=obmc-power-on@%i.target
-Wants=fsi-scan@%i.service
-After=fsi-scan@%i.service
+Wants=fsi-hub-scan@%i.service
+After=fsi-hub-scan@%i.service
Conflicts=obmc-chassis-poweroff@%i.target
ConditionPathExists=!/run/openbmc/chassis@%i-on