summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2021-02-24 16:21:05 -0800
committerAseda Aboagye <aaboagye@chromium.org>2021-02-25 00:48:23 +0000
commitf53280aae9db6fd71f4986d2b3c6ab10a84afc83 (patch)
treece5380f7a8aa3b61a370e4d209cda59745abca15
parent4ea388ba7a12e4156698ba7ca56909be0a6f69be (diff)
downloadchrome-ec-f53280aae9db6fd71f4986d2b3c6ab10a84afc83.tar.gz
system: Add board_pulse_entering_rw()
This commit adds an overridable function for pulsing the EC_ENTERING_RW signal. This function should only be overridden in very rare circumstances! The default implementation is unchanged. EC_ENTERING_RW is pulsed for 1ms. BUG=b:180965428,b:181051734,b:181085178 BRANCH=dedede TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ie04bc0b0d20473be1b3d5f46fa1a986ab6e59953 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2719103 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/system.c11
-rw-r--r--include/system.h9
2 files changed, 17 insertions, 3 deletions
diff --git a/common/system.c b/common/system.c
index a8b9961b74..e188acc136 100644
--- a/common/system.c
+++ b/common/system.c
@@ -503,6 +503,13 @@ const char *ec_image_to_string(enum ec_image copy)
return image_names[copy < ARRAY_SIZE(image_names) ? copy : 0];
}
+__overridable void board_pulse_entering_rw(void)
+{
+ gpio_set_level(GPIO_EC_ENTERING_RW, 1);
+ usleep(MSEC);
+ gpio_set_level(GPIO_EC_ENTERING_RW, 0);
+}
+
/**
* Jump to what we hope is the init address of an image.
*
@@ -523,9 +530,7 @@ static void jump_to_image(uintptr_t init_addr)
* drop it again so we don't leak power through the pulldown in the
* Silego.
*/
- gpio_set_level(GPIO_ENTERING_RW, 1);
- usleep(MSEC);
- gpio_set_level(GPIO_ENTERING_RW, 0);
+ board_pulse_entering_rw();
/*
* Since in EFS2, USB/PD won't be enabled in RO or if it's enabled in
diff --git a/include/system.h b/include/system.h
index be213bf2fe..c50c44797b 100644
--- a/include/system.h
+++ b/include/system.h
@@ -348,6 +348,15 @@ const char *system_get_chip_revision(void);
int system_get_chip_unique_id(uint8_t **id);
/**
+ * Optional board-level function to pulse EC_ENTERING_RW.
+ *
+ * This should ONLY be overridden in very rare circumstances! AKA there better
+ * be a good reason why you're overriding this!
+ * The function ***MUST*** assert EC_ENTERING_RW for 1ms and then deassert it.
+ */
+__override_proto void board_pulse_entering_rw(void);
+
+/**
* Optional board-level callback functions to read a unique serial number per
* chip. Default implementation reads from flash/otp (flash/otp_read_serial).
*/