NOR: trim range in flash_driver_protect()
commit5e78ddcea0d8303c316f687c05dfa78af27109d8
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 4 Mar 2010 05:01:16 +0000 (3 21:01 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 4 Mar 2010 05:01:16 +0000 (3 21:01 -0800)
tree563777a521940811f1d1ac8d8113aa45668bf895
parent5fdf9535cef7e43f6e99081b6d1f6bd682184803
NOR: trim range in flash_driver_protect()

When the beginning or end of the specified range of sectors
already has the requested protection status, don't ask the
flash driver to change those sectors.

This will among other things turn command sequences like
this into the NOPs one would expect:

flash protect_check 0
flash info 0
... reports everything as unprotected ...
flash protect 0 0 1 off

That speeds things up (by whatever work was just avoided).

Also, with Stellaris (which can't unprotect flash at  page level)
this can eliminate some undesirable/false error reports.  (And
finishes fixing a bug currently listed in our bug database...)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/flash/nor/core.c