This is an automated email from Gerrit.

Paul Fertser ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2424

-- gerrit

commit cdbae15c27b2969f73a3c6d4657e99df6b73b92d
Author: Paul Fertser <[email protected]>
Date:   Fri Dec 5 13:18:36 2014 +0300

    flash/nor/kinetis: pull SRST low during mass erase
    
    Mass erase operation might be impacted by different factors,
    apparently the most reliable way is to do it while asserting the chip
    reset line.
    
    Change-Id: Id6ab57eaec86e402ffdf4f5c8843e7735640f03e
    Signed-off-by: Paul Fertser <[email protected]>

diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index e8917c7..c54e065 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -31,6 +31,7 @@
 #include "config.h"
 #endif
 
+#include "jtag/interface.h"
 #include "imp.h"
 #include <helper/binarybuffer.h>
 #include <target/algorithm.h>
@@ -313,6 +314,14 @@ COMMAND_HANDLER(kinetis_mdm_mass_erase)
         * Reset Request bit in the MDM-AP control register after
         * establishing communication...
         */
+
+       /* assert SRST */
+       if (jtag_get_reset_config() & RESET_HAS_SRST)
+               adapter_assert_reset();
+       else
+               LOG_WARNING("Attempting mass erase without hardware reset. This 
is not reliable; "
+                           "it's recommended you connect SRST and use 
``reset_config srst_only''.");
+
        dap_ap_select(dap, 1);
 
        retval = kinetis_mdm_write_register(dap, MDM_REG_CTRL, 
MEM_CTRL_SYS_RES_REQ);
@@ -364,6 +373,9 @@ COMMAND_HANDLER(kinetis_mdm_mass_erase)
        if (retval != ERROR_OK)
                return retval;
 
+       if (jtag_get_reset_config() & RESET_HAS_SRST)
+               adapter_deassert_reset();
+
        dap_ap_select(dap, original_ap);
        return ERROR_OK;
 }

-- 

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to