Skip to content

Commit

Permalink
ibm: p10bmc: Add I2C mux workarounds
Browse files Browse the repository at this point in the history
On Everest systems, some BMC cards need various I2C muxes reset
before they will work. Add a script to reset the muxes and probe
the necessary drivers afterwards.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Change-Id: I39de4bbe9dd698a6d3e364e3a186a05551f21caa
  • Loading branch information
Eddie James committed Sep 13, 2021
1 parent 4fddc62 commit 289c150
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
20 changes: 20 additions & 0 deletions meta-ibm/recipes-phosphor/chassis/mux-workarounds.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SUMMARY = "I2C Mux Device Workarounds"
PR = "r1"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

inherit allarch
inherit obmc-phosphor-systemd

RDEPENDS_${PN} += "i2c-tools"

S = "${WORKDIR}"

SRC_URI += "file://mux-workarounds.sh"

do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}/mux-workarounds.sh ${D}${bindir}/mux-workarounds.sh
}

SYSTEMD_SERVICE_${PN} := "mux-workarounds.service"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Perform workarounds for I2C Muxes
Wants=sysinit.target
After=sysinit.target

[Service]
ExecStart=/usr/bin/mux-workarounds.sh
Type=oneshot
RemainAfterExit=yes

[Install]
RequiredBy=basic.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/sh
set -eu

reset_bus_4() {
i2cset -f -y 0 0x61 7 0x15 b
sleep 0.1
i2cset -f -y 0 0x61 7 0x55 b
sleep 0.1
}

reset_buses_5_6_and_14() {
i2cset -f -y 0 0x61 8 0x10 b
sleep 0.1
i2cset -f -y 0 0x61 8 0x55 b
sleep 0.1
}

reset_bus_15() {
i2cset -f -y 0 0x61 9 0x54 b
sleep 0.1
i2cset -f -y 0 0x61 9 0x55 b
sleep 0.1
}

# everest system only
if [ $(fw_printenv fitconfig | grep everest) ]; then
mux4=
mux5=
mux6=
mux140=
mux141=
mux150=
mux151=
mux152=
echo "Detected everest system; performing I2C mux workarounds"

gpiopath="/sys/bus/platform/drivers/gpio-keys-polled"
drvpath="/sys/bus/i2c/drivers/pca954x"

# remove gpio dependencies
echo gpio-keys-polled > $gpiopath/unbind

# bus 4
if [ -e $drvpath/4-0070 ]; then mux4=1; echo 4-0070 > $drvpath/unbind; fi
reset_bus_4
if [ -n "$mux4" ]; then echo 4-0070 > $drvpath/bind; fi

# buses 5, 6, and 14
if [ -e $drvpath/5-0070 ]; then mux5=1; echo 5-0070 > $drvpath/unbind; fi
if [ -e $drvpath/6-0070 ]; then mux6=1; echo 6-0070 > $drvpath/unbind; fi
if [ -e $drvpath/14-0070 ]; then mux140=1; echo 14-0070 > $drvpath/unbind; fi
if [ -e $drvpath/14-0071 ]; then mux141=1; echo 14-0071 > $drvpath/unbind; fi
reset_buses_5_6_and_14
if [ -n "$mux5" ]; then echo 5-0070 > $drvpath/bind; fi
if [ -n "$mux6" ]; then echo 6-0070 > $drvpath/bind; fi
if [ -n "$mux140" ]; then echo 14-0070 > $drvpath/bind; fi
if [ -n "$mux141" ]; then echo 14-0071 > $drvpath/bind; fi

# bus 15
if [ -e $drvpath/15-0070 ]; then mux150=1; echo 15-0070 > $drvpath/unbind; fi
if [ -e $drvpath/15-0071 ]; then mux151=1; echo 15-0071 > $drvpath/unbind; fi
if [ -e $drvpath/15-0072 ]; then mux152=1; echo 15-0072 > $drvpath/unbind; fi
reset_bus_15
if [ -n "$mux150" ]; then echo 15-0070 > $drvpath/bind; fi
if [ -n "$mux151" ]; then echo 15-0071 > $drvpath/bind; fi
if [ -n "$mux152" ]; then echo 15-0072 > $drvpath/bind; fi

echo gpio-keys-polled > $gpiopath/bind
fi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RDEPENDS:${PN}-fan-control:append:ibm-ac-server = " fan-watchdog"
RDEPENDS:${PN}-fan-control:append:p10bmc = " fan-watchdog sensor-monitor"
RDEPENDS:${PN}-extras:append:ibm-ac-server = " ${POWER_SERVICE_PACKAGES_AC_SERVER} witherspoon-power-supply-sync phosphor-webui mctp pldm"
RDEPENDS:${PN}-extras:append:p10bmc = " ${POWER_SERVICE_PACKAGES_P10} webui-vue dbus-sensors phosphor-virtual-sensor kexec-tools makedumpfile kdump vmcore-dmesg"
RDEPENDS:${PN}-extras:append:p10bmc = " pldm openpower-hw-diags srvcfg-manager biosconfig-manager phosphor-post-code-manager phosphor-host-postd debug-trigger mctp panel"
RDEPENDS:${PN}-extras:append:p10bmc = " pldm openpower-hw-diags srvcfg-manager biosconfig-manager phosphor-post-code-manager phosphor-host-postd debug-trigger mctp panel mux-workarounds"
RDEPENDS:${PN}-extras:append:mihawk = " phosphor-webui phosphor-image-signing wistron-ipmi-oem ${POWER_SERVICE_PACKAGES_AC_SERVER}"
RDEPENDS:${PN}-extras:append:witherspoon-tacoma = " pldm srvcfg-manager webui-vue biosconfig-manager phosphor-post-code-manager phosphor-host-postd kexec-tools makedumpfile kdump vmcore-dmesg debug-trigger"
RDEPENDS:${PN}-extras:append:witherspoon-tacoma = " openpower-hw-diags panel"
Expand Down

0 comments on commit 289c150

Please sign in to comment.