flash/stm32fxx.c: do not read CPUID as this info is stored in cortex_m_common
In these drivers we read CPUID to check the Cortex-M PARTNO, but now the PARTNO is stored in struct cortex_m_common.core_info. Change-Id: I5bb3b95210ab6e23b8e1252686dd81015740bf68 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6240 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
1185760729
commit
f5898bd93f
@@ -29,7 +29,7 @@
|
||||
#include "imp.h"
|
||||
#include <helper/binarybuffer.h>
|
||||
#include <target/algorithm.h>
|
||||
#include <target/armv7m.h>
|
||||
#include <target/cortex_m.h>
|
||||
|
||||
/* Regarding performance:
|
||||
*
|
||||
@@ -968,25 +968,17 @@ static int stm32x_get_device_id(struct flash_bank *bank, uint32_t *device_id)
|
||||
* Only effects Rev A silicon */
|
||||
|
||||
struct target *target = bank->target;
|
||||
uint32_t cpuid;
|
||||
struct cortex_m_common *cortex_m = target_to_cm(target);
|
||||
|
||||
/* read stm32 device id register */
|
||||
int retval = target_read_u32(target, 0xE0042000, device_id);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
if ((*device_id & 0xfff) == 0x411) {
|
||||
/* read CPUID reg to check core type */
|
||||
retval = target_read_u32(target, 0xE000ED00, &cpuid);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
/* check for cortex_m4 */
|
||||
if (((cpuid >> 4) & 0xFFF) == 0xC24) {
|
||||
*device_id &= ~((0xFFFF << 16) | 0xfff);
|
||||
*device_id |= (0x1000 << 16) | 0x413;
|
||||
LOG_INFO("stm32f4x errata detected - fixing incorrect MCU_IDCODE");
|
||||
}
|
||||
if ((*device_id & 0xfff) == 0x411 && cortex_m->core_info->partno == CORTEX_M4_PARTNO) {
|
||||
*device_id &= ~((0xFFFF << 16) | 0xfff);
|
||||
*device_id |= (0x1000 << 16) | 0x413;
|
||||
LOG_INFO("stm32f4x errata detected - fixing incorrect MCU_IDCODE");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user