diff options
author | CHLin <CHLIN56@nuvoton.com> | 2020-06-29 14:10:16 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-08 05:58:45 +0000 |
commit | 53cc74484c4b352dbdfb03ded96e285634d17dd4 (patch) | |
tree | deb66419fd2997bfa6a4c2df5ed733cdf643f353 /chip/npcx | |
parent | a7804062194394417181adfe76b767ca5b94115d (diff) | |
download | chrome-ec-53cc74484c4b352dbdfb03ded96e285634d17dd4.tar.gz |
npcx: monitor: set DEVALT0.bit7 for the internal flash
The npcx monitor LFW (little firmware) can be used in two scenarios:
1. For npcx5 which supports the external flash and doesn't support UUT,
it is used by the openocd via servo JTAG to flash the EC image.
2. For npcx7 (and newer chips) which support the internal flash and UUT,
it is used by the UUT via UART to flash the EC image.
For case 1, the DEVALT0.bit7 (NO_F_SPI) should be cleared in order to
program the external flash. In case 2, this bit should be set because
the internal flash is used. Otherwise, the GPIOA0 (F_CS0) will also
toggles while programming the internal flash.
Before this CL, the monitor unconditionally clears this bit when
programming the flash.
In this CL, the monitor decides to set/clear this bit according to
the value of the tag filed in the monitor header.
(Assuming that when UUT is used, the target is always the internal
flash.)
BUG=none
BRANCH=none
TEST=No error for "make buildall"
TEST=Programming the internal flash via UUT, make sure the GPIOA0 doesn't
toggle with scope.
Change-Id: I9f1695351b201767cc5ed32877fb395c1e459bc8
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2272419
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: CH Lin <chlin56@nuvoton.com>
Diffstat (limited to 'chip/npcx')
-rw-r--r-- | chip/npcx/spiflashfw/npcx_monitor.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chip/npcx/spiflashfw/npcx_monitor.c b/chip/npcx/spiflashfw/npcx_monitor.c index a0b011476d..cd52e7a80f 100644 --- a/chip/npcx/spiflashfw/npcx_monitor.c +++ b/chip/npcx/spiflashfw/npcx_monitor.c @@ -294,8 +294,15 @@ sspi_flash_upload(int spi_offset, int spi_size) /* UMA Unlock */ CLEAR_BIT(NPCX_UMA_ECTS, NPCX_UMA_ECTS_UMA_LOCK); - /* Set pinmux first */ - sspi_flash_pinmux(1); + /* + * If UUT is used, assuming the target is the internal flash. + * Don't switch the pinmux and make sure bit 7 of DEVALT0 is set. + */ + if (uut_tag == NPCX_MONITOR_UUT_TAG) + SET_BIT(NPCX_DEVALT(0), NPCX_DEVALT0_NO_F_SPI); + else + /* Set pinmux first */ + sspi_flash_pinmux(1); /* Get size of image automatically */ if (sz_image == 0) @@ -313,8 +320,9 @@ sspi_flash_upload(int spi_offset, int spi_size) if (sspi_flash_verify(spi_offset, sz_image, image_base)) *flag_upload |= 0x02; } - /* Disable pinmux */ - sspi_flash_pinmux(0); + if (uut_tag != NPCX_MONITOR_UUT_TAG) + /* Disable pinmux */ + sspi_flash_pinmux(0); /* Mark we have finished upload work */ *flag_upload |= 0x01; |