summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2017-06-29 15:09:35 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-07-13 04:48:39 -0700
commit1b9a553ece24a8f3b05e3a53f1ee96c24e41ef5e (patch)
treec33e49821ea53a79cecd1b9dd5871a7af6d96b12
parenta1ab0885d607a07084cdb356b0ce5a4264b33ea8 (diff)
downloadchrome-ec-1b9a553ece24a8f3b05e3a53f1ee96c24e41ef5e.tar.gz
util/flash_ec: Support gang programmer mode for spi flash in npcx ec
This CL adds support for updating FW to the internal spi flash in npcx ec by enabling gang programmer mode. We also added a new array, BOARDS_NPCX_INT_SPI, to indicate which boards will update FW through this mechanism. The preliminary of testing is listed below. Step 1: Connect npcx7 evb and servo v2 with following pins. NPCX796F Servo V2 ----------------------------------------- GP_SEL# --> (Pin 7, J7) FW_UP# VCC1_RST#--> (Pin 4, J7) DUT_COLD_RESET# GP_CS# --> (Pin 1, J11) DUT_SPI1_CS GP_SCLK --> (Pin 2, J11) DUT_SPI1_CLK GP_MISO --> (Pin 5, J11) DUT_SPI1_DO GP_MOSI --> (Pin 6, J11) DUT_SPI1_DI ----------------------------------------- Step 2: Npcx ec is powered up by PPDUT_SPI1_VREF (Pin 8, J11). Step 3: Add external PU on FW_UP#. Step 4: Execute "sudo servod --vendor 0x18d1 --product 0x5002". BRANCH=none BUG=none TEST=Move npcx7_evb from BOARDS_NPCX_7M6X_JTAG to BOARDS_NPCX_INT_SPI. Prepare two different ec images. Use following script "while :; do ./util/flash_ec --board=npcx7_evb --image=../ec1.bin; sleep 1; ./util/flash_ec --board=npcx7_evb --image=../ec2.bin; sleep 1; done" to test gang programmer mode. No errors occur over 2 hours. Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Change-Id: Ie813bf0191c06bb6e30a5e0dccb824f9f79ada53 Reviewed-on: https://chromium-review.googlesource.com/564742 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rwxr-xr-xutil/flash_ec20
1 files changed, 19 insertions, 1 deletions
diff --git a/util/flash_ec b/util/flash_ec
index e9c878f08b..2e99ab8d37 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -122,6 +122,9 @@ BOARDS_NPCX_SPI=(
kahlee
)
+BOARDS_NPCX_INT_SPI=(
+)
+
BOARDS_NRF51=(
hadoken
)
@@ -227,6 +230,8 @@ elif $(in_array "${BOARDS_NPCX_7M6X_JTAG[@]}" "${BOARD}"); then
CHIP="npcx_7m6x_jtag"
elif $(in_array "${BOARDS_NPCX_SPI[@]}" "${BOARD}"); then
CHIP="npcx_spi"
+elif $(in_array "${BOARDS_NPCX_INT_SPI[@]}" "${BOARD}"); then
+ CHIP="npcx_spi"
elif $(in_array "${BOARDS_NRF51[@]}" "${BOARD}"); then
CHIP="nrf51"
elif $(in_array "${BOARDS_MEC1322[@]}" "${BOARD}"); then
@@ -537,6 +542,14 @@ function flash_flashrom() {
dut_control cold_reset:on
+ # If spi flash is in npcx's ec, enable gang programer mode
+ if $(in_array "${BOARDS_NPCX_INT_SPI[@]}" "${BOARD}"); then
+ # Set GP_SEL# as low then start ec
+ dut_control fw_up:on
+ sleep 0.1
+ dut_control cold_reset:off
+ fi
+
# Turn on SPI1 interface on servo for SPI Flash Chip
dut_control spi1_vref:${SPI_VOLTAGE} spi1_buf_en:on \
spi1_buf_on_flex_en:on
@@ -558,7 +571,7 @@ function flash_flashrom() {
# Temp image
T=/tmp/flash_spi_$$
-if $(in_array "${BOARDS_NPCX_SPI[@]}" "${BOARD}"); then
+if [ "${CHIP}" = "npcx_spi" ] ; then
{ # Patch temp image up to SPI_SIZE
cat $IMG
if [[ ${IMG_SIZE} -lt ${SPI_SIZE} ]] ; then
@@ -584,6 +597,11 @@ fi
# Turn off SPI1 interface on servo
dut_control spi1_vref:off spi1_buf_en:off \
spi1_buf_on_flex_en:off
+
+ # Set GP_SEL# as default to disable GP mode when ec reboots
+ if $(in_array "${BOARDS_NPCX_INT_SPI[@]}" "${BOARD}"); then
+ dut_control fw_up:off
+ fi
else
rm $L
fi