This is an automated email from Gerrit.

"Maksim Dednev <[email protected]>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6781

-- gerrit

commit a5b0548e31bbb1c3e0fc53aca83780859c70b41f
Author: Maksim Dednev <[email protected]>
Date:   Thu Dec 16 14:34:20 2021 +0300

    flash/nor/mdr: fixed flash reading (main/info)
    
    MDR driver supports memory type selector for reading/writing main or
    info memory. But mdr_read function, used for flash reading, doesn't
    properly implement selection and always reads info memory due to the
    FLASH_IFREN bit setting. This behaviour differs with other functions
    and I've added mem_type handling to read selected memory area.
    
    Signed-off-by: Maksim Dednev <[email protected]>
    Change-Id: I6503c449b6ec73bfe2b4712c7a042634e8a95c93

diff --git a/src/flash/nor/mdr.c b/src/flash/nor/mdr.c
index f3c85525a..f8512fc05 100644
--- a/src/flash/nor/mdr.c
+++ b/src/flash/nor/mdr.c
@@ -520,7 +520,9 @@ static int mdr_read(struct flash_bank *bank, uint8_t 
*buffer,
                goto err_lock;
 
        /* Switch on register access */
-       flash_cmd = (flash_cmd & FLASH_DELAY_MASK) | FLASH_CON | FLASH_IFREN;
+       flash_cmd = (flash_cmd & FLASH_DELAY_MASK) | FLASH_CON;
+       if (mdr_info->mem_type)
+               flash_cmd |= FLASH_IFREN;
        retval = target_write_u32(target, FLASH_CMD, flash_cmd);
        if (retval != ERROR_OK)
                goto reset_pg_and_lock;

-- 

Reply via email to