17 #define W600_FLASH_SECSIZE      0x1000 
   18 #define W600_FLASH_PAGESIZE     0x100 
   19 #define W600_FLASH_BASE         0x08000000 
   20 #define W600_FLASH_PROTECT_SIZE 0x2000 
   24 #define QFLASH_REGBASE          0X40002000 
   25 #define QFLASH_CMD_INFO         (QFLASH_REGBASE + 0) 
   26 #define QFLASH_CMD_START        (QFLASH_REGBASE + 4) 
   27 #define QFLASH_BUFFER           (QFLASH_REGBASE + 0X200) 
   29 #define QFLASH_CMD_READ         (1ul << 14) 
   30 #define QFLASH_CMD_WRITE        0 
   31 #define QFLASH_CMD_ADDR         (1ul << 31) 
   32 #define QFLASH_CMD_DATA         (1ul << 15) 
   33 #define QFLASH_CMD_DATALEN(len) (((len) & 0x3FF) << 16) 
   35 #define QFLASH_CMD_RDID         (QFLASH_CMD_READ | 0x9F) 
   36 #define QFLASH_CMD_WREN         (QFLASH_CMD_WRITE | 0x06) 
   37 #define QFLASH_CMD_WRDI         (QFLASH_CMD_WRITE | 0x04) 
   38 #define QFLASH_CMD_SE           (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 11) | 0x20) 
   39 #define QFLASH_CMD_PP           (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 12) | 0x02) 
   41 #define QFLASH_START            (1ul << 28) 
   42 #define QFLASH_ADDR(addr)       (((addr) & 0xFFFFF) << 8) 
   43 #define QFLASH_CRM(crm)         (((crm) & 0xFF) << 0) 
   98     bank->driver_priv = w600_info;
 
  110     if (!w600_info->
param)
 
  157                 LOG_ERROR(
"timed out waiting for flash");
 
  206         LOG_ERROR(
"can not erase protected area");
 
  210     for (
unsigned int i = first; i <= last; i++) {
 
  232         LOG_WARNING(
"offset 0x%" PRIx32 
" breaks required %d-byte alignment",
 
  238         LOG_WARNING(
"count 0x%" PRIx32 
" breaks required %d-byte alignment",
 
  279     w600_info->
probed = 
false;
 
  286     LOG_INFO(
"flash_id id = 0x%08" PRIx32 
"", flash_id);
 
  287     w600_info->
id = flash_id;
 
  295     if (!w600_info->
param) {
 
  296         LOG_ERROR(
"flash_id not supported for w600");
 
  303         LOG_INFO(
"ignoring flash probed value, using configured bank size");
 
  306         flash_size = ((flash_id & 0xFFFFFF) >> 16) & 0xFF;
 
  307         if ((flash_size != 0x14) && (flash_size != 0x13)) {
 
  308             LOG_ERROR(
"w600 flash size failed, probe inaccurate");
 
  312         flash_size = 1 << flash_size;
 
  315     LOG_INFO(
"flash size = %" PRIu32 
" KiB", flash_size / 1024);
 
  321     assert(num_pages > 0);
 
  328     bank->num_sectors = num_pages;
 
  333     for (i = 0; i < num_pages; i++) {
 
  336         bank->sectors[i].is_erased = -1;
 
  369     .flash_bank_command = w600_flash_bank_command,
 
Support functions to access arbitrary bits in a byte array.
 
void command_print_sameline(struct command_invocation *cmd, const char *format,...)
 
#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 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 alive_sleep(uint64_t ms)
 
#define LOG_WARNING(expr ...)
 
#define LOG_ERROR(expr ...)
 
#define LOG_INFO(expr ...)
 
#define LOG_DEBUG(expr ...)
 
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.
 
const struct w600_flash_param * param
 
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
 
int target_read_u32(struct target *target, target_addr_t address, uint32_t *value)
 
#define ERROR_TARGET_NOT_HALTED
 
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
 
#define QFLASH_ADDR(addr)
 
static int w600_start_do(struct flash_bank *bank, uint32_t cmd, uint32_t addr, uint32_t len, int timeout)
 
#define QFLASH_CMD_DATALEN(len)
 
static int w600_write_enable(struct flash_bank *bank)
 
static int w600_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int w600_write_disable(struct flash_bank *bank)
 
static int w600_get_delay(struct flash_bank *bank, uint32_t cmd)
 
static int w600_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int w600_start(struct flash_bank *bank, uint32_t cmd, uint32_t addr, uint32_t len)
 
FLASH_BANK_COMMAND_HANDLER(w600_flash_bank_command)
 
static const struct w600_flash_param w600_param[]
 
static int w600_get_flash_id(struct flash_bank *bank, uint32_t *flash_id)
 
#define W600_FLASH_PAGESIZE
 
static int w600_probe(struct flash_bank *bank)
 
#define W600_FLASH_SECSIZE
 
static int w600_auto_probe(struct flash_bank *bank)
 
const struct flash_driver w600_flash
 
static int get_w600_info(struct flash_bank *bank, struct command_invocation *cmd)
 
#define W600_FLASH_PROTECT_SIZE