-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ibm: p10bmc: Add I2C mux workarounds
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
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
12 changes: 12 additions & 0 deletions
12
meta-ibm/recipes-phosphor/chassis/mux-workarounds/mux-workarounds.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
69 changes: 69 additions & 0 deletions
69
meta-ibm/recipes-phosphor/chassis/mux-workarounds/mux-workarounds.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters