summaryrefslogtreecommitdiff
path: root/driver/tcpm/anx7447.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-06-08 10:15:20 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-08 16:14:18 -0700
commit8350369c8695e58f1c7c0ffeddf8c652d3af3adb (patch)
treed8218305c345cf71199f77a856f02d7112a1b21e /driver/tcpm/anx7447.c
parent532e135d039c686dfbdf26e4dadbcd6e9b71d107 (diff)
downloadchrome-ec-8350369c8695e58f1c7c0ffeddf8c652d3af3adb.tar.gz
phaser: erase OCM automatically for V0
New part did not make it in time for SMT, so we can work around issue in firmware. BRANCH=none BUG=b:109928364 TEST=builds Change-Id: I6bac65a2148755cb68020fb8a0de7ba5cf2de726 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1093112 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'driver/tcpm/anx7447.c')
-rw-r--r--driver/tcpm/anx7447.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 0b7993cccb..35789e69bd 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -190,7 +190,7 @@ static int anx7447_flash_is_empty(int port)
return ((r == 0) ? 1 : 0);
}
-int anx7447_flash_erase(int port)
+static int anx7447_flash_erase_internal(int port, int write_console_if_empty)
{
int rv;
int r;
@@ -199,7 +199,8 @@ int anx7447_flash_erase(int port)
usleep(ANX7447_DELAY_IN_US);
if (anx7447_flash_is_empty(port) == 1) {
- CPRINTS("C%d: Nothing to erase!", port);
+ if (write_console_if_empty)
+ CPRINTS("C%d: Nothing to erase!", port);
return EC_SUCCESS;
}
CPRINTS("C%d: Erasing OCM flash...", port);
@@ -222,6 +223,12 @@ int anx7447_flash_erase(int port)
return anx7447_wait_for_flash_done(port);
}
+int anx7447_flash_erase(int port)
+{
+ return anx7447_flash_erase_internal(port,
+ 0 /* suppress console if empty */);
+}
+
/* Add console command to erase OCM flash if needed. */
static int command_anx_ocm(int argc, char **argv)
{
@@ -240,7 +247,8 @@ static int command_anx_ocm(int argc, char **argv)
int rv;
if (strcasecmp(argv[2], "erase"))
return EC_ERROR_PARAM2;
- rv = anx7447_flash_erase(port);
+ rv = anx7447_flash_erase_internal(
+ port, 1 /* write to console if empty */);
if (rv)
ccprintf("C%d: Failed to erase OCM flash (%d)\n", rv);
}