Kinetis: check/switch run mode before flash operation
authorTomas Vanek <vanekt@fbl.cz>
Mon, 12 Oct 2015 22:15:16 +0000 (00:15 +0200)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Mon, 15 Feb 2016 19:46:51 +0000 (19:46 +0000)
commit69db898b3b71eeeaa7aa6f3593467b3a61f11e88
treea86151fcc78a32f4427f425b6defdfc85d2e6286
parentb32b2fcadf59986e18bf3c24171be5e17d60447d
Kinetis: check/switch run mode before flash operation

FTFx flash controller requires MCU in normal RUN mode.
Flash cannot be erased, programmed or blank checked in VLPR or HSRUN
modes.

VLPR mode is switched to RUN mode as it does not require any changes
in clock generator setting. VLPR can be active from reset on some
KLx devices (with some FOPT setting) so 'reset init' might not be
sufficient to get device to normal RUN.

Any other mode than RUN or VLPR is reported as an error.

Change-Id: I60f494ce0d534b04870c6219d9b05f66f7244433
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/3012
Tested-by: jenkins
src/flash/nor/kinetis.c