meta-facebook: harma: fix bios spi path
Bios SPI path has been changed from spi1.0 to spi3.0 due to the addition of gpio_spi.
root@harma:~# ls /sys/bus/spi/devices/ -al
drwxr-xr-x 2 root root 0 Dec 31 1969 .
drwxr-xr-x 4 root root 0 Dec 31 1969 ..
lrwxrwxrwx 1 root root 0 Dec 31 1969 spi1.0 -> ../../../devices/platform/spi-gpio/spi_master/spi1/spi1.0
lrwxrwxrwx 1 root root 0 Dec 31 1969 spi2.0 -> ../../../devices/platform/ahb/1e620000.spi/spi_master/spi2/spi2.0
lrwxrwxrwx 1 root root 0 Dec 31 1969 spi2.1 -> ../../../devices/platform/ahb/1e620000.spi/spi_master/spi2/spi2.1
lrwxrwxrwx 1 root root 0 Dec 31 1969 spi3.0 -> ../../../devices/platform/ahb/1e631000.spi/spi_master/spi3/spi3.0
Change-Id: I1ccb6f3dff555a7f1267d0f583fc733853129814
Signed-off-by: Peter Yin <peter.yin@quantatw.com>
diff --git a/meta-facebook/meta-harma/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh b/meta-facebook/meta-harma/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh
index 0d52876..b21c5d2 100755
--- a/meta-facebook/meta-harma/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh
+++ b/meta-facebook/meta-harma/recipes-phosphor/flash/phosphor-software-manager/bios-update.sh
@@ -7,7 +7,8 @@
IMAGE_FILE=$1
-SPI_DEV="spi1.0"
+# SPI Get Link name
+SPI_DEV=$(find /sys/bus/spi/devices/ -type l -exec sh -c 'readlink "$1" | grep -q "1e631000.spi" && basename "$1"' _ {} \;)
SPI_PATH="/sys/bus/spi/drivers/spi-nor"
set_gpio_to_bmc()
@@ -46,7 +47,7 @@
#Bind spi driver to access flash
echo "bind aspeed-smc spi driver"
-echo -n $SPI_DEV > $SPI_PATH/bind
+echo -n "$SPI_DEV" > "$SPI_PATH"/bind
sleep 1
#Flashcp image to device.
@@ -76,7 +77,7 @@
#Unbind spi driver
sleep 1
echo "Unbind aspeed-smc spi driver"
-echo -n $SPI_DEV > $SPI_PATH/unbind
+echo -n "$SPI_DEV" > "$SPI_PATH"/unbind
sleep 10
#Flip GPIO back for host to access SPI flash