This is an automated email from Gerrit.

"Maksim Dednev <m.ded...@securitycode.ru>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6779

-- gerrit

commit 27714e85d079b68570fc1962c9d99a3c3609aa5a
Author: Maksim Dednev <m.ded...@securitycode.ru>
Date:   Thu Dec 16 12:49:58 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.
    
    Change-Id: I8a747f23118e8a8eaba9e26a421a99f791637110
    Signed-off-by: Maksim Dednev <m.ded...@securitycode.ru>

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