This is an automated email from Gerrit.

Andreas Fritiofson (andreas.fritiof...@gmail.com) just uploaded a new patch set 
to Gerrit, which you can find at http://openocd.zylin.com/1643

-- gerrit

commit 505bd8a4cee0895c329cdfb23fa3449944f49fea
Author: Andreas Fritiofson <andreas.fritiof...@gmail.com>
Date:   Sat Sep 21 18:58:09 2013 +0200

    str7x: Report flash protection status as unknown
    
    Instead of trying to interpret and report garbage, set the sector
    protection information to 'unknown'. Remove the info function whose only
    purpose was to print a text saying the protection status was unreliable.
    
    Note that I have assumed that the code comment is correct and it really
    makes no sense trying to read the protection status.
    
    Change-Id: I1f6211358a58877c0b729d9fdefd5d3dea8cba00
    Signed-off-by: Andreas Fritiofson <andreas.fritiof...@gmail.com>

diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c
index 93b0f83..7c3c16f 100644
--- a/src/flash/nor/str7x.c
+++ b/src/flash/nor/str7x.c
@@ -305,28 +305,12 @@ static int str7x_result(struct flash_bank *bank)
 
 static int str7x_protect_check(struct flash_bank *bank)
 {
-       struct str7x_flash_bank *str7x_info = bank->driver_priv;
-       struct target *target = bank->target;
-
-       int i;
-       uint32_t flash_flags;
-
-       if (bank->target->state != TARGET_HALTED) {
-               LOG_ERROR("Target not halted");
-               return ERROR_TARGET_NOT_HALTED;
-       }
-
-       int retval;
-       retval = target_read_u32(target, str7x_get_flash_adr(bank, 
FLASH_NVWPAR), &flash_flags);
-       if (retval != ERROR_OK)
-               return retval;
-
-       for (i = 0; i < bank->num_sectors; i++) {
-               if (flash_flags & str7x_info->sector_bits[i])
-                       bank->sectors[i].is_protected = 0;
-               else
-                       bank->sectors[i].is_protected = 1;
-       }
+       /* STR7x flash doesn't support sector protection interrogation.
+        * FLASH_NVWPAR acts as a write only register; its read value
+        * doesn't reflect the actual protection state of the sectors.
+        */
+       for (int i = 0; i < bank->num_sectors; i++)
+               bank->sectors[i].is_protected = -1;
 
        return ERROR_OK;
 }
@@ -705,17 +689,6 @@ COMMAND_HANDLER(str7x_handle_part_id_command)
 }
 #endif
 
-static int get_str7x_info(struct flash_bank *bank, char *buf, int buf_size)
-{
-       /* STR7x flash doesn't support sector protection interrogation.
-        * FLASH_NVWPAR acts as a write only register; its read value
-        * doesn't reflect the actual protection state of the sectors.
-        */
-       snprintf(buf, buf_size, "STR7x flash lock information might not be 
correct "
-                       "due to hardware limitations.");
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(str7x_handle_disable_jtag_command)
 {
        struct target *target = NULL;
@@ -811,5 +784,4 @@ struct flash_driver str7x_flash = {
        .auto_probe = str7x_probe,
        .erase_check = default_flash_blank_check,
        .protect_check = str7x_protect_check,
-       .info = get_str7x_info,
 };

-- 

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to