summaryrefslogtreecommitdiff
path: root/util/iteflash.c
diff options
context:
space:
mode:
authorDonald Huang <donald.huang@ite.com.tw>2018-10-17 17:24:01 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-25 04:26:51 -0700
commit33f6d2d5d32cc24792c463ba730bb79a82a4a529 (patch)
treeefee945775c6cf7550fdb1f621254e1d89f8fa2d /util/iteflash.c
parent1044e1a5b50dbb0edf35aa178b7422715c0c458d (diff)
downloadchrome-ec-33f6d2d5d32cc24792c463ba730bb79a82a4a529.tar.gz
Disable the EC Read/Write Protect register at initial.
BRANCH=no BUG=None TEST=~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb Change-Id: Ie03605f4d10db0760a7e6e3067837b6f9a21417c Signed-off-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/1286316 Commit-Ready: Dino Li <Dino.Li@ite.com.tw> Tested-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'util/iteflash.c')
-rw-r--r--util/iteflash.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/util/iteflash.c b/util/iteflash.c
index aeb868ec95..421a109bf4 100644
--- a/util/iteflash.c
+++ b/util/iteflash.c
@@ -506,6 +506,24 @@ static int dbgr_disable_watchdog(struct common_hnd *chnd)
return 0;
}
+/* disable protect path from DBGR */
+static int dbgr_disable_protect_path(struct common_hnd *chnd)
+{
+ int ret = 0, i;
+
+ ret |= i2c_write_byte(chnd, 0x2f, 0x20);
+ for (i = 0; i < 32; i++) {
+ ret |= i2c_write_byte(chnd, 0x2e, 0xa0+i);
+ ret |= i2c_write_byte(chnd, 0x30, 0);
+ }
+
+ if (ret < 0)
+ printf("DISABLE PROTECT PATH FROM DBGR FAILED!\n");
+
+ return 0;
+}
+
+
/* Enter follow mode and FSCE# high level */
static int spi_flash_follow_mode(struct common_hnd *chnd, char *desc)
{
@@ -800,15 +818,19 @@ static int send_special_waveform(struct common_hnd *chnd)
usleep(10 * MSEC);
if (spi_flash_follow_mode(chnd, "enter follow mode") >= 0) {
+
spi_flash_follow_mode_exit(chnd, "exit follow mode");
/*
* If we can talk to chip, then we can break the retry
* loop
*/
ret = check_chipid(chnd);
+
/* disable watchdog before programming sequence */
- if (!ret)
+ if (!ret) {
dbgr_disable_watchdog(chnd);
+ dbgr_disable_protect_path(chnd);
+ }
} else {
ret = -1;
if (!(iterations % 10))