summaryrefslogtreecommitdiff
path: root/include/flash.h
diff options
context:
space:
mode:
authorWei-Ning Huang <wnhuang@google.com>2017-07-24 14:34:55 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-07-27 04:22:42 -0700
commitb9c8dcb9f6b113d35f9da7a218df0507d4a492c2 (patch)
treee5ebec26f978df8689faf2ae12b9eeca51231bb0 /include/flash.h
parent381fc5912c6b528c5dbc4509feeade07a1332694 (diff)
downloadchrome-ec-b9c8dcb9f6b113d35f9da7a218df0507d4a492c2.tar.gz
flash: add flash selection support
Some chips require special operations before flash can be accessed (read, write, erase), without it the flash operations could be corrupted. The chip that requires this should enable the CONFIG_FLASH_SELECT_REQUIRED config, which exposes EC_FLASH_INFO_SELECT_REQUIRED in flashinfo flags. Before any flash operations is executed on the chip, EC_CMD_FLASH_SELECT should be issued to notify the chip to prepare for the flash operations. BRANCH=none BUG=b:63685022 TEST=with depended CLs, touchpad interrupt should be disabled when flashrom is in progress. CQ-DEPEND=CL:*416548 Change-Id: I96455adbe739d5f924edf382a2752404a7c5ad04 Signed-off-by: Wei-Ning Huang <wnhuang@google.com> Reviewed-on: https://chromium-review.googlesource.com/582374 Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org> Tested-by: Wei-Ning Huang <wnhuang@chromium.org> Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org>
Diffstat (limited to 'include/flash.h')
-rw-r--r--include/flash.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/flash.h b/include/flash.h
index cdd8148d03..2637f9066c 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -342,4 +342,14 @@ void flash_lock_mapped_storage(int lock);
#else
static inline void flash_lock_mapped_storage(int lock) { };
#endif /* CONFIG_EXTERNAL_STORAGE */
+
+/**
+ * Select flash for performing flash operations. Board should implement this
+ * if some steps needed be done before flash operation can succeed.
+ *
+ * @param select 1 to select flash, 0 to deselect (disable).
+ * @return EC_RES_* status code.
+ */
+int board_flash_select(int select);
+
#endif /* __CROS_EC_FLASH_H */