17 #define FLASH_DRIVER_VER            0x00010000 
   18 #define CHIPID_ADDR                 0xF0000000 
   19 #define K1921VK01T_ID               0x00000000 
   26 #define MAIN_MEM_TYPE               0 
   27 #define INFO_MEM_TYPE               1 
   28 #define SERVICE_MODE_ERASE_ADDR     0x80030164 
   29 #define MAGIC_KEY                   0xA442 
   32 #define BOOTFLASH_BASE              0xA001C000 
   33 #define FMA                         (BOOTFLASH_BASE + 0x00) 
   34 #define FMD1                        (BOOTFLASH_BASE + 0x04) 
   35 #define FMC                         (BOOTFLASH_BASE + 0x08) 
   36 #define FCIS                        (BOOTFLASH_BASE + 0x0C) 
   37 #define FCIM                        (BOOTFLASH_BASE + 0x10) 
   38 #define FCIC                        (BOOTFLASH_BASE + 0x14) 
   39 #define FMD2                        (BOOTFLASH_BASE + 0x50) 
   40 #define FMD3                        (BOOTFLASH_BASE + 0x54) 
   41 #define FMD4                        (BOOTFLASH_BASE + 0x58) 
   45 #define FMC_WRITE                   (1<<0)               
   46 #define FMC_PAGE_ERASE              (1<<1)               
   47 #define FMC_FULL_ERASE              (1<<2)               
   48 #define FMC_WRITE_IFB               (1<<4)               
   49 #define FMC_PAGEERASE_IFB           (1<<5)               
   50 #define FMC_MAGIC_KEY               (MAGIC_KEY<<16)      
   53 #define FCIS_OP_CMLT                (1<<0)               
   54 #define FCIS_OP_ERROR               (1<<1)               
   57 #define FCIC_CLR_OPCMLT             (1<<0)               
   58 #define FCIC_CLR_OPERROR            (1<<1)               
   61 #define USERFLASH_PAGE_SIZE         256 
   62 #define USERFLASH_PAGE_TOTALNUM     256 
   64 #define USERFLASH_BASE              0xA0022000 
   65 #define UFMA                        (USERFLASH_BASE + 0x00) 
   66 #define UFMD                        (USERFLASH_BASE + 0x04) 
   67 #define UFMC                        (USERFLASH_BASE + 0x08) 
   68 #define UFCIS                       (USERFLASH_BASE + 0x0C) 
   69 #define UFCIM                       (USERFLASH_BASE + 0x10) 
   70 #define UFCIC                       (USERFLASH_BASE + 0x14) 
   73 #define UFMC_WRITE                  (1<<0)               
   74 #define UFMC_PAGE_ERASE             (1<<1)               
   75 #define UFMC_FULL_ERASE             (1<<2)               
   76 #define UFMC_READ                   (1<<3)               
   77 #define UFMC_WRITE_IFB              (1<<4)               
   78 #define UFMC_PAGEERASE_IFB          (1<<5)               
   79 #define UFMC_READ_IFB               (1<<6)               
   80 #define UFMC_MAGIC_KEY              (MAGIC_KEY<<16)      
   83 #define UFCIS_OP_CMLT               (1<<0)               
   84 #define UFCIS_OP_ERROR              (1<<1)               
   87 #define UFCIC_CLR_OPCMLT            (1<<0)               
   88 #define UFCIC_CLR_OPERROR           (1<<1)               
   91 #define INFOWORD0_ADDR              0x00 
   92 #define INFOWORD0_BOOTFROM_IFB      (1<<0)               
   93 #define INFOWORD0_EN_GPIO           (1<<1)               
   94 #define INFOWORD0_BOOTFROM_IFB_POS  0 
   95 #define INFOWORD0_EN_GPIO_POS       1 
   96 #define INFOWORD0_EXTMEM_SEL_POS    3                    
   98 #define INFOWORD1_ADDR              0x01 
   99 #define INFOWORD1_PINNUM_POS        0                    
  100 #define INFOWORD1_PORTNUM_POS       4                    
  102 #define INFOWORD2_ADDR              0x02 
  103 #define INFOWORD2_LOCK_IFB_BF       (1<<0)               
  105 #define INFOWORD3_ADDR              0x03 
  106 #define INFOWORD3_LOCK_IFB_UF       (1<<0)               
  108 #define BF_LOCK_ADDR                0x40 
  109 #define UF_LOCK_ADDR                0x80 
  148     uint32_t flash_status;
 
  153     while (flash_status == 0x00) {
 
  158             LOG_ERROR(
"Bootflash operation timeout");
 
  185     uint32_t uflash_status;
 
  190     while (uflash_status == 0x00) {
 
  195             LOG_ERROR(
"Userflash operation timeout");
 
  234     for (i = first; i < last; i++) {
 
  270     for (i = first; i < last; i++) {
 
  323         int set, 
unsigned int first, 
unsigned int last)
 
  352         for (
unsigned int i = first; i <= last; i++) {
 
  353             uint32_t reg_num = i/8;
 
  354             uint32_t bit_num = i%8;
 
  392     uint32_t uflash_addr;
 
  394     uint32_t uflash_data;
 
  396     if (strcmp(
"info", 
CMD_ARGV[0]) == 0)
 
  398     else if (strcmp(
"main", 
CMD_ARGV[0]) == 0)
 
  419                         "address = 0x%04" PRIx32 
",\n" 
  420                         "value   = 0x%02" PRIx32 
".", 
CMD_ARGV[0], uflash_addr, uflash_data);
 
  444     uint32_t uflash_addr;
 
  445     uint32_t uflash_data;
 
  448     if (strcmp(
"info", 
CMD_ARGV[0]) == 0)
 
  450     else if (strcmp(
"main", 
CMD_ARGV[0]) == 0)
 
  461                        "address = 0x%04" PRIx32 
",\n" 
  462                        "value   = 0x%02" PRIx32 
".\n" 
  463                        "Please wait ... ", 
CMD_ARGV[0], uflash_addr, uflash_data);
 
  496     uint32_t uflash_addr = 0;
 
  497     uint32_t uflash_data = 0xFF;
 
  538     unsigned int first, last;
 
  541     if (strcmp(
"info", 
CMD_ARGV[0]) == 0)
 
  543     else if (strcmp(
"main", 
CMD_ARGV[0]) == 0)
 
  550     for (
unsigned int i = first; i <= last; i++) {
 
  582     if (strcmp(
"info", 
CMD_ARGV[0]) == 0)
 
  584     else if (strcmp(
"main", 
CMD_ARGV[0]) == 0)
 
  590     uint32_t uflash_addr;
 
  592     uint32_t uflash_data;
 
  636             for (j = 0; j < 8; j++) {
 
  637                 if (uflash_data & 0x1)
 
  638                     command_print(
CMD, 
"Userflash sector #%03d: 0x%04x (0x100) is not protected!",
 
  643                 uflash_data = uflash_data >> 1;
 
  673     if (strcmp(
"info", 
CMD_ARGV[0]) == 0)
 
  675     else if (strcmp(
"main", 
CMD_ARGV[0]) == 0)
 
  680     unsigned int first, last;
 
  685     if (strcmp(
"on", 
CMD_ARGV[3]) == 0) {
 
  686         command_print(
CMD, 
"Try to enable %s userflash sectors %u through %u protection. Please wait ... ",
 
  689     } 
else if (strcmp(
"off", 
CMD_ARGV[3]) == 0) {
 
  690         command_print(
CMD, 
"Try to disable %s userflash sectors %u through %u protection. Please wait ... ",
 
  725     if (strcmp(
"on", 
CMD_ARGV[0]) == 0) {
 
  726         command_print(
CMD, 
"Try to enable bootflash info region remap. Please wait ...");
 
  728     } 
else if (strcmp(
"off", 
CMD_ARGV[0]) == 0) {
 
  729         command_print(
CMD, 
"Try to disable bootflash info region remap. Please wait ...");
 
  775     if (strcmp(
"gpioa", 
CMD_ARGV[0]) == 0)
 
  777     else if (strcmp(
"gpiob", 
CMD_ARGV[0]) == 0)
 
  779     else if (strcmp(
"gpioc", 
CMD_ARGV[0]) == 0)
 
  781     else if (strcmp(
"gpiod", 
CMD_ARGV[0]) == 0)
 
  783     else if (strcmp(
"gpioe", 
CMD_ARGV[0]) == 0)
 
  785     else if (strcmp(
"gpiof", 
CMD_ARGV[0]) == 0)
 
  787     else if (strcmp(
"gpiog", 
CMD_ARGV[0]) == 0)
 
  789     else if (strcmp(
"gpioh", 
CMD_ARGV[0]) == 0)
 
  800     if (strcmp(
"func1", 
CMD_ARGV[2]) == 0)
 
  802     else if (strcmp(
"func3", 
CMD_ARGV[2]) == 0)
 
  853     if (strcmp(
"on", 
CMD_ARGV[0]) == 0) {
 
  854         command_print(
CMD, 
"Try to enable boot from external memory. Please wait ...");
 
  856     } 
else if (strcmp(
"off", 
CMD_ARGV[0]) == 0) {
 
  857         command_print(
CMD, 
"Try to disable boot from external memory. Please wait ...");
 
  933                            "author: Bogdan Kolbov\n" 
  934                            "mail: kolbov@niiet.ru",
 
  943         .
name = 
"uflash_read_byte",
 
  944         .handler = niietcm4_handle_uflash_read_byte_command,
 
  946         .usage = 
"bank_id ('main'|'info') address",
 
  947         .help = 
"Read byte from main or info userflash region",
 
  950         .name = 
"uflash_write_byte",
 
  951         .handler = niietcm4_handle_uflash_write_byte_command,
 
  953         .usage = 
"bank_id ('main'|'info') address value",
 
  954         .help = 
"Write byte to main or info userflash region",
 
  957         .name = 
"uflash_full_erase",
 
  958         .handler = niietcm4_handle_uflash_full_erase_command,
 
  961         .help = 
"Erase all userflash including info region",
 
  964         .name = 
"uflash_erase",
 
  965         .handler = niietcm4_handle_uflash_erase_command,
 
  967         .usage = 
"bank_id ('main'|'info') first_sector_num last_sector_num",
 
  968         .help = 
"Erase sectors of main or info userflash region, starting at sector first up to and including last.",
 
  971         .name = 
"uflash_protect_check",
 
  972         .handler = niietcm4_handle_uflash_protect_check_command,
 
  974         .usage = 
"bank_id ('main'|'info')",
 
  975         .help = 
"Check sectors protect.",
 
  978         .name = 
"uflash_protect",
 
  979         .handler = niietcm4_handle_uflash_protect_command,
 
  981         .usage = 
"bank_id ('main'|'info') first_sector_num last_sector_num ('on'|'off')",
 
  982         .help = 
"Protect sectors of main or info userflash region, starting at sector first up to and including last.",
 
  985         .name = 
"bflash_info_remap",
 
  986         .handler = niietcm4_handle_bflash_info_remap_command,
 
  988         .usage = 
"bank_id ('on'|'off')",
 
  989         .help = 
"Enable remapping bootflash info region to 0x00000000 (or 0x40000000 if external memory boot used).",
 
  992         .name = 
"extmem_cfg",
 
  993         .handler = niietcm4_handle_extmem_cfg_command,
 
  995         .usage = 
"bank_id ('gpioa'|'gpiob'|'gpioc'|'gpiod'|'gpioe'|'gpiof'|'gpiog'|'gpioh') pin_num ('func1'|'func3')",
 
  996         .help = 
"Configure external memory interface for boot.",
 
  999         .name = 
"extmem_boot",
 
 1000         .handler = niietcm4_handle_extmem_boot_command,
 
 1002         .usage = 
"bank_id ('on'|'off')",
 
 1003         .help = 
"Enable boot from external memory.",
 
 1006         .name = 
"service_mode_erase",
 
 1007         .handler = niietcm4_handle_service_mode_erase_command,
 
 1010         .help = 
"Perform emergency erase of all flash (bootflash and userflash).",
 
 1013         .name = 
"driver_info",
 
 1014         .handler = niietcm4_handle_driver_info_command,
 
 1017         .help = 
"Show information about flash driver.",
 
 1026         .help = 
"niietcm4 flash command group",
 
 1047     bank->driver_priv = niietcm4_info;
 
 1050     niietcm4_info->
probed = 
false;
 
 1051     niietcm4_info->
chipid = 0;
 
 1074     uint32_t uflash_addr;
 
 1075     uint32_t uflash_cmd;
 
 1076     uint32_t uflash_data;
 
 1100         bank->sectors[0].is_protected = set;
 
 1104         for (
unsigned int i = 0; i < 
bank->num_sectors/8; i++) {
 
 1120             for (
int j = 0; j < 8; j++) {
 
 1121                 if (uflash_data & 0x1)
 
 1125                 bank->sectors[i*8+j].is_protected = set;
 
 1126                 uflash_data = uflash_data >> 1;
 
 1168     if ((first == 0) && (last == (
bank->num_sectors - 1))) {
 
 1174     uint32_t flash_cmd, flash_addr;
 
 1182     for (
unsigned int i = first; i <= last; i++) {
 
 1204         unsigned int first, 
unsigned int last)
 
 1244         for (
unsigned int i = first; i <= last; i++)    {
 
 1245             uint32_t reg_num = i/8;
 
 1246             uint32_t bit_num = i%8;
 
 1279     static const uint8_t niietcm4_flash_write_code[] = {
 
 1280         0x14, 0x4f, 0x16, 0x68, 0x00, 0x2e, 0x23, 0xd0, 0x55, 0x68, 0xb5, 0x42, 0xf9, 0xd0, 0x2e, 0x68,
 
 1281         0x7e, 0x60, 0x04, 0x35, 0x2e, 0x68, 0x3e, 0x65, 0x04, 0x35, 0x2e, 0x68, 0x7e, 0x65, 0x04, 0x35,
 
 1282         0x2e, 0x68, 0xbe, 0x65, 0x04, 0x35, 0x3c, 0x60, 0x10, 0x34, 0xb8, 0x60, 0xfe, 0x68, 0x00, 0x2e,
 
 1283         0xfc, 0xd0, 0x02, 0x2e, 0x0a, 0xd0, 0x01, 0x26, 0x7e, 0x61, 0x9d, 0x42, 0x01, 0xd3, 0x15, 0x46,
 
 1284         0x08, 0x35, 0x55, 0x60, 0x01, 0x39, 0x00, 0x29, 0x02, 0xd0, 0xda, 0xe7, 0x00, 0x20, 0x50, 0x60,
 
 1285         0x30, 0x46, 0x00, 0xbe, 0x00, 0xc0, 0x01, 0xa0
 
 1291         LOG_WARNING(
"no working area available, can't do block memory writes");
 
 1296             sizeof(niietcm4_flash_write_code), niietcm4_flash_write_code);
 
 1310             LOG_WARNING(
"no large enough working area available, can't do block memory writes");
 
 1327     buf_set_u32(reg_params[0].value, 0, 32, flash_cmd);
 
 1344         LOG_ERROR(
"flash write failed at address 0x%"PRIx32,
 
 1364     uint8_t *new_buffer = 
NULL;
 
 1372         LOG_ERROR(
"offset 0x%" PRIx32 
" breaks required 4-word alignment", 
offset);
 
 1381     int rem = 
count % 16;
 
 1383         new_buffer = malloc(
count + 16 - rem);
 
 1385             LOG_ERROR(
"Odd number of words to write and no memory for padding buffer");
 
 1388         LOG_INFO(
"Odd number of words to write, padding with 0xFFFFFFFF");
 
 1391             new_buffer[
count++] = 0xff;
 
 1400     uint32_t flash_addr, flash_cmd, flash_data;
 
 1405         LOG_WARNING(
"Can't use block writes, falling back to single memory accesses");
 
 1415         for (
unsigned int i = 0; i < 
count; i += 16) {
 
 1425             memcpy(&value, 
buffer + i*16, 4*
sizeof(uint32_t));
 
 1428             flash_data = value[0];
 
 1432             flash_data = value[1];
 
 1436             flash_data = value[2];
 
 1440             flash_data = value[3];
 
 1469     niietcm4_info->
chip_name = 
"K1921VK01T";
 
 1472     uint32_t service_mode;
 
 1476     service_mode = (service_mode>>2) & 0x1;
 
 1478     if (!service_mode) {
 
 1485         uint32_t uflash_data[2];
 
 1487         for (
int i = 0; i < 2; i++) {
 
 1513         if (extmem_sel == 0x2)
 
 1519         else if (portnum == 0x1)
 
 1521         else if (portnum == 0x2)
 
 1523         else if (portnum == 0x3)
 
 1525         else if (portnum == 0x4)
 
 1527         else if (portnum == 0x5)
 
 1529         else if (portnum == 0x6)
 
 1531         else if (portnum == 0x7)
 
 1542         uint32_t extmem_boot_port_data;
 
 1546         int extmem_boot_pin_data = (extmem_boot_port_data>>pinnum) & 0x1;
 
 1548         uint32_t extmem_base;
 
 1549         uint32_t bflash_base;
 
 1550         if (extmem_boot_pin_data && niietcm4_info->
extmem_boot) {
 
 1551             extmem_base = 0x00000000;
 
 1552             bflash_base = 0x40000000;
 
 1554             extmem_base = 0x40000000;
 
 1555             bflash_base = 0x00000000;
 
 1558         uint32_t bflash_size = 0x100000;
 
 1559         uint32_t bflash_pages = 128;
 
 1560         uint32_t bflash_info_size = 0x2000;
 
 1561         uint32_t bflash_info_pages = 1;
 
 1563             bflash_base += 0x2000;
 
 1564             bflash_size -= 0x2000;
 
 1566             bank->size = bflash_info_size;
 
 1567             bank->num_sectors = bflash_info_pages;
 
 1569             bank->size = bflash_size;
 
 1570             bank->num_sectors = bflash_pages;
 
 1573         char info_bootflash_addr_str[64];
 
 1575             snprintf(info_bootflash_addr_str, 
sizeof(info_bootflash_addr_str),
 
 1578             snprintf(info_bootflash_addr_str, 
sizeof(info_bootflash_addr_str),
 
 1579                     "not mapped to global address space");
 
 1584                 "MEMORY CONFIGURATION\n" 
 1586                 "    %" PRIu32 
" kB total\n" 
 1587                 "    %" PRIu32 
" pages %" PRIu32 
" kB each\n" 
 1588                 "    0x%08" PRIx32 
" base address\n" 
 1590                 "Info bootflash :\n" 
 1591                 "    %" PRIu32 
" kB total\n" 
 1592                 "    %" PRIu32 
" pages %" PRIu32 
" kB each\n" 
 1596                 "    %" PRIu32 
" kB total\n" 
 1597                 "    %" PRIu32 
" pages %" PRIu32 
" B each\n" 
 1598                 "    %" PRIu32 
" bit cells\n" 
 1599                 "    not mapped to global address space\n" 
 1600                 "Info userflash :\n" 
 1601                 "    %" PRIu32 
" B total\n" 
 1602                 "    %" PRIu32 
" pages of %" PRIu32 
" B each\n" 
 1603                 "    %" PRIu32 
" bit cells\n" 
 1604                 "    not mapped to global address space\n" 
 1607                 "    0x20000000 base address\n" 
 1608                 "External memory :\n" 
 1609                 "    8/16 bit address space\n" 
 1610                 "    0x%08" PRIx32 
" base address\n" 
 1613                 "Bootflash info region remap :\n" 
 1615                 "External memory boot port :\n" 
 1617                 "External memory boot pin :\n" 
 1619                 "External memory interface alternative function :\n" 
 1621                 "Option boot from external memory :\n" 
 1625                 (bflash_size/bflash_pages)/1024,
 
 1627                 niietcm4_info->
bflash_info_remap ? 
"" : 
"    this flash will be used for debugging, writing and etc\n",
 
 1628                 bflash_info_size/1024,
 
 1630                 (bflash_info_size/bflash_info_pages)/1024,
 
 1631                 info_bootflash_addr_str,
 
 1632                 niietcm4_info->
bflash_info_remap ? 
"    this flash will be used for debugging, writing and etc\n" : 
"",
 
 1646                 niietcm4_info->
extmem_boot ? 
"enable" : 
"disable");
 
 1648         bank->size = 0x100000;
 
 1649         bank->num_sectors = 128;
 
 1653                 "H[2] was HIGH while startup. Device entered service mode.\n" 
 1654                 "All flashes were locked.\n" 
 1655                 "If you want to perform emergency erase (erase all flashes),\n" 
 1656                 "please use \"service_mode_erase\" command and reset device.\n" 
 1657                 "Do not forget to pull H[2] down while reset for returning to normal operation mode.\n" 
 1669     free(
bank->sectors);
 
 1678         LOG_INFO(
"unknown chipid, assuming K1921VK01T");
 
 1684     int page_total = 
bank->num_sectors;
 
 1689     for (
int i = 0; i < page_total; i++) {
 
 1692         bank->sectors[i].is_erased = -1;
 
 1693         bank->sectors[i].is_protected = -1;
 
 1696     niietcm4_info->
probed = 
true;
 
 1704     if (niietcm4_info->
probed)
 
 1720     .usage = 
"flash bank <name> niietcm4 <base> <size> 0 0 <target#>",
 
 1722     .flash_bank_command = niietcm4_flash_bank_command,
 
void init_reg_param(struct reg_param *param, const char *reg_name, uint32_t size, enum param_direction direction)
 
void destroy_reg_param(struct reg_param *param)
 
#define ARMV7M_COMMON_MAGIC
 
Support functions to access arbitrary bits in a byte array.
 
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
 
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
 
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
 
void command_print(struct command_invocation *cmd, const char *format,...)
 
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
 
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
 
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
 
#define ERROR_COMMAND_SYNTAX_ERROR
 
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
 
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
 
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
 
uint64_t buffer
Pointer to data buffer to send over SPI.
 
uint32_t page_size
Page size.
 
uint32_t buffer_size
Size of dw_spi_program::buffer.
 
uint32_t address
Starting address. Sector aligned.
 
#define ERROR_FLASH_OPERATION_FAILED
 
#define ERROR_FLASH_DST_BREAKS_ALIGNMENT
 
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
 
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
 
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
 
void busy_sleep(uint64_t ms)
 
#define LOG_WARNING(expr ...)
 
#define LOG_ERROR(expr ...)
 
#define LOG_INFO(expr ...)
 
static int niietcm4_mass_erase(struct flash_bank *bank)
 
#define INFOWORD2_LOCK_IFB_BF
 
static const struct command_registration niietcm4_command_handlers[]
 
#define INFOWORD1_PINNUM_POS
 
static int niietcm4_uflash_page_erase(struct flash_bank *bank, int page_num, int mem_type)
Erase one page of userflash info or main region.
 
#define INFOWORD0_BOOTFROM_IFB_POS
 
#define USERFLASH_PAGE_TOTALNUM
 
static int get_niietcm4_info(struct flash_bank *bank, struct command_invocation *cmd)
 
#define UFMC_PAGEERASE_IFB
 
FLASH_BANK_COMMAND_HANDLER(niietcm4_flash_bank_command)
 
const struct flash_driver niietcm4_flash
 
#define INFOWORD1_PORTNUM_POS
 
static int niietcm4_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int niietcm4_probe(struct flash_bank *bank)
 
static int niietcm4_uflash_protect(struct flash_bank *bank, int mem_type, int set, unsigned int first, unsigned int last)
Enable or disable protection of userflash pages.
 
static int niietcm4_dump_uflash_page(struct flash_bank *bank, uint32_t *dump, int page_num, int mem_type)
Dump page of userflash region.
 
static int niietcm4_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
#define SERVICE_MODE_ERASE_ADDR
 
COMMAND_HANDLER(niietcm4_handle_uflash_read_byte_command)
 
static int niietcm4_opstatus_check(struct flash_bank *bank)
Wait while operation with bootflash being performed and check result status.
 
#define INFOWORD0_BOOTFROM_IFB
 
#define INFOWORD0_EN_GPIO_POS
 
#define INFOWORD0_EXTMEM_SEL_POS
 
static int niietcm4_protect_check(struct flash_bank *bank)
 
static int niietcm4_write_block(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
#define FMC_PAGEERASE_IFB
 
static int niietcm4_auto_probe(struct flash_bank *bank)
 
static int niietcm4_probe_k1921vk01t(struct flash_bank *bank)
 
#define USERFLASH_PAGE_SIZE
 
static int niietcm4_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
 
static const struct command_registration niietcm4_exec_command_handlers[]
 
static int niietcm4_load_uflash_page(struct flash_bank *bank, uint32_t *dump, int page_num, int mem_type)
Load modified page dump to userflash region page.
 
#define INFOWORD0_EN_GPIO
 
#define INFOWORD3_LOCK_IFB_UF
 
#define UFCIC_CLR_OPERROR
 
static int niietcm4_uopstatus_check(struct flash_bank *bank)
Wait while operation with userflash being performed and check result status.
 
unsigned int common_magic
 
When run_command is called, a new instance will be created on the stack, filled with the proper value...
 
Provides details of a flash bank, available either on-chip or through a major interface.
 
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
 
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
 
Describes the geometry and status of a single flash sector within a flash bank.
 
Private data for flash driver.
 
uint32_t extmem_boot_altfunc
 
uint32_t uflash_info_pagetotal
 
uint32_t uflash_info_size
 
uint32_t uflash_pagetotal
 
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
 
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
 
int target_free_working_area(struct target *target, struct working_area *area)
Free a working area.
 
int target_alloc_working_area_try(struct target *target, uint32_t size, struct working_area **area)
 
int target_run_flash_async_algorithm(struct target *target, const uint8_t *buffer, uint32_t count, int block_size, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t buffer_start, uint32_t buffer_size, uint32_t entry_point, uint32_t exit_point, void *arch_info)
Streams data to a circular buffer on target intended for consumption by code running asynchronously o...
 
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
 
#define ERROR_TARGET_NOT_HALTED
 
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE