summaryrefslogtreecommitdiff
path: root/include/flash.h
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-23 13:08:40 -0700
committerGerrit <chrome-bot@google.com>2012-07-23 23:30:33 -0700
commit1661f1cef07f5b29b7e9c06fb3220fb48d110686 (patch)
tree10149783f545d199b5abcdf4122336cbc9494648 /include/flash.h
parent0653aa011ac5ce05f2e0d70bae90b5b7d126ea73 (diff)
downloadchrome-ec-1661f1cef07f5b29b7e9c06fb3220fb48d110686.tar.gz
Refactor flash module
This is a significant rewrite of the flash module, since it turns out that much less of the flash logic is actually common between stm32 and lm4. BUG=chrome-os-partner:11699 TEST=on link, (enable hardware wp) flashinfo -> wp_gpio_asserted flashwp enable flashinfo -> wp_gpio_asserted ro_at_boot reboot flashinfo -> wp_gpio_asserted ro_at_boot ro_now flashwp disable -> error 7 flashwp now flashinfo -> wp_gpio_asserted ro_at_boot ro_now rw_now reboot flashinfo -> wp_gpio_asserted ro_at_boot ro_now (disable hardware wp) reboot flashinfo -> ro_at_boot flashwp disable flashinfo -> (no flags) Change-Id: If22b02373946ce1c080d49ccded4f8fa3e380115 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28200 Reviewed-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'include/flash.h')
-rw-r--r--include/flash.h47
1 files changed, 7 insertions, 40 deletions
diff --git a/include/flash.h b/include/flash.h
index d74ae19c7b..2e31cf0f22 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -16,20 +16,6 @@
/* Low-level methods, for use by flash_common. */
/**
- * Initialize the physical flash interface.
- */
-int flash_physical_pre_init(void);
-
-/**
- * Return the physical size of flash in bytes as read from the flash chip
- * itself.
- *
- * Used during testing to confirm CONFIG_FLASH_PHYSICAL_SIZE is correct.
- * Most other code should use CONFIG_FLASH_PHYSICAL_SIZE.
- */
-int flash_physical_size(void);
-
-/**
* Get the physical memory address of a flash offset
*
* This is used for direct flash access. We assume that the flash is
@@ -74,14 +60,6 @@ int flash_physical_erase(int offset, int size);
*/
int flash_physical_get_protect(int bank);
-/**
- * Protect the flash banks until reboot.
- *
- * @param start_bank Start bank to protect
- * @param bank_count Number of banks to protect
- */
-void flash_physical_set_protect(int start_bank, int bank_count);
-
/*****************************************************************************/
/* High-level interface for use by other modules. */
@@ -141,29 +119,18 @@ int flash_write(int offset, int size, const char *data);
int flash_erase(int offset, int size);
/**
- * Protect the entire flash until reboot.
+ * Return the flash protect state.
*
- * If the write protect pin is deasserted, this request is ignored.
- */
-int flash_protect_until_reboot(void);
-
-/**
- * Enable write protect for the read-only code.
- *
- * Once write protect is enabled, it will STAY enabled until the system is
- * hard-rebooted with the hardware write protect pin deasserted. If the write
- * protect pin is deasserted, the protect setting is ignored, and the entire
- * flash will be writable.
- *
- * @param enable Enable write protection
+ * Uses the EC_FLASH_PROTECT_* flags from ec_commands.h
*/
-int flash_enable_protect(int enable);
+uint32_t flash_get_protect(void);
/**
- * Return the flash protect lock status.
+ * Set the flash protect state.
*
- * Uses the EC_FLASH_PROTECT_* flags from ec_commands.h
+ * @param mask Bits in flags to apply.
+ * @param flags New values for flags.
*/
-int flash_get_protect(void);
+int flash_set_protect(uint32_t mask, uint32_t flags);
#endif /* __CROS_EC_FLASH_H */