summaryrefslogtreecommitdiff
path: root/chip/npcx/spiflashfw/npcx_monitor.c
diff options
context:
space:
mode:
authorCHLin <CHLIN56@nuvoton.com>2018-06-11 14:13:12 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-15 10:57:33 -0700
commitdb1f369e08cdf839bce6525bc20a5488a5b14ad0 (patch)
treee6b62e0d66217dd6f47c7281b78093565836380b /chip/npcx/spiflashfw/npcx_monitor.c
parentb7ff14aa41db159249acf68731eb64499d6bcfd0 (diff)
downloadchrome-ec-db1f369e08cdf839bce6525bc20a5488a5b14ad0.tar.gz
util: UUT: skip writing empty segment to save the flash time
In order to reduce the time of programming EC image, the UUT in this CL checks each segment before it is written. If the content of the segment is empty (ie. all 0xFF), the UUT will not write the empty data to flash but only erase it. BRANCH=none BUG=none TEST=No build errors for make buildall. TEST= ------------------------------------------------------------------------ 1. Connect the servo connector (J24) on npcx7 EVB to servo board v2 via flex cable. 2. Manually turn the switch SW1.6 to "ON" on npcx7 EVB. 3. Reset ec by issuing Power-Up or VCC1_RST reset. 4. Manually turn the switch SW1.6 to "OFF" on npcx7 EVB. 5. Move npcx7_evb from array BOARDS_NPCX_7M7X_JTAG to BOARDS_NPCX_UUT in flash_ec. 6. "./util/flash_ec --board=npcx7_evb", make sure ec boots up. (Note: "ec_reset" must be removed in line 1051 of flash_ec) 5."time ./util/flash_ec --board=cheza" flash time before this CL: 1m26.489s flash time after this CL : 0m36.760s 6. Dump the flash content via JTAG, make sure it is the same as cheza's ec.bin. Change-Id: Id5ee2bd3a03d13e9b693267b03613c9f2847e0c8 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1095057 Commit-Ready: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/npcx/spiflashfw/npcx_monitor.c')
-rw-r--r--chip/npcx/spiflashfw/npcx_monitor.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/chip/npcx/spiflashfw/npcx_monitor.c b/chip/npcx/spiflashfw/npcx_monitor.c
index 49069c7626..ed2d2bbd5b 100644
--- a/chip/npcx/spiflashfw/npcx_monitor.c
+++ b/chip/npcx/spiflashfw/npcx_monitor.c
@@ -213,12 +213,12 @@ void sspi_flash_physical_erase(int offset, int size)
sspi_flash_tristate(1);
}
-/* Start to write */
int sspi_flash_verify(int offset, int size, const char *data)
{
- int i, result;
- uint8_t *ptr_flash;
- uint8_t *ptr_mram;
+ int i, result;
+ uint8_t *ptr_flash;
+ uint8_t *ptr_mram;
+ uint8_t cmp_data;
ptr_flash = (uint8_t *)(CONFIG_MAPPED_STORAGE_BASE + offset);
ptr_mram = (uint8_t *)data;
@@ -229,7 +229,8 @@ int sspi_flash_verify(int offset, int size, const char *data)
/* Start to verify */
for (i = 0; i < size; i++) {
- if (ptr_flash[i] != ptr_mram[i]) {
+ cmp_data = ptr_mram ? ptr_mram[i] : 0xFF;
+ if (ptr_flash[i] != cmp_data) {
result = 0;
break;
}
@@ -258,7 +259,6 @@ int sspi_flash_get_image_used(const char *fw_base)
}
-
/* Entry function of spi upload function */
uint32_t __attribute__ ((section(".startup_text")))
sspi_flash_upload(int spi_offset, int spi_size)
@@ -305,17 +305,16 @@ sspi_flash_upload(int spi_offset, int spi_size)
if (sspi_flash_physical_clear_stsreg()) {
/* Start to erase */
sspi_flash_physical_erase(spi_offset, sz_image);
-
/* Start to write */
- sspi_flash_physical_write(spi_offset, sz_image, image_base);
-
+ if (image_base != NULL)
+ sspi_flash_physical_write(spi_offset, sz_image,
+ image_base);
/* Verify data */
if (sspi_flash_verify(spi_offset, sz_image, image_base))
*flag_upload |= 0x02;
-
- /* Disable pinmux */
- sspi_flash_pinmux(0);
}
+ /* Disable pinmux */
+ sspi_flash_pinmux(0);
/* Mark we have finished upload work */
*flag_upload |= 0x01;