Merge branch 'master' into update
Change-Id: Icec244b174cc0c67ab58961649a369db7f344824
This commit is contained in:
+2
-2
@@ -259,11 +259,11 @@ static int mg_dsk_wait(mg_io_type_wait wait_local, uint32_t time_var)
|
||||
case mg_io_wait_rdy:
|
||||
if (status & mg_io_rbit_status_ready)
|
||||
return ERROR_OK;
|
||||
|
||||
/* fallthrough */
|
||||
case mg_io_wait_drq:
|
||||
if (status & mg_io_rbit_status_data_req)
|
||||
return ERROR_OK;
|
||||
|
||||
/* fallthrough */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -281,6 +281,7 @@ static int imx31_command(struct nand_device *nand, uint8_t command)
|
||||
* offset == one half of page size
|
||||
*/
|
||||
in_sram_address = MX3_NF_MAIN_BUFFER0 + (nand->page_size >> 1);
|
||||
break;
|
||||
default:
|
||||
in_sram_address = MX3_NF_MAIN_BUFFER0;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ NOR_DRIVERS = \
|
||||
%D%/mrvlqspi.c \
|
||||
%D%/niietcm4.c \
|
||||
%D%/non_cfi.c \
|
||||
%D%/nrf51.c \
|
||||
%D%/nrf5.c \
|
||||
%D%/numicro.c \
|
||||
%D%/ocl.c \
|
||||
%D%/pic32mx.c \
|
||||
@@ -50,6 +50,7 @@ NOR_DRIVERS = \
|
||||
%D%/stm32f2x.c \
|
||||
%D%/stm32lx.c \
|
||||
%D%/stm32l4x.c \
|
||||
%D%/stm32h7x.c \
|
||||
%D%/str7x.c \
|
||||
%D%/str9x.c \
|
||||
%D%/str9xpec.c \
|
||||
|
||||
@@ -49,6 +49,7 @@ extern struct flash_driver lpcspifi_flash;
|
||||
extern struct flash_driver mdr_flash;
|
||||
extern struct flash_driver mrvlqspi_flash;
|
||||
extern struct flash_driver niietcm4_flash;
|
||||
extern struct flash_driver nrf5_flash;
|
||||
extern struct flash_driver nrf51_flash;
|
||||
extern struct flash_driver numicro_flash;
|
||||
extern struct flash_driver ocl_flash;
|
||||
@@ -60,6 +61,7 @@ extern struct flash_driver stm32f1x_flash;
|
||||
extern struct flash_driver stm32f2x_flash;
|
||||
extern struct flash_driver stm32lx_flash;
|
||||
extern struct flash_driver stm32l4x_flash;
|
||||
extern struct flash_driver stm32h7x_flash;
|
||||
extern struct flash_driver stmsmi_flash;
|
||||
extern struct flash_driver str7x_flash;
|
||||
extern struct flash_driver str9x_flash;
|
||||
@@ -103,6 +105,7 @@ static struct flash_driver *flash_drivers[] = {
|
||||
&mdr_flash,
|
||||
&mrvlqspi_flash,
|
||||
&niietcm4_flash,
|
||||
&nrf5_flash,
|
||||
&nrf51_flash,
|
||||
&numicro_flash,
|
||||
&ocl_flash,
|
||||
@@ -114,6 +117,7 @@ static struct flash_driver *flash_drivers[] = {
|
||||
&stm32f2x_flash,
|
||||
&stm32lx_flash,
|
||||
&stm32l4x_flash,
|
||||
&stm32h7x_flash,
|
||||
&stmsmi_flash,
|
||||
&str7x_flash,
|
||||
&str9x_flash,
|
||||
|
||||
+71
-28
@@ -49,6 +49,8 @@
|
||||
#define EZR_FAMILY_ID_WONDER_GECKO 120
|
||||
#define EZR_FAMILY_ID_LEOPARD_GECKO 121
|
||||
#define EZR_FAMILY_ID_HAPPY_GECKO 122
|
||||
#define EFR_FAMILY_ID_MIGHTY_GECKO 16
|
||||
#define EFR_FAMILY_ID_BLUE_GECKO 20
|
||||
|
||||
#define EFM32_FLASH_ERASE_TMO 100
|
||||
#define EFM32_FLASH_WDATAREADY_TMO 100
|
||||
@@ -72,27 +74,31 @@
|
||||
#define EFM32_MSC_DI_PROD_REV (EFM32_MSC_DEV_INFO+0x1ff)
|
||||
|
||||
#define EFM32_MSC_REGBASE 0x400c0000
|
||||
#define EFM32_MSC_WRITECTRL (EFM32_MSC_REGBASE+0x008)
|
||||
#define EFR32_MSC_REGBASE 0x400e0000
|
||||
#define EFM32_MSC_REG_WRITECTRL 0x008
|
||||
#define EFM32_MSC_WRITECTRL_WREN_MASK 0x1
|
||||
#define EFM32_MSC_WRITECMD (EFM32_MSC_REGBASE+0x00c)
|
||||
#define EFM32_MSC_REG_WRITECMD 0x00c
|
||||
#define EFM32_MSC_WRITECMD_LADDRIM_MASK 0x1
|
||||
#define EFM32_MSC_WRITECMD_ERASEPAGE_MASK 0x2
|
||||
#define EFM32_MSC_WRITECMD_WRITEONCE_MASK 0x8
|
||||
#define EFM32_MSC_ADDRB (EFM32_MSC_REGBASE+0x010)
|
||||
#define EFM32_MSC_WDATA (EFM32_MSC_REGBASE+0x018)
|
||||
#define EFM32_MSC_STATUS (EFM32_MSC_REGBASE+0x01c)
|
||||
#define EFM32_MSC_REG_ADDRB 0x010
|
||||
#define EFM32_MSC_REG_WDATA 0x018
|
||||
#define EFM32_MSC_REG_STATUS 0x01c
|
||||
#define EFM32_MSC_STATUS_BUSY_MASK 0x1
|
||||
#define EFM32_MSC_STATUS_LOCKED_MASK 0x2
|
||||
#define EFM32_MSC_STATUS_INVADDR_MASK 0x4
|
||||
#define EFM32_MSC_STATUS_WDATAREADY_MASK 0x8
|
||||
#define EFM32_MSC_STATUS_WORDTIMEOUT_MASK 0x10
|
||||
#define EFM32_MSC_STATUS_ERASEABORTED_MASK 0x20
|
||||
#define EFM32_MSC_LOCK (EFM32_MSC_REGBASE+0x03c)
|
||||
#define EFM32_MSC_REG_LOCK 0x03c
|
||||
#define EFR32_MSC_REG_LOCK 0x040
|
||||
#define EFM32_MSC_LOCK_LOCKKEY 0x1b71
|
||||
|
||||
struct efm32x_flash_bank {
|
||||
int probed;
|
||||
uint32_t lb_page[LOCKBITS_PAGE_SZ/4];
|
||||
uint32_t reg_base;
|
||||
uint32_t reg_lock;
|
||||
};
|
||||
|
||||
struct efm32_info {
|
||||
@@ -132,11 +138,30 @@ static int efm32x_get_prod_rev(struct flash_bank *bank, uint8_t *prev)
|
||||
return target_read_u8(bank->target, EFM32_MSC_DI_PROD_REV, prev);
|
||||
}
|
||||
|
||||
static int efm32x_read_reg_u32(struct flash_bank *bank, target_addr_t offset,
|
||||
uint32_t *value)
|
||||
{
|
||||
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
|
||||
uint32_t base = efm32x_info->reg_base;
|
||||
|
||||
return target_read_u32(bank->target, base + offset, value);
|
||||
}
|
||||
|
||||
static int efm32x_write_reg_u32(struct flash_bank *bank, target_addr_t offset,
|
||||
uint32_t value)
|
||||
{
|
||||
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
|
||||
uint32_t base = efm32x_info->reg_base;
|
||||
|
||||
return target_write_u32(bank->target, base + offset, value);
|
||||
}
|
||||
|
||||
static int efm32x_read_info(struct flash_bank *bank,
|
||||
struct efm32_info *efm32_info)
|
||||
{
|
||||
int ret;
|
||||
uint32_t cpuid = 0;
|
||||
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
|
||||
|
||||
memset(efm32_info, 0, sizeof(struct efm32_info));
|
||||
|
||||
@@ -175,6 +200,15 @@ static int efm32x_read_info(struct flash_bank *bank,
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
if (EFR_FAMILY_ID_BLUE_GECKO == efm32_info->part_family ||
|
||||
EFR_FAMILY_ID_MIGHTY_GECKO == efm32_info->part_family) {
|
||||
efm32x_info->reg_base = EFR32_MSC_REGBASE;
|
||||
efm32x_info->reg_lock = EFR32_MSC_REG_LOCK;
|
||||
} else {
|
||||
efm32x_info->reg_base = EFM32_MSC_REGBASE;
|
||||
efm32x_info->reg_lock = EFM32_MSC_REG_LOCK;
|
||||
}
|
||||
|
||||
if (EFM_FAMILY_ID_GECKO == efm32_info->part_family ||
|
||||
EFM_FAMILY_ID_TINY_GECKO == efm32_info->part_family)
|
||||
efm32_info->page_size = 512;
|
||||
@@ -208,7 +242,9 @@ static int efm32x_read_info(struct flash_bank *bank,
|
||||
}
|
||||
} else if (EFM_FAMILY_ID_WONDER_GECKO == efm32_info->part_family ||
|
||||
EZR_FAMILY_ID_WONDER_GECKO == efm32_info->part_family ||
|
||||
EZR_FAMILY_ID_LEOPARD_GECKO == efm32_info->part_family) {
|
||||
EZR_FAMILY_ID_LEOPARD_GECKO == efm32_info->part_family ||
|
||||
EFR_FAMILY_ID_BLUE_GECKO == efm32_info->part_family ||
|
||||
EFR_FAMILY_ID_MIGHTY_GECKO == efm32_info->part_family) {
|
||||
uint8_t pg_size = 0;
|
||||
ret = target_read_u8(bank->target, EFM32_MSC_DI_PAGE_SIZE,
|
||||
&pg_size);
|
||||
@@ -241,6 +277,10 @@ static int efm32x_decode_info(struct efm32_info *info, char *buf, int buf_size)
|
||||
case EZR_FAMILY_ID_HAPPY_GECKO:
|
||||
printed = snprintf(buf, buf_size, "EZR32 ");
|
||||
break;
|
||||
case EFR_FAMILY_ID_MIGHTY_GECKO:
|
||||
case EFR_FAMILY_ID_BLUE_GECKO:
|
||||
printed = snprintf(buf, buf_size, "EFR32 ");
|
||||
break;
|
||||
default:
|
||||
printed = snprintf(buf, buf_size, "EFM32 ");
|
||||
}
|
||||
@@ -276,6 +316,12 @@ static int efm32x_decode_info(struct efm32_info *info, char *buf, int buf_size)
|
||||
case EZR_FAMILY_ID_HAPPY_GECKO:
|
||||
printed = snprintf(buf, buf_size, "Happy Gecko");
|
||||
break;
|
||||
case EFR_FAMILY_ID_BLUE_GECKO:
|
||||
printed = snprintf(buf, buf_size, "Blue Gecko");
|
||||
break;
|
||||
case EFR_FAMILY_ID_MIGHTY_GECKO:
|
||||
printed = snprintf(buf, buf_size, "Mighty Gecko");
|
||||
break;
|
||||
}
|
||||
|
||||
buf += printed;
|
||||
@@ -319,7 +365,7 @@ static int efm32x_set_reg_bits(struct flash_bank *bank, uint32_t reg,
|
||||
int ret = 0;
|
||||
uint32_t reg_val = 0;
|
||||
|
||||
ret = target_read_u32(bank->target, reg, ®_val);
|
||||
ret = efm32x_read_reg_u32(bank, reg, ®_val);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
@@ -328,18 +374,19 @@ static int efm32x_set_reg_bits(struct flash_bank *bank, uint32_t reg,
|
||||
else
|
||||
reg_val &= ~bitmask;
|
||||
|
||||
return target_write_u32(bank->target, reg, reg_val);
|
||||
return efm32x_write_reg_u32(bank, reg, reg_val);
|
||||
}
|
||||
|
||||
static int efm32x_set_wren(struct flash_bank *bank, int write_enable)
|
||||
{
|
||||
return efm32x_set_reg_bits(bank, EFM32_MSC_WRITECTRL,
|
||||
return efm32x_set_reg_bits(bank, EFM32_MSC_REG_WRITECTRL,
|
||||
EFM32_MSC_WRITECTRL_WREN_MASK, write_enable);
|
||||
}
|
||||
|
||||
static int efm32x_msc_lock(struct flash_bank *bank, int lock)
|
||||
{
|
||||
return target_write_u32(bank->target, EFM32_MSC_LOCK,
|
||||
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
|
||||
return efm32x_write_reg_u32(bank, efm32x_info->reg_lock,
|
||||
(lock ? 0 : EFM32_MSC_LOCK_LOCKKEY));
|
||||
}
|
||||
|
||||
@@ -350,7 +397,7 @@ static int efm32x_wait_status(struct flash_bank *bank, int timeout,
|
||||
uint32_t status = 0;
|
||||
|
||||
while (1) {
|
||||
ret = target_read_u32(bank->target, EFM32_MSC_STATUS, &status);
|
||||
ret = efm32x_read_reg_u32(bank, EFM32_MSC_REG_STATUS, &status);
|
||||
if (ERROR_OK != ret)
|
||||
break;
|
||||
|
||||
@@ -389,16 +436,16 @@ static int efm32x_erase_page(struct flash_bank *bank, uint32_t addr)
|
||||
|
||||
LOG_DEBUG("erasing flash page at 0x%08" PRIx32, addr);
|
||||
|
||||
ret = target_write_u32(bank->target, EFM32_MSC_ADDRB, addr);
|
||||
ret = efm32x_write_reg_u32(bank, EFM32_MSC_REG_ADDRB, addr);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_WRITECMD,
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_REG_WRITECMD,
|
||||
EFM32_MSC_WRITECMD_LADDRIM_MASK, 1);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
ret = target_read_u32(bank->target, EFM32_MSC_STATUS, &status);
|
||||
ret = efm32x_read_reg_u32(bank, EFM32_MSC_REG_STATUS, &status);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
@@ -412,7 +459,7 @@ static int efm32x_erase_page(struct flash_bank *bank, uint32_t addr)
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_WRITECMD,
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_REG_WRITECMD,
|
||||
EFM32_MSC_WRITECMD_ERASEPAGE_MASK, 1);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
@@ -589,6 +636,7 @@ static int efm32x_write_block(struct flash_bank *bank, const uint8_t *buf,
|
||||
uint32_t address = bank->base + offset;
|
||||
struct reg_param reg_params[5];
|
||||
struct armv7m_algorithm armv7m_info;
|
||||
struct efm32x_flash_bank *efm32x_info = bank->driver_priv;
|
||||
int ret = ERROR_OK;
|
||||
|
||||
/* see contrib/loaders/flash/efm32.S for src */
|
||||
@@ -598,10 +646,7 @@ static int efm32x_write_block(struct flash_bank *bank, const uint8_t *buf,
|
||||
/* #define EFM32_MSC_ADDRB_OFFSET 0x010 */
|
||||
/* #define EFM32_MSC_WDATA_OFFSET 0x018 */
|
||||
/* #define EFM32_MSC_STATUS_OFFSET 0x01c */
|
||||
/* #define EFM32_MSC_LOCK_OFFSET 0x03c */
|
||||
|
||||
0x15, 0x4e, /* ldr r6, =#0x1b71 */
|
||||
0xc6, 0x63, /* str r6, [r0, #EFM32_MSC_LOCK_OFFSET] */
|
||||
0x01, 0x26, /* movs r6, #1 */
|
||||
0x86, 0x60, /* str r6, [r0, #EFM32_MSC_WRITECTRL_OFFSET] */
|
||||
|
||||
@@ -660,11 +705,9 @@ static int efm32x_write_block(struct flash_bank *bank, const uint8_t *buf,
|
||||
/* exit: */
|
||||
0x30, 0x46, /* mov r0, r6 */
|
||||
0x00, 0xbe, /* bkpt #0 */
|
||||
|
||||
/* LOCKKEY */
|
||||
0x71, 0x1b, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
/* flash write code */
|
||||
if (target_alloc_working_area(target, sizeof(efm32x_flash_write_code),
|
||||
&write_algorithm) != ERROR_OK) {
|
||||
@@ -697,7 +740,7 @@ static int efm32x_write_block(struct flash_bank *bank, const uint8_t *buf,
|
||||
init_reg_param(®_params[3], "r3", 32, PARAM_OUT); /* buffer end */
|
||||
init_reg_param(®_params[4], "r4", 32, PARAM_IN_OUT); /* target address */
|
||||
|
||||
buf_set_u32(reg_params[0].value, 0, 32, EFM32_MSC_REGBASE);
|
||||
buf_set_u32(reg_params[0].value, 0, 32, efm32x_info->reg_base);
|
||||
buf_set_u32(reg_params[1].value, 0, 32, count);
|
||||
buf_set_u32(reg_params[2].value, 0, 32, source->address);
|
||||
buf_set_u32(reg_params[3].value, 0, 32, source->address + source->size);
|
||||
@@ -762,16 +805,16 @@ static int efm32x_write_word(struct flash_bank *bank, uint32_t addr,
|
||||
/* if not called, GDB errors will be reported during large writes */
|
||||
keep_alive();
|
||||
|
||||
ret = target_write_u32(bank->target, EFM32_MSC_ADDRB, addr);
|
||||
ret = efm32x_write_reg_u32(bank, EFM32_MSC_REG_ADDRB, addr);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_WRITECMD,
|
||||
ret = efm32x_set_reg_bits(bank, EFM32_MSC_REG_WRITECMD,
|
||||
EFM32_MSC_WRITECMD_LADDRIM_MASK, 1);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
ret = target_read_u32(bank->target, EFM32_MSC_STATUS, &status);
|
||||
ret = efm32x_read_reg_u32(bank, EFM32_MSC_REG_STATUS, &status);
|
||||
if (ERROR_OK != ret)
|
||||
return ret;
|
||||
|
||||
@@ -792,13 +835,13 @@ static int efm32x_write_word(struct flash_bank *bank, uint32_t addr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = target_write_u32(bank->target, EFM32_MSC_WDATA, val);
|
||||
ret = efm32x_write_reg_u32(bank, EFM32_MSC_REG_WDATA, val);
|
||||
if (ERROR_OK != ret) {
|
||||
LOG_ERROR("WDATA write failed");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = target_write_u32(bank->target, EFM32_MSC_WRITECMD,
|
||||
ret = efm32x_write_reg_u32(bank, EFM32_MSC_REG_WRITECMD,
|
||||
EFM32_MSC_WRITECMD_WRITEONCE_MASK);
|
||||
if (ERROR_OK != ret) {
|
||||
LOG_ERROR("WRITECMD write failed");
|
||||
|
||||
@@ -1959,7 +1959,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
|
||||
unsigned cpu_mhz = 120;
|
||||
unsigned idx;
|
||||
bool use_nvm_marking = false;
|
||||
char flash_marking[8], nvm_marking[2];
|
||||
char flash_marking[11], nvm_marking[2];
|
||||
char name[40];
|
||||
|
||||
k_chip->probed = false;
|
||||
@@ -2126,6 +2126,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
|
||||
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX1: /* errata 7534 - should be K63 */
|
||||
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX2: /* errata 7534 - should be K64 */
|
||||
subfamid += 2; /* errata 7534 fix */
|
||||
/* fallthrough */
|
||||
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX3:
|
||||
/* K63FN1M0 */
|
||||
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX4:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+51
-49
@@ -31,53 +31,55 @@
|
||||
* from device datasheets and Linux SPI flash drivers. */
|
||||
const struct flash_device flash_devices[] = {
|
||||
/* name, erase_cmd, chip_erase_cmd, device_id, pagesize, sectorsize, size_in_bytes */
|
||||
FLASH_ID("st m25p05", 0xd8, 0xc7, 0x00102020, 0x80, 0x8000, 0x10000),
|
||||
FLASH_ID("st m25p10", 0xd8, 0xc7, 0x00112020, 0x80, 0x8000, 0x20000),
|
||||
FLASH_ID("st m25p20", 0xd8, 0xc7, 0x00122020, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("st m25p40", 0xd8, 0xc7, 0x00132020, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("st m25p80", 0xd8, 0xc7, 0x00142020, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("st m25p16", 0xd8, 0xc7, 0x00152020, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("st m25p32", 0xd8, 0xc7, 0x00162020, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("st m25p64", 0xd8, 0xc7, 0x00172020, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("st m25p128", 0xd8, 0xc7, 0x00182020, 0x100, 0x40000, 0x1000000),
|
||||
FLASH_ID("st m45pe10", 0xd8, 0xd8, 0x00114020, 0x100, 0x10000, 0x20000),
|
||||
FLASH_ID("st m45pe20", 0xd8, 0xd8, 0x00124020, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("st m45pe40", 0xd8, 0xd8, 0x00134020, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("st m45pe80", 0xd8, 0xd8, 0x00144020, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("sp s25fl004", 0xd8, 0xc7, 0x00120201, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("sp s25fl008", 0xd8, 0xc7, 0x00130201, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("sp s25fl016", 0xd8, 0xc7, 0x00140201, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("sp s25fl116k", 0xd8, 0xc7, 0x00154001, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("sp s25fl032", 0xd8, 0xc7, 0x00150201, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("sp s25fl132k", 0xd8, 0xc7, 0x00164001, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("sp s25fl064", 0xd8, 0xc7, 0x00160201, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("sp s25fl164k", 0xd8, 0xc7, 0x00174001, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("sp s25fl128", 0xd8, 0xc7, 0x00182001, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("sp s25fl256", 0xd8, 0xc7, 0x00190201, 0x100, 0x10000, 0x2000000),
|
||||
FLASH_ID("atmel 25f512", 0x52, 0xc7, 0x0065001f, 0x80, 0x8000, 0x10000),
|
||||
FLASH_ID("atmel 25f1024", 0x52, 0x62, 0x0060001f, 0x100, 0x8000, 0x20000),
|
||||
FLASH_ID("atmel 25f2048", 0x52, 0x62, 0x0063001f, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("atmel 25f4096", 0x52, 0x62, 0x0064001f, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("atmel 25fs040", 0xd7, 0xc7, 0x0004661f, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("mac 25l512", 0xd8, 0xc7, 0x001020c2, 0x010, 0x10000, 0x10000),
|
||||
FLASH_ID("mac 25l1005", 0xd8, 0xc7, 0x001120c2, 0x010, 0x10000, 0x20000),
|
||||
FLASH_ID("mac 25l2005", 0xd8, 0xc7, 0x001220c2, 0x010, 0x10000, 0x40000),
|
||||
FLASH_ID("mac 25l4005", 0xd8, 0xc7, 0x001320c2, 0x010, 0x10000, 0x80000),
|
||||
FLASH_ID("mac 25l8005", 0xd8, 0xc7, 0x001420c2, 0x010, 0x10000, 0x100000),
|
||||
FLASH_ID("mac 25l1605", 0xd8, 0xc7, 0x001520c2, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("mac 25l3205", 0xd8, 0xc7, 0x001620c2, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("mac 25l6405", 0xd8, 0xc7, 0x001720c2, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("micron n25q064", 0xd8, 0xc7, 0x0017ba20, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("micron n25q128", 0xd8, 0xc7, 0x0018ba20, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("issi is25lp128", 0xd8, 0xc7, 0x0018609d, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("win w25q80bv", 0xd8, 0xc7, 0x001440ef, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("win w25q32fv", 0xd8, 0xc7, 0x001640ef, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("win w25q32dw", 0xd8, 0xc7, 0x001660ef, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("win w25q64cv", 0xd8, 0xc7, 0x001740ef, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("win w25q128fv", 0xd8, 0xc7, 0x001840ef, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("gd gd25q20", 0x20, 0xc7, 0x00c84012, 0x100, 0x1000, 0x80000),
|
||||
FLASH_ID("gd gd25q16c", 0xd8, 0xc7, 0x001540c8, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("gd gd25q32c", 0xd8, 0xc7, 0x001640c8, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("gd gd25q128c", 0xd8, 0xc7, 0x001840c8, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID(NULL, 0, 0, 0, 0, 0, 0)
|
||||
FLASH_ID("st m25p05", 0xd8, 0xc7, 0x00102020, 0x80, 0x8000, 0x10000),
|
||||
FLASH_ID("st m25p10", 0xd8, 0xc7, 0x00112020, 0x80, 0x8000, 0x20000),
|
||||
FLASH_ID("st m25p20", 0xd8, 0xc7, 0x00122020, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("st m25p40", 0xd8, 0xc7, 0x00132020, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("st m25p80", 0xd8, 0xc7, 0x00142020, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("st m25p16", 0xd8, 0xc7, 0x00152020, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("st m25p32", 0xd8, 0xc7, 0x00162020, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("st m25p64", 0xd8, 0xc7, 0x00172020, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("st m25p128", 0xd8, 0xc7, 0x00182020, 0x100, 0x40000, 0x1000000),
|
||||
FLASH_ID("st m45pe10", 0xd8, 0xd8, 0x00114020, 0x100, 0x10000, 0x20000),
|
||||
FLASH_ID("st m45pe20", 0xd8, 0xd8, 0x00124020, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("st m45pe40", 0xd8, 0xd8, 0x00134020, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("st m45pe80", 0xd8, 0xd8, 0x00144020, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("sp s25fl004", 0xd8, 0xc7, 0x00120201, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("sp s25fl008", 0xd8, 0xc7, 0x00130201, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("sp s25fl016", 0xd8, 0xc7, 0x00140201, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("sp s25fl116k", 0xd8, 0xc7, 0x00154001, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("sp s25fl032", 0xd8, 0xc7, 0x00150201, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("sp s25fl132k", 0xd8, 0xc7, 0x00164001, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("sp s25fl064", 0xd8, 0xc7, 0x00160201, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("sp s25fl164k", 0xd8, 0xc7, 0x00174001, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("sp s25fl128", 0xd8, 0xc7, 0x00182001, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("sp s25fl256", 0xd8, 0xc7, 0x00190201, 0x100, 0x10000, 0x2000000),
|
||||
FLASH_ID("atmel 25f512", 0x52, 0xc7, 0x0065001f, 0x80, 0x8000, 0x10000),
|
||||
FLASH_ID("atmel 25f1024", 0x52, 0x62, 0x0060001f, 0x100, 0x8000, 0x20000),
|
||||
FLASH_ID("atmel 25f2048", 0x52, 0x62, 0x0063001f, 0x100, 0x10000, 0x40000),
|
||||
FLASH_ID("atmel 25f4096", 0x52, 0x62, 0x0064001f, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("atmel 25fs040", 0xd7, 0xc7, 0x0004661f, 0x100, 0x10000, 0x80000),
|
||||
FLASH_ID("mac 25l512", 0xd8, 0xc7, 0x001020c2, 0x010, 0x10000, 0x10000),
|
||||
FLASH_ID("mac 25l1005", 0xd8, 0xc7, 0x001120c2, 0x010, 0x10000, 0x20000),
|
||||
FLASH_ID("mac 25l2005", 0xd8, 0xc7, 0x001220c2, 0x010, 0x10000, 0x40000),
|
||||
FLASH_ID("mac 25l4005", 0xd8, 0xc7, 0x001320c2, 0x010, 0x10000, 0x80000),
|
||||
FLASH_ID("mac 25l8005", 0xd8, 0xc7, 0x001420c2, 0x010, 0x10000, 0x100000),
|
||||
FLASH_ID("mac 25l1605", 0xd8, 0xc7, 0x001520c2, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("mac 25l3205", 0xd8, 0xc7, 0x001620c2, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("mac 25l6405", 0xd8, 0xc7, 0x001720c2, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("micron n25q064", 0xd8, 0xc7, 0x0017ba20, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("micron n25q128", 0xd8, 0xc7, 0x0018ba20, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("micron n25q256 3v", 0xd8, 0xc7, 0x0019ba20, 0x100, 0x10000, 0x2000000),
|
||||
FLASH_ID("micron n25q256 1.8v", 0xd8, 0xc7, 0x0019bb20, 0x100, 0x10000, 0x2000000),
|
||||
FLASH_ID("issi is25lp128", 0xd8, 0xc7, 0x0018609d, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("win w25q80bv", 0xd8, 0xc7, 0x001440ef, 0x100, 0x10000, 0x100000),
|
||||
FLASH_ID("win w25q32fv", 0xd8, 0xc7, 0x001640ef, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("win w25q32dw", 0xd8, 0xc7, 0x001660ef, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("win w25q64cv", 0xd8, 0xc7, 0x001740ef, 0x100, 0x10000, 0x800000),
|
||||
FLASH_ID("win w25q128fv", 0xd8, 0xc7, 0x001840ef, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID("gd gd25q20", 0x20, 0xc7, 0x00c84012, 0x100, 0x1000, 0x80000),
|
||||
FLASH_ID("gd gd25q16c", 0xd8, 0xc7, 0x001540c8, 0x100, 0x10000, 0x200000),
|
||||
FLASH_ID("gd gd25q32c", 0xd8, 0xc7, 0x001640c8, 0x100, 0x10000, 0x400000),
|
||||
FLASH_ID("gd gd25q128c", 0xd8, 0xc7, 0x001840c8, 0x100, 0x10000, 0x1000000),
|
||||
FLASH_ID(NULL, 0, 0, 0, 0, 0, 0)
|
||||
};
|
||||
|
||||
@@ -143,9 +143,8 @@
|
||||
#define FLASH_PSIZE_16 (1 << 8)
|
||||
#define FLASH_PSIZE_32 (2 << 8)
|
||||
#define FLASH_PSIZE_64 (3 << 8)
|
||||
/* The sector number encoding is not straight binary for dual bank flash.
|
||||
* Warning: evaluates the argument multiple times */
|
||||
#define FLASH_SNB(a) ((((a) >= 12) ? 0x10 | ((a) - 12) : (a)) << 3)
|
||||
/* The sector number encoding is not straight binary for dual bank flash. */
|
||||
#define FLASH_SNB(a) ((a) << 3)
|
||||
#define FLASH_LOCK (1 << 31)
|
||||
|
||||
/* FLASH_SR register bits */
|
||||
@@ -489,6 +488,7 @@ static int stm32x_protect_check(struct flash_bank *bank)
|
||||
|
||||
static int stm32x_erase(struct flash_bank *bank, int first, int last)
|
||||
{
|
||||
struct stm32x_flash_bank *stm32x_info = bank->driver_priv;
|
||||
struct target *target = bank->target;
|
||||
int i;
|
||||
|
||||
@@ -516,8 +516,14 @@ static int stm32x_erase(struct flash_bank *bank, int first, int last)
|
||||
*/
|
||||
|
||||
for (i = first; i <= last; i++) {
|
||||
int snb;
|
||||
if (stm32x_info->has_large_mem && i >= 12)
|
||||
snb = (i - 12) | 0x10;
|
||||
else
|
||||
snb = i;
|
||||
|
||||
retval = target_write_u32(target,
|
||||
stm32x_get_flash_reg(bank, STM32_FLASH_CR), FLASH_SER | FLASH_SNB(i) | FLASH_STRT);
|
||||
stm32x_get_flash_reg(bank, STM32_FLASH_CR), FLASH_SER | FLASH_SNB(snb) | FLASH_STRT);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
@@ -1047,7 +1053,8 @@ static int stm32x_probe(struct flash_bank *bank)
|
||||
if (device_id == 0x451) {
|
||||
for (i = 0; i < num_prot_blocks; i++) {
|
||||
bank->prot_blocks[i].offset = bank->sectors[i << 1].offset;
|
||||
bank->prot_blocks[i].size = bank->sectors[i << 1].size << 1;
|
||||
bank->prot_blocks[i].size = bank->sectors[i << 1].size
|
||||
+ bank->sectors[(i << 1) + 1].size;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -726,16 +726,13 @@ reset_pg_and_lock:
|
||||
|
||||
static int stm32lx_read_id_code(struct target *target, uint32_t *id)
|
||||
{
|
||||
/* read stm32 device id register */
|
||||
int retval = target_read_u32(target, DBGMCU_IDCODE, id);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
/* STM32L0 parts will have 0 there, try reading the L0's location for
|
||||
* DBG_IDCODE in case this is an L0 part. */
|
||||
if (*id == 0)
|
||||
struct armv7m_common *armv7m = target_to_armv7m(target);
|
||||
int retval;
|
||||
if (armv7m->arm.is_armv6m == true)
|
||||
retval = target_read_u32(target, DBGMCU_IDCODE_L0, id);
|
||||
|
||||
else
|
||||
/* read stm32 device id register */
|
||||
retval = target_read_u32(target, DBGMCU_IDCODE, id);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -931,13 +931,13 @@ static int xmc4xxx_get_info_command(struct flash_bank *bank, char *buf, int buf_
|
||||
|
||||
/* If OTP Write protection is enabled (User 2), list each
|
||||
* sector that has it enabled */
|
||||
char otp_str[8];
|
||||
char otp_str[14];
|
||||
if (otp_enabled) {
|
||||
strcat(prot_str, "\nOTP Protection is enabled for sectors:\n");
|
||||
for (int i = 0; i < bank->num_sectors; i++) {
|
||||
if (fb->write_prot_otp[i]) {
|
||||
snprintf(otp_str, sizeof(otp_str), "- %d\n", i);
|
||||
strncat(prot_str, otp_str, ARRAY_SIZE(otp_str));
|
||||
strncat(prot_str, otp_str, sizeof(prot_str) - strlen(prot_str) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user