Skip to content

Ocp tiogapass/mdr164 debugging #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: ocp-tiogapass/main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RDEPENDS:${PN}-flash = " \
SUMMARY:${PN}-system = "OCP System"
RDEPENDS:${PN}-system = " \
dbus-sensors \
fb-powerctrl \
flashrom \
ipmitool \
phosphor-host-postd \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,50 @@
// SPDX-License-Identifier: GPL-2.0+
// Copyright (c) 2018 Facebook Inc.
// Author: Vijay Khemka <[email protected]>
/dts-v1/;

#include "aspeed-g5.dtsi"
#include <dt-bindings/gpio/aspeed-gpio.h>
#include <dt-bindings/i2c/i2c.h>

/ {
model = "Facebook TiogaPass BMC";
compatible = "facebook,tiogapass-bmc", "aspeed,ast2500";
model = "OCP TiogaPass BMC";
compatible = "ocp,tiogapass-bmc", "aspeed,ast2500";

aliases {
serial0 = &uart1;
serial4 = &uart5;
};

chosen {
stdout-path = &uart5;
bootargs = "console=ttyS4,115200 earlycon";
bootargs = "console=ttyS4,57600 earlycon";
};

memory@80000000 {
reg = <0x80000000 0x20000000>;
};

vga_memory: framebuffer@9f000000 {
no-map;
reg = <0x9f000000 0x04000000>; /* 64M */
};

gfx_memory: framebuffer {
size = <0x04000000>; /* 64M */
alignment = <0x01000000>;
compatible = "shared-dma-pool";
reusable;
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

vga_memory: framebuffer@9f000000 {
no-map;
reg = <0x9f000000 0x02000000>; /* 32M */
};

gfx_memory: framebuffer {
size = <0x02000000>; /* 32M */
alignment = <0x01000000>;
compatible = "shared-dma-pool";
reusable;
};
};

iio-hwmon {
compatible = "iio-hwmon";
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>,
<&adc 4>, <&adc 5>, <&adc 6>, <&adc 7>;
<&adc 4>, <&adc 5>, <&adc 6>, <&adc 7>;
};

};
Expand Down Expand Up @@ -85,6 +91,7 @@
&pinctrl_rxd1_default>;
};

/*
&uart2 {
// SoL Host Console
status = "okay";
Expand All @@ -94,6 +101,7 @@
// SoL BMC Console
status = "okay";
};
*/

&uart5 {
// BMC Console
Expand Down Expand Up @@ -187,10 +195,15 @@
status = "okay";
multi-master;
//TODO at 0x08 - Lewisburg PCH?
ipmb0@8 {
compatible = "ipmb-dev";
reg = <(0x08 | I2C_OWN_SLAVE_ADDRESS)>;
i2c-protocol;
};
//TODO at 0x44 - CKMNG?
//TODO: Where's AT24?
//TODO at 0x68 ICS9FGP204
//TODO at 0x6c NB3W1200L (only when host is powered on) - A: Are you sure? Doesn't show up for me...
//TODO at 0x6c NB3W1200L (only when host is powered on) - A: Are you sure? Doesn't show up for me...

/*
TODO at 0x51 - looks like TMP421, even though it doesn't make sense (according to schematic)
Expand All @@ -217,9 +230,10 @@
&i2c5 {
status = "okay";
multi-master;

// Needs more configuration.
// See: Documentation/hwmon/pxe1610.rst
/*
regulator@48 {
compatible = "infineon,pxe1610";
reg = <0x48>;
Expand Down Expand Up @@ -256,17 +270,19 @@
compatible = "infineon,pxe1610";
reg = <0x72>;
};
*/
};

&i2c6 {
status = "okay";
multi-master;
//multi-master;

// TODO: What's on 0x21?
// TODO: What's on 0x21?
// TODO: What's on 0x50?
// One of them should be PCA9554... likely 0x21?

// Not detected/nothing in dmesg
/*
temperature-sensor@4f {
compatible = "ti,tmp421";
reg = <0x4f>;
Expand All @@ -286,31 +302,32 @@
reg = <0x54>;
pagesize = <32>;
};

*/
};

&i2c7 {
status = "okay";
multi-master;
/*
power-sensor@45 {
compatible = "adi,adm1278";
reg = <0x45>;
shunt-resistor-micro-ohms = <250>;
};

*/
};

&i2c8 {
status = "okay";
multi-master;
// TODO: There's something on 0x61 on Meta's OpenBMC build. Possibly "MCP Sideband HFI"?

/*
// No TMP421 on this bus according to schematic but it appears on host power-on...
sensor@1f {
compatible = "ti,tmp421";
reg = <0x1f>;
};
*/
};

&i2c9 {
Expand Down Expand Up @@ -579,4 +596,11 @@
"LPC_LFRAME_N_CS0_R_N",
"IRQ_LPC_SERIRQ_R",
"RST_BMC_LVC3_N";

bmc_ready_hog {
gpio-hog;
gpios = <ASPEED_GPIO(S, 1) GPIO_ACTIVE_LOW>;
output-high;
line-name = "BMC_READY";
};
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
lpc-address = 0x2f8
lpc-address = 0x3f8
sirq = 4
upstream-tty = ttyVUART0
baud = 57600
local-tty = ttyS0
local-tty-baud = 57600
console-id = host
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ FILESEXTRAPATHS:append := ":${THISDIR}/${PN}"

OBMC_CONSOLE_HOST_TTY = "ttyVUART0"

SRC_URI:remove = "file://${BPN}.conf"

SRC_URI:append = " \
file://server.ttyVUART0.conf \
"

do_install:append() {
# Remove upstream-provided configuration
rm -rf ${D}${sysconfdir}/${BPN}

# Install the server configuration
install -m 0755 -d ${D}${sysconfdir}/${BPN}
install -m 0644 ${UNPACKDIR}/*.conf ${D}${sysconfdir}/${BPN}/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e

POWER_CMD="/usr/sbin/power-util mb"
IMAGE_FILE=$1/bios.bin
GPIO=389

IPMB_OBJ="xyz.openbmc_project.Ipmi.Channel.Ipmb"
IPMB_PATH="/xyz/openbmc_project/Ipmi/Channel/Ipmb"
Expand All @@ -18,44 +17,16 @@ SPI_PATH="/sys/bus/platform/drivers/spi-aspeed-smc"
set_gpio_to_bmc()
{
echo "switch bios GPIO to bmc"
if [ ! -d /sys/class/gpio/gpio$GPIO ]; then
cd /sys/class/gpio
echo $GPIO > "export"
cd gpio$GPIO
else
cd /sys/class/gpio/gpio$GPIO
fi
direc=$(cat direction)
if [ "$direc" == "in" ]; then
echo "out" > direction
fi
data=$(cat value)
if [ "$data" == "0" ]; then
echo 1 > value
fi
# Use gpiofind to get the chip and line offsets, then set to 1
gpioset $(gpiofind BIOS_SPI_BMC_CTRL)=1
return 0
}

set_gpio_to_pch()
{
echo "switch bios GPIO to pch"
if [ ! -d /sys/class/gpio/gpio$GPIO ]; then
cd /sys/class/gpio
echo $GPIO > "export"
cd gpio$GPIO
else
cd /sys/class/gpio/gpio$GPIO
fi
direc=$(cat direction)
if [ "$direc" == "in" ]; then
echo "out" > direction
fi
data=$(cat value)
if [ "$data" == "1" ]; then
echo 0 > value
fi
echo "in" > direction
echo $GPIO > /sys/class/gpio/unexport
# Use gpiofind to get the chip and line offsets, then set to 0
gpioset $(gpiofind BIOS_SPI_BMC_CTRL)=0
return 0
}

Expand All @@ -79,8 +50,14 @@ echo "Set ME to recovery mode"
busctl call "$IPMB_OBJ" "$IPMB_PATH" "$IPMB_INTF" $IPMB_CALL $ME_CMD_RECOVER
sleep 5

if [ -e $SPI_PATH ]; then
# Unbind in case it was bound at startup with BIOS_SPI_BMC_CTRL=0
echo -n $SPI_DEV > $SPI_PATH/unbind
sleep 1
fi

#Flip GPIO to access SPI flash used by host.
echo "Set GPIO $GPIO to access SPI flash from BMC used by host"
echo "Set GPIO to access SPI flash from BMC used by host"
set_gpio_to_bmc

#Bind spi driver to access flash
Expand All @@ -92,21 +69,21 @@ sleep 1
if [ -e "$IMAGE_FILE" ];
then
echo "Bios image is $IMAGE_FILE"
for d in mtd6 mtd7 ; do
if [ -e "/dev/$d" ]; then
mtd=$(cat /sys/class/mtd/$d/name)
for d in 6 7 ; do
if [ -e "/dev/mtd$d" ]; then
mtd=$(cat /sys/class/mtd/mtd$d/name)
if [ "$mtd" == "pnor" ]; then
echo "Flashing bios image to $d..."
if flashcp -v "$IMAGE_FILE" /dev/$d; then
echo "Flashing bios image to mtd$d..."
if flashrom -V -p "linux_mtd:dev=$d" -w "$IMAGE_FILE"; then
echo "bios updated successfully..."
else
echo "bios update failed..."
fi
break
fi
echo "$d is not a pnor device"
echo "mtd$d is not a pnor device"
fi
echo "$d not available"
echo "mtd$d not available"
done
else
echo "Bios image $IMAGE_FILE doesn't exist"
Expand All @@ -119,7 +96,7 @@ echo -n $SPI_DEV > $SPI_PATH/unbind
sleep 10

#Flip GPIO back for host to access SPI flash
echo "Set GPIO $GPIO back for host to access SPI flash"
echo "Set GPIO back for host to access SPI flash"
set_gpio_to_pch
sleep 5

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"channels": [
{
"type": "me",
"slave-path": "/dev/ipmb-3",
"bmc-addr": 32,
"remote-addr": 44
},
{
"type": "ipmb",
"slave-path": "/dev/ipmb-4",
"bmc-addr": 32,
"remote-addr": 64,
"devIndex": 0
},
{
"type": "ipmb",
"slave-path": "/dev/ipmb-9",
"bmc-addr": 32,
"remote-addr": 64,
"devIndex": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"channels": [
{
"type": "me",
"slave-path": "/dev/ipmb-4",
"bmc-addr": 32,
"remote-addr": 44,
"devIndex": 0
},
{
"type": "ipmb",
"slave-path": "/dev/ipmb-9",
"bmc-addr": 32,
"remote-addr": 96,
"devIndex": 1
}
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
IPMB_CHANNELS = "\
/dev/ipmb-4 \
/dev/ipmb-9 \
"
IPMB_REMOTE_ADDR = "\
44 \
96 \
"
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI:append = " file://ipmb-channels.json "

do_install:append() {
install -m 0644 -D ${UNPACKDIR}/ipmb-channels.json ${D}/usr/share/ipmbbridge
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
KCS_DEVICE = "ipmi-kcs2"
SMM_DEVICE = "ipmi-kcs3"
SYSTEMD_SERVICE:${PN}:append = " ${PN}@${SMM_DEVICE}.service "
Loading