From fcdbe7da7a08201838138e8e08877f91225cdad2 Mon Sep 17 00:00:00 2001 From: Shelley Chen Date: Fri, 13 Nov 2015 15:26:17 -0800 Subject: [PATCH] flash_ec: Accomodate using flashrom on beaglebone Currently, using flash_ec for mec1322 chips only supports flashing from servo v2. Updated to work from v3 as well. BUG=chromium:554230 BRANCH=None TEST=tested locally with beaglebone/cyan setup at my desk Ran flash_ec --board=cyan --chip=mec1322 --image=/tmp/image.bin Change-Id: Ibc1109a60e93d1034519b31ce58c5e4d45ab505c Signed-off-by: Shelley Chen Reviewed-on: https://chromium-review.googlesource.com/312578 --- util/flash_ec | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/util/flash_ec b/util/flash_ec index f97a693bef..59729e9f2c 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -231,6 +231,11 @@ ec_enable_boot0() { eval ${SERVO_TYPE}_${MCU}_boot0 } +on_servov3() { + grep '^CHROMEOS_RELEASE_BOARD=' /etc/lsb-release | \ + sed 's/CHROMEOS_RELEASE_BOARD=//' +} + # Put back the servo and the system in a clean state at exit FROZEN_PIDS="" cleanup() { @@ -374,15 +379,21 @@ function flash_openocd() { function flash_flashrom() { TOOL_PATH="${EC_DIR}/build/${BOARD}/util:/usr/sbin/:$PATH" FLASHROM=$(PATH="${TOOL_PATH}" which flashrom) - FLASHROM_PARAM="-p ft2232_spi:type=servo-v2,port=B" + if [ on_servov3 ]; then + FLASHROM_PARAM="-p linux_spi" + else + FLASHROM_PARAM="-p ft2232_spi:type=servo-v2,port=B" + fi if [ ! -x "$FLASHROM" ]; then die "no flashrom util found." fi - SERIALNAME=$(${DUT_CONTROL_CMD} serialname | cut -d: -f2) - if [[ "$SERIALNAME" != "" ]] ; then - FLASHROM_PARAM="${FLASHROM_PARAM},serial=${SERIALNAME}" + if [ ! on_servov3 ]; then + SERIALNAME=$(${DUT_CONTROL_CMD} serialname | cut -d: -f2) + if [[ "$SERIALNAME" != "" ]] ; then + FLASHROM_PARAM="${FLASHROM_PARAM},serial=${SERIALNAME}" + fi fi dut_control cold_reset:on