diff options
author | dheerajpdsk <p.dheeraj.srujan.kumar@intel.com> | 2022-05-06 02:48:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 02:48:05 +0300 |
commit | ca8d06bc610af08c2d3efc487aa9519989b743e6 (patch) | |
tree | c557da2136640a8ce48439f19fe5f7071faffeca /meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh | |
parent | 7cf0c1cd0ce835d1833509b7b911e8a97380278b (diff) | |
parent | 18f97faa411078b95d042d207f5fff32bc8ece1d (diff) | |
download | openbmc-ca8d06bc610af08c2d3efc487aa9519989b743e6.tar.xz |
Update
Diffstat (limited to 'meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh')
-rwxr-xr-x | meta-ampere/meta-jade/recipes-ampere/flash/ampere-flash-utils/ampere_flash_bios.sh | 31 |
1 files changed, 24 insertions, 7 deletions
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." |