flash: declare fixed arrays const
Change-Id: Id06b8b53ec59a7b3182f60f51dde5b16563aaeef Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1887 Tested-by: jenkins__archive__
parent
facd0e7827
commit
32c4c18045
|
@ -6,7 +6,7 @@
|
||||||
$comment = "// Autogenerated by contrib/gen-stellaris-part-header.pl
|
$comment = "// Autogenerated by contrib/gen-stellaris-part-header.pl
|
||||||
// From Stellaris Firmware Development Package revision";
|
// From Stellaris Firmware Development Package revision";
|
||||||
|
|
||||||
$struct_header = "static struct {
|
$struct_header = "static const struct {
|
||||||
uint8_t class;
|
uint8_t class;
|
||||||
uint8_t partno;
|
uint8_t partno;
|
||||||
const char *partname;
|
const char *partname;
|
||||||
|
|
|
@ -52,10 +52,10 @@ extern int nand_correct_data(struct nand_device *nand, u_char *dat,
|
||||||
#define SPARE_OFFS 0x140
|
#define SPARE_OFFS 0x140
|
||||||
#define DATA_OFFS 0x200
|
#define DATA_OFFS 0x200
|
||||||
|
|
||||||
static int sp_ooblayout[] = {
|
static const int sp_ooblayout[] = {
|
||||||
10, 11, 12, 13, 14, 15
|
10, 11, 12, 13, 14, 15
|
||||||
};
|
};
|
||||||
static int lp_ooblayout[] = {
|
static const int lp_ooblayout[] = {
|
||||||
40, 41, 42, 43, 44, 45,
|
40, 41, 42, 43, 44, 45,
|
||||||
46, 47, 48, 49, 50, 51,
|
46, 47, 48, 49, 50, 51,
|
||||||
52, 53, 54, 55, 56, 57,
|
52, 53, 54, 55, 56, 57,
|
||||||
|
@ -1148,7 +1148,7 @@ static int lpc32xx_write_page_slc(struct nand_device *nand,
|
||||||
/* Copy to oob, at correct offsets */
|
/* Copy to oob, at correct offsets */
|
||||||
static uint8_t ecc[24];
|
static uint8_t ecc[24];
|
||||||
slc_ecc_copy_to_buffer(ecc, hw_ecc, ecc_count);
|
slc_ecc_copy_to_buffer(ecc, hw_ecc, ecc_count);
|
||||||
int *layout = nand->page_size == 2048 ? lp_ooblayout : sp_ooblayout;
|
const int *layout = nand->page_size == 2048 ? lp_ooblayout : sp_ooblayout;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ecc_count * 3; i++)
|
for (i = 0; i < ecc_count * 3; i++)
|
||||||
foob[layout[i]] = ecc[i];
|
foob[layout[i]] = ecc[i];
|
||||||
|
@ -1549,7 +1549,7 @@ static int lpc32xx_read_page_slc(struct nand_device *nand,
|
||||||
slc_ecc_copy_to_buffer(ecc, hw_ecc, ecc_count);
|
slc_ecc_copy_to_buffer(ecc, hw_ecc, ecc_count);
|
||||||
/* Copy ECC from flash using correct layout */
|
/* Copy ECC from flash using correct layout */
|
||||||
static uint8_t fecc[24];/* max size */
|
static uint8_t fecc[24];/* max size */
|
||||||
int *layout = nand->page_size == 2048 ? lp_ooblayout : sp_ooblayout;
|
const int *layout = nand->page_size == 2048 ? lp_ooblayout : sp_ooblayout;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ecc_count * 3; i++)
|
for (i = 0; i < ecc_count * 3; i++)
|
||||||
fecc[i] = foob[layout[i]];
|
fecc[i] = foob[layout[i]];
|
||||||
|
|
|
@ -82,7 +82,7 @@ struct sam4l_chip_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* These are taken from Table 9-1 in 42023E-SAM-07/2013 */
|
/* These are taken from Table 9-1 in 42023E-SAM-07/2013 */
|
||||||
static struct sam4l_chip_info sam4l_known_chips[] = {
|
static const struct sam4l_chip_info sam4l_known_chips[] = {
|
||||||
{ 0xAB0B0AE0, 0x1400000F, "ATSAM4LC8C" },
|
{ 0xAB0B0AE0, 0x1400000F, "ATSAM4LC8C" },
|
||||||
{ 0xAB0A09E0, 0x0400000F, "ATSAM4LC4C" },
|
{ 0xAB0A09E0, 0x0400000F, "ATSAM4LC4C" },
|
||||||
{ 0xAB0A07E0, 0x0400000F, "ATSAM4LC2C" },
|
{ 0xAB0A07E0, 0x0400000F, "ATSAM4LC2C" },
|
||||||
|
@ -104,13 +104,13 @@ static struct sam4l_chip_info sam4l_known_chips[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Meaning of SRAMSIZ field in CHIPID, see 9.3.1 in 42023E-SAM-07/2013 */
|
/* Meaning of SRAMSIZ field in CHIPID, see 9.3.1 in 42023E-SAM-07/2013 */
|
||||||
static uint16_t sam4l_ram_sizes[16] = { 48, 1, 2, 6, 24, 4, 80, 160, 8, 16, 32, 64, 128, 256, 96, 512 };
|
static const uint16_t sam4l_ram_sizes[16] = { 48, 1, 2, 6, 24, 4, 80, 160, 8, 16, 32, 64, 128, 256, 96, 512 };
|
||||||
|
|
||||||
/* Meaning of PSZ field in FPR, see 14.10.4 in 42023E-SAM-07/2013 */
|
/* Meaning of PSZ field in FPR, see 14.10.4 in 42023E-SAM-07/2013 */
|
||||||
static const uint16_t sam4l_page_sizes[8] = { 32, 64, 128, 256, 512, 1024, 2048, 4096 };
|
static const uint16_t sam4l_page_sizes[8] = { 32, 64, 128, 256, 512, 1024, 2048, 4096 };
|
||||||
|
|
||||||
struct sam4l_info {
|
struct sam4l_info {
|
||||||
struct sam4l_chip_info *details;
|
const struct sam4l_chip_info *details;
|
||||||
|
|
||||||
uint32_t flash_kb;
|
uint32_t flash_kb;
|
||||||
uint32_t ram_kb;
|
uint32_t ram_kb;
|
||||||
|
@ -230,7 +230,7 @@ FLASH_BANK_COMMAND_HANDLER(sam4l_flash_bank_command)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sam4l_chip_info *sam4l_find_chip_name(uint32_t id, uint32_t exid)
|
static const struct sam4l_chip_info *sam4l_find_chip_name(uint32_t id, uint32_t exid)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
|
@ -106,11 +106,11 @@ static void at91sam7_set_flash_mode(struct flash_bank *bank, int mode);
|
||||||
static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
|
static uint32_t at91sam7_wait_status_busy(struct flash_bank *bank, uint32_t waitbits, int timeout);
|
||||||
static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen);
|
static int at91sam7_flash_command(struct flash_bank *bank, uint8_t cmd, uint16_t pagen);
|
||||||
|
|
||||||
static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
|
static const uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
|
||||||
static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
|
static const uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
|
||||||
static uint32_t MC_FSR[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 };
|
static const uint32_t MC_FSR[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 };
|
||||||
|
|
||||||
static char *EPROC[8] = {
|
static const char *EPROC[8] = {
|
||||||
"Unknown", "ARM946-E", "ARM7TDMI", "Unknown", "ARM920T", "ARM926EJ-S", "Unknown", "Unknown"
|
"Unknown", "ARM946-E", "ARM7TDMI", "Unknown", "ARM920T", "ARM926EJ-S", "Unknown", "Unknown"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct avrf_flash_bank {
|
||||||
int probed;
|
int probed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct avrf_type avft_chips_info[] = {
|
static const struct avrf_type avft_chips_info[] = {
|
||||||
/* name, chip_id, flash_page_size, flash_page_num,
|
/* name, chip_id, flash_page_size, flash_page_num,
|
||||||
* eeprom_page_size, eeprom_page_num
|
* eeprom_page_size, eeprom_page_num
|
||||||
*/
|
*/
|
||||||
|
@ -293,7 +293,7 @@ static int avrf_probe(struct flash_bank *bank)
|
||||||
struct target *target = bank->target;
|
struct target *target = bank->target;
|
||||||
struct avrf_flash_bank *avrf_info = bank->driver_priv;
|
struct avrf_flash_bank *avrf_info = bank->driver_priv;
|
||||||
struct avr_common *avr = target->arch_info;
|
struct avr_common *avr = target->arch_info;
|
||||||
struct avrf_type *avr_info = NULL;
|
const struct avrf_type *avr_info = NULL;
|
||||||
int i;
|
int i;
|
||||||
uint32_t device_id;
|
uint32_t device_id;
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ static int avrf_info(struct flash_bank *bank, char *buf, int buf_size)
|
||||||
{
|
{
|
||||||
struct target *target = bank->target;
|
struct target *target = bank->target;
|
||||||
struct avr_common *avr = target->arch_info;
|
struct avr_common *avr = target->arch_info;
|
||||||
struct avrf_type *avr_info = NULL;
|
const struct avrf_type *avr_info = NULL;
|
||||||
int i;
|
int i;
|
||||||
uint32_t device_id;
|
uint32_t device_id;
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ static int fm3_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||||
/* R4 keeps Flash Sequence address 2 (u32FlashSeq2) */
|
/* R4 keeps Flash Sequence address 2 (u32FlashSeq2) */
|
||||||
/* R5 returns result value (u32FlashResult) */
|
/* R5 returns result value (u32FlashResult) */
|
||||||
|
|
||||||
const uint8_t fm3_flash_write_code[] = {
|
static const uint8_t fm3_flash_write_code[] = {
|
||||||
/* fm3_FLASH_IF->FASZ &= 0xFFFD; */
|
/* fm3_FLASH_IF->FASZ &= 0xFFFD; */
|
||||||
0x5F, 0xF0, 0x80, 0x45, /* MOVS.W R5, #(fm3_FLASH_IF->FASZ) */
|
0x5F, 0xF0, 0x80, 0x45, /* MOVS.W R5, #(fm3_FLASH_IF->FASZ) */
|
||||||
0x2D, 0x68, /* LDR R5, [R5] */
|
0x2D, 0x68, /* LDR R5, [R5] */
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const struct {
|
static const struct {
|
||||||
unsigned pflash_sector_size_bytes;
|
unsigned pflash_sector_size_bytes;
|
||||||
unsigned nvm_sector_size_bytes;
|
unsigned nvm_sector_size_bytes;
|
||||||
unsigned num_blocks;
|
unsigned num_blocks;
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct lpcspifi_flash_bank {
|
||||||
uint32_t ioconfig_base;
|
uint32_t ioconfig_base;
|
||||||
uint32_t bank_num;
|
uint32_t bank_num;
|
||||||
uint32_t max_spi_clock_mhz;
|
uint32_t max_spi_clock_mhz;
|
||||||
struct flash_device *dev;
|
const struct flash_device *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lpcspifi_target {
|
struct lpcspifi_target {
|
||||||
|
@ -63,7 +63,7 @@ struct lpcspifi_target {
|
||||||
uint32_t ioconfig_base; /* base address for the port word pin registers */
|
uint32_t ioconfig_base; /* base address for the port word pin registers */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct lpcspifi_target target_devices[] = {
|
static const struct lpcspifi_target target_devices[] = {
|
||||||
/* name, tap_idcode, spifi_base, ssp_base, io_base, ioconfig_base */
|
/* name, tap_idcode, spifi_base, ssp_base, io_base, ioconfig_base */
|
||||||
{ "LPC43xx/18xx", 0x4ba00477, 0x14000000, 0x40083000, 0x400F4000, 0x40086000 },
|
{ "LPC43xx/18xx", 0x4ba00477, 0x14000000, 0x40083000, 0x400F4000, 0x40086000 },
|
||||||
{ NULL, 0, 0, 0, 0, 0 }
|
{ NULL, 0, 0, 0, 0, 0 }
|
||||||
|
@ -848,7 +848,7 @@ static int lpcspifi_probe(struct flash_bank *bank)
|
||||||
uint32_t ioconfig_base;
|
uint32_t ioconfig_base;
|
||||||
struct flash_sector *sectors;
|
struct flash_sector *sectors;
|
||||||
uint32_t id = 0; /* silence uninitialized warning */
|
uint32_t id = 0; /* silence uninitialized warning */
|
||||||
struct lpcspifi_target *target_device;
|
const struct lpcspifi_target *target_device;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* If we've already probed, we should be fine to skip this time. */
|
/* If we've already probed, we should be fine to skip this time. */
|
||||||
|
@ -886,7 +886,7 @@ static int lpcspifi_probe(struct flash_bank *bank)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
lpcspifi_info->dev = NULL;
|
lpcspifi_info->dev = NULL;
|
||||||
for (struct flash_device *p = flash_devices; p->name ; p++)
|
for (const struct flash_device *p = flash_devices; p->name ; p++)
|
||||||
if (p->device_id == id) {
|
if (p->device_id == id) {
|
||||||
lpcspifi_info->dev = p;
|
lpcspifi_info->dev = p;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
#define LOCK 0x00
|
#define LOCK 0x00
|
||||||
|
|
||||||
/* part structs */
|
/* part structs */
|
||||||
static struct {
|
static const struct {
|
||||||
const char *partname;
|
const char *partname;
|
||||||
uint32_t partno;
|
uint32_t partno;
|
||||||
uint16_t num_page;
|
uint16_t num_page;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
/* Shared table of known SPI flash devices for SPI-based flash drivers. Taken
|
/* Shared table of known SPI flash devices for SPI-based flash drivers. Taken
|
||||||
* from device datasheets and Linux SPI flash drivers. */
|
* from device datasheets and Linux SPI flash drivers. */
|
||||||
struct flash_device flash_devices[] = {
|
const struct flash_device flash_devices[] = {
|
||||||
/* name, erase_cmd, chip_erase_cmd, device_id, pagesize, sectorsize, size_in_bytes */
|
/* 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 m25p05", 0xd8, 0xc7, 0x00102020, 0x80, 0x8000, 0x10000),
|
||||||
FLASH_ID("st m25p10", 0xd8, 0xc7, 0x00112020, 0x80, 0x8000, 0x20000),
|
FLASH_ID("st m25p10", 0xd8, 0xc7, 0x00112020, 0x80, 0x8000, 0x20000),
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct flash_device {
|
||||||
.size_in_bytes = size \
|
.size_in_bytes = size \
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct flash_device flash_devices[];
|
extern const struct flash_device flash_devices[];
|
||||||
|
|
||||||
/* fields in SPI flash status register */
|
/* fields in SPI flash status register */
|
||||||
#define SPIFLASH_BSY_BIT 0x00000001 /* WIP Bit of SPI SR on SMI SR */
|
#define SPIFLASH_BSY_BIT 0x00000001 /* WIP Bit of SPI SR on SMI SR */
|
||||||
|
|
|
@ -125,7 +125,7 @@ struct stellaris_flash_bank {
|
||||||
|
|
||||||
/* Autogenerated by contrib/gen-stellaris-part-header.pl */
|
/* Autogenerated by contrib/gen-stellaris-part-header.pl */
|
||||||
/* From Stellaris Firmware Development Package revision 9453 */
|
/* From Stellaris Firmware Development Package revision 9453 */
|
||||||
static struct {
|
static const struct {
|
||||||
uint8_t class;
|
uint8_t class;
|
||||||
uint8_t partno;
|
uint8_t partno;
|
||||||
const char *partname;
|
const char *partname;
|
||||||
|
@ -417,7 +417,7 @@ static struct {
|
||||||
{0xFF, 0x00, "Unknown Part"}
|
{0xFF, 0x00, "Unknown Part"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *StellarisClassname[7] = {
|
static const char *StellarisClassname[7] = {
|
||||||
"Sandstorm",
|
"Sandstorm",
|
||||||
"Fury",
|
"Fury",
|
||||||
"Unknown",
|
"Unknown",
|
||||||
|
|
|
@ -120,7 +120,7 @@ struct stmsmi_flash_bank {
|
||||||
int probed;
|
int probed;
|
||||||
uint32_t io_base;
|
uint32_t io_base;
|
||||||
uint32_t bank_num;
|
uint32_t bank_num;
|
||||||
struct flash_device *dev;
|
const struct flash_device *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stmsmi_target {
|
struct stmsmi_target {
|
||||||
|
@ -130,7 +130,7 @@ struct stmsmi_target {
|
||||||
uint32_t io_base;
|
uint32_t io_base;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct stmsmi_target target_devices[] = {
|
static const struct stmsmi_target target_devices[] = {
|
||||||
/* name, tap_idcode, smi_base, io_base */
|
/* name, tap_idcode, smi_base, io_base */
|
||||||
{ "SPEAr3xx/6xx", 0x07926041, 0xf8000000, 0xfc000000 },
|
{ "SPEAr3xx/6xx", 0x07926041, 0xf8000000, 0xfc000000 },
|
||||||
{ "STR75x", 0x4f1f0041, 0x80000000, 0x90000000 },
|
{ "STR75x", 0x4f1f0041, 0x80000000, 0x90000000 },
|
||||||
|
@ -529,7 +529,7 @@ static int stmsmi_probe(struct flash_bank *bank)
|
||||||
uint32_t io_base;
|
uint32_t io_base;
|
||||||
struct flash_sector *sectors;
|
struct flash_sector *sectors;
|
||||||
uint32_t id = 0; /* silence uninitialized warning */
|
uint32_t id = 0; /* silence uninitialized warning */
|
||||||
struct stmsmi_target *target_device;
|
const struct stmsmi_target *target_device;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (stmsmi_info->probed)
|
if (stmsmi_info->probed)
|
||||||
|
@ -575,7 +575,7 @@ static int stmsmi_probe(struct flash_bank *bank)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
stmsmi_info->dev = NULL;
|
stmsmi_info->dev = NULL;
|
||||||
for (struct flash_device *p = flash_devices; p->name ; p++)
|
for (const struct flash_device *p = flash_devices; p->name ; p++)
|
||||||
if (p->device_id == id) {
|
if (p->device_id == id) {
|
||||||
stmsmi_info->dev = p;
|
stmsmi_info->dev = p;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -113,7 +113,7 @@ enum str7x_status_codes {
|
||||||
STR7X_BUSY = 11
|
STR7X_BUSY = 11
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct str7x_mem_layout mem_layout_str7bank0[] = {
|
static const struct str7x_mem_layout mem_layout_str7bank0[] = {
|
||||||
{0x00000000, 0x02000, 0x01},
|
{0x00000000, 0x02000, 0x01},
|
||||||
{0x00002000, 0x02000, 0x02},
|
{0x00002000, 0x02000, 0x02},
|
||||||
{0x00004000, 0x02000, 0x04},
|
{0x00004000, 0x02000, 0x04},
|
||||||
|
@ -124,7 +124,7 @@ static struct str7x_mem_layout mem_layout_str7bank0[] = {
|
||||||
{0x00030000, 0x10000, 0x80}
|
{0x00030000, 0x10000, 0x80}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct str7x_mem_layout mem_layout_str7bank1[] = {
|
static const struct str7x_mem_layout mem_layout_str7bank1[] = {
|
||||||
{0x00000000, 0x02000, 0x10000},
|
{0x00000000, 0x02000, 0x10000},
|
||||||
{0x00002000, 0x02000, 0x20000}
|
{0x00002000, 0x02000, 0x20000}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue