From e96820d5379bf9ca80ace325f9a1ec9e51cc3c66 Mon Sep 17 00:00:00 2001 From: "Thang Q. Nguyen" Date: Fri, 17 Dec 2021 02:24:24 +0000 Subject: meta-ampere: mtjade: Add more Host firmware support Add support SCP firmware update with checking if the ampere_fru_upgrade available to execute the update. This commit also supports 2nd Host SPI-NOR update ability. Tested: 1. Manually copy ampere_fru_upgrade to the /usr/sbin folder and run SCP firmware update via Redfish. 2. Flash UEFI firmware update on the secondary Host SPI-NOR. Signed-off-by: Thang Q. Nguyen Change-Id: Ic335ee2d21625239c3df1937ed5333708233845b --- .../flash/ampere-flash-utils/ampere_flash_bios.sh | 31 +++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh') diff --git a/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh b/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh index b7f4bc52e..b13e4b50a 100755 --- a/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh +++ b/meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh @@ -15,10 +15,8 @@ # limitations under the License. do_flash () { - OFFSET=$1 - # Check the PNOR partition available - HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') + HOST_MTD=$(< /proc/mtd grep "pnor-uefi" | sed -n 's/^\(.*\):.*/\1/p') if [ -z "$HOST_MTD" ]; then # If the PNOR partition is not available, then bind again driver @@ -26,7 +24,7 @@ do_flash () { echo 1e630000.spi > /sys/bus/platform/drivers/aspeed-smc/bind sleep 2 - HOST_MTD=$(< /proc/mtd grep "pnor" | sed -n 's/^\(.*\):.*/\1/p') + HOST_MTD=$(< /proc/mtd grep "pnor-uefi" | sed -n 's/^\(.*\):.*/\1/p') if [ -z "$HOST_MTD" ]; then echo "Fail to probe Host SPI-NOR device" @@ -34,8 +32,8 @@ do_flash () { fi fi - echo "--- Flashing firmware to @/dev/$HOST_MTD offset=$OFFSET" - flashcp -v "$IMAGE" /dev/"$HOST_MTD" "$OFFSET" + echo "--- Flashing firmware to @/dev/$HOST_MTD" + flashcp -v "$IMAGE" /dev/"$HOST_MTD" } @@ -50,6 +48,12 @@ if [ ! -f "$IMAGE" ]; then exit 1 fi +if [ -z "$2" ]; then + DEV_SEL="1" # by default, select primary device +else + DEV_SEL="$2" +fi + # Turn off the Host if it is currently ON chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}') echo "--- Current Chassis State: $chassisstate" @@ -74,8 +78,21 @@ if ! gpioset 0 226=0; then exit 1 fi +# Switch the host SPI bus (between primary and secondary) +# 227 is BMC_SPI0_BACKUP_SEL +if [[ $DEV_SEL == 1 ]]; then + echo "Run update primary Host SPI-NOR" + gpioset 0 227=0 # Primary SPI +elif [[ $DEV_SEL == 2 ]]; then + echo "Run update secondary Host SPI-NOR" + gpioset 0 227=1 # Second SPI +else + echo "Please choose primary SPI (1) or second SPI (2)" + exit 0 +fi + # Flash the firmware -do_flash 0x400000 +do_flash # Switch the host SPI bus to HOST." echo "--- Switch the host SPI bus to HOST." -- cgit v1.2.3