summaryrefslogtreecommitdiff
path: root/board/cr50/board.c
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2022-02-23 11:04:07 -0600
committerCommit Bot <commit-bot@chromium.org>2022-03-01 05:09:35 +0000
commitbba90682d743dd6947751dcfd50871525c2224a2 (patch)
treebc3dd60d00cdabff1bbcb0ff8e017ac39a1ed6a1 /board/cr50/board.c
parent8d39e763aca72c79049009865fe164f59b6c6035 (diff)
downloadchrome-ec-bba90682d743dd6947751dcfd50871525c2224a2.tar.gz
cr50: return the time since user_pres was asserted
Add a vendor command that returns the time since user_pres_l was asserted. This is only used for testing. Tracking user_pres_l needs to be enabled with a vendor command since DIOM4 may not be pulled up and may be pulled down on old boards. Enabling the vendor command survives deep sleep reset. It gets cleared after cr50 reset. Cr50 clears the user_pres_l status if tracking is disabled. BUG=b:219981194,b:208504127 TEST=manual # Verify it survives deep sleep sudo gsctool -y enable sudo gsctool -y ... user pres enabled # enter deep sleep sudo gsctool -y ... user pres enabled # Verify it doesn't survive cr50 reboot sudo gsctool -y enable sudo gsctool -y ... user pres enabled cr50 > reboot sudo gsctool -y ... user pres disabled # Check gsctool output after triggering DIOM4 pulse sudo gsctool -y enable # Trigger pulse and wait 5 seconds sudo gsctool -y ... user pres enabled last press: 5064331 Change-Id: Ib37980a5cd8d3378bf718e8e32a7d4152435a816 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3495863 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
Diffstat (limited to 'board/cr50/board.c')
-rw-r--r--board/cr50/board.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index 567ef45d27..b47bb4f611 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -189,6 +189,25 @@ int board_get_ccd_rec_lid_pin(void)
return board_properties & BOARD_CCD_REC_LID_PIN_MASK;
}
+int board_use_diom4(void)
+{
+ return !!(board_properties & BOARD_USE_DIOM4);
+}
+
+void board_write_prop(uint32_t flag, uint8_t enable)
+{
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG1, 1);
+ /* Update board_properties and long life scratch. */
+ if (enable) {
+ board_properties |= flag;
+ GREG32(PMU, LONG_LIFE_SCRATCH1) |= flag;
+ } else {
+ board_properties &= ~flag;
+ GREG32(PMU, LONG_LIFE_SCRATCH1) &= ~flag;
+ }
+ /* Disable access to LONG_LIFE_SCRATCH1 reg */
+ GWRITE_FIELD(PMU, LONG_LIFE_SCRATCH_WR_EN, REG1, 0);
+}
/* Get header address of the backup RW copy. */
const struct SignedHeader *get_other_rw_addr(void)