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>
  • Loading branch information
Eddie James committed Aug 10, 2021
1 parent 2b4c3df commit a0d4673
Show file tree
Hide file tree
Showing 4 changed files with 80 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,13 @@
[Unit]
Description=Perform workarounds for I2C Muxes
Wants=sysinit.target
After=sysinit.target

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

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

# everest system only
if [ $(fw_printenv fitconfig | grep everest) ]; then
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 echo 4-0070 > $drvpath/unbind; fi
i2cset -f -y 0 0x61 7 0x15 b
sleep 0.1
i2cset -f -y 0 0x61 7 0x55 b
sleep 0.1
echo 4-0070 > $drvpath/bind

# buses 5, 6, and 14
if [ -e $drvpath/5-0070 ]; then echo 5-0070 > $drvpath/unbind; fi
if [ -e $drvpath/6-0070 ]; then echo 6-0070 > $drvpath/unbind; fi
if [ -e $drvpath/14-0070 ]; then echo 14-0070 > $drvpath/unbind; fi
if [ -e $drvpath/14-0071 ]; then echo 14-0071 > $drvpath/unbind; fi
i2cset -f -y 0 0x61 8 0x10 b
sleep 0.1
i2cset -f -y 0 0x61 8 0x55 b
sleep 0.1
echo 5-0070 > $drvpath/bind
echo 6-0070 > $drvpath/bind
echo 14-0070 > $drvpath/bind
echo 14-0071 > $drvpath/bind

# bus 15
if [ -e $drvpath/15-0070 ]; then echo 15-0070 > $drvpath/unbind; fi
if [ -e $drvpath/15-0071 ]; then echo 15-0071 > $drvpath/unbind; fi
if [ -e $drvpath/15-0072 ]; then echo 15-0072 > $drvpath/unbind; fi
i2cset -f -y 0 0x61 9 0x54 b
sleep 0.1
i2cset -f -y 0 0x61 9 0x55 b
sleep 0.1
echo 15-0070 > $drvpath/bind
echo 15-0071 > $drvpath/bind
echo 15-0072 > $drvpath/bind

echo gpio-keys-polled > $gpiopath/bind
fi
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RDEPENDS_${PN}-host-state-mgmt_remove_p10bmc = "checkstop-monitor"
RDEPENDS_${PN}-extras_remove_swift = "obmc-ikvm"
RDEPENDS_${PN}-extras_remove_witherspoon-tacoma = "obmc-ikvm liberation-fonts uart-render-controller phosphor-webui"
RDEPENDS_${PN}-logging_append = " ${EXTRA_IBM_LOGGING_PKGS}"
RDEPENDS_${PN}-extras_append_p10bmc = " pldm openpower-hw-diags srvcfg-manager biosconfig-manager phosphor-post-code-manager phosphor-host-postd mctp debug-trigger panel"
RDEPENDS_${PN}-extras_append_p10bmc = " pldm openpower-hw-diags srvcfg-manager biosconfig-manager phosphor-post-code-manager phosphor-host-postd mctp debug-trigger panel mux-workarounds"
RDEPENDS_${PN}-leds_remove_p10bmc = "phosphor-led-manager-faultmonitor"
RDEPENDS_${PN}-leds_remove_witherspoon-tacoma = "phosphor-led-manager-faultmonitor"

Expand Down

0 comments on commit a0d4673

Please sign in to comment.