From 8350369c8695e58f1c7c0ffeddf8c652d3af3adb Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Fri, 8 Jun 2018 10:15:20 -0600 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/1093112 Reviewed-by: Furquan Shaikh --- driver/tcpm/anx7447.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'driver/tcpm/anx7447.c') 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); } -- cgit v1.2.1