flash: stop caching protection state

There are a million reasons why cached protection state might
be stale: power cycling of target, reset, code executing on
the target, etc.

The "flash protect_check" command is now gone. This is *always*
executed when running a "flash info".

As a bonus for more a more robust approach, lots of code could
be deleted.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
Øyvind Harboe
2010-05-05 15:08:34 +02:00
parent f7e0f3c285
commit 737c9b6258
6 changed files with 33 additions and 150 deletions

View File

@@ -53,6 +53,10 @@ struct flash_sector
* Indication of protection status: 0 = unprotected/unlocked,
* 1 = protected/locked, other = unknown. Set by
* @c flash_driver_s::protect_check.
*
* This information must be considered stale immediately.
* A million things could make it stale: power cycle,
* reset of target, code running on target, etc.
*/
int is_protected;
};
@@ -124,9 +128,6 @@ int flash_unlock_address_range(struct target *target, uint32_t addr,
int flash_write(struct target *target,
struct image *image, uint32_t *written, int erase);
/* invalidate cached state (targets may modify their own flash) */
void nor_resume(struct target *target);
/**
* Forces targets to re-examine their erase/protection state.
* This routine must be called when the system may modify the status.