From b8f52ae4caef899fdd97cea9d2175c260a0c912c Mon Sep 17 00:00:00 2001 From: Potin Lai Date: Mon, 19 Sep 2022 14:20:58 +0800 Subject: meta-bletchley: use mdio-tools instead mdio-util Introduce mdio-tools package to replace mdio-util script. This commit relies on the linux kernel patch below. LINK: https://lore.kernel.org/all/20221025055046.1704920-1-potin.lai.pt@gmail.com/ Tested Result: Check host status by power-ctrl which will call mdio internally. root@bletchley:~# power-ctrl sled6 status On Signed-off-by: Potin Lai Change-Id: I482dde297acb7797896d9b7ae07580104fb21540 --- .../recipes-bletchley/motor-ctrl/files/power-ctrl | 13 +++++++++++-- .../recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl index 7a6a96c8dd..9bae16b845 100755 --- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl +++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl @@ -234,10 +234,19 @@ function get_host_status_dbus() return 0 } +function get_addr_from_dts_aliases() +{ + local node_address + node_address=$(awk -F '@' '{printf $2}' /sys/firmware/devicetree/base/aliases/"$1") + echo "$node_address" +} + function get_host_status_mdio() { local SLED_NUM=$1 - local MDIO_BUS=0 + local MDIO_BUS + + MDIO_BUS="$(get_addr_from_dts_aliases mdio0).mdio-1" declare -a PORT_MAP=(0 3 2 1 7 6 5) @@ -257,7 +266,7 @@ function get_host_status_mdio() while true do - if POST_ST_VAL=$(mdio-util c22 r $MDIO_BUS "${PORT_MAP[SLED_NUM]}" 0); then + if POST_ST_VAL=$(mdio "$MDIO_BUS" phy "${PORT_MAP[SLED_NUM]}" 0); then if [ $((POST_ST_VAL&16#0800)) -eq $((16#0000)) ]; then case $SLED_LAST_ACTION in "$ACTION_DFU") diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb index 1b9f75e893..73932a183e 100644 --- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb +++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/motor-ctrl_0.1.bb @@ -8,7 +8,7 @@ inherit obmc-phosphor-systemd RDEPENDS:${PN} += "bash" RDEPENDS:${PN} += "i2c-tools" RDEPENDS:${PN} += "libgpiod-tools" -RDEPENDS:${PN} += "mdio-util" +RDEPENDS:${PN} += "mdio-tools" RDEPENDS:${PN} += "bletchley-common-functions" S = "${WORKDIR}" -- cgit v1.2.3