return i;
}
-struct flash_bank *get_flash_bank_by_name(const char *name)
+struct flash_bank *get_flash_bank_by_name_noprobe(const char *name)
{
unsigned requested = get_flash_name_index(name);
unsigned found = 0;
return NULL;
}
+struct flash_bank *get_flash_bank_by_name(const char *name)
+{
+ struct flash_bank *bank;
+ int retval;
+
+ bank = get_flash_bank_by_name_noprobe(name);
+ if (bank != NULL)
+ {
+ retval = bank->driver->auto_probe(bank);
+
+ if (retval != ERROR_OK)
+ {
+ LOG_ERROR("auto_probe failed %d\n", retval);
+ return NULL;
+ }
+ }
+
+ return bank;
+}
+
int get_flash_bank_by_num(int num, struct flash_bank **bank)
{
struct flash_bank *p = get_flash_bank_by_num_noprobe(num);
intptr_t diff = (intptr_t)sections[section] - (intptr_t)image->sections;
int t_section_num = diff / sizeof(struct imageection);
- LOG_DEBUG("image_read_section: section = %d, t_section_num = %d, section_offset = %d, buffer_size = %d, size_read = %d",
+ LOG_DEBUG("image_read_section: section = %d, t_section_num = %d, section_offset = %d, buffer_size = %d, size_read = %d",
(int)section,
(int)t_section_num, (int)section_offset, (int)buffer_size, (int)size_read);
if ((retval = image_read_section(image, t_section_num, section_offset,
*/
struct flash_bank *get_flash_bank_by_name(const char *name);
/**
- * Returns a flash bank by the specified flash_bank_s bank_number, @a num.
+ * Returns the flash bank specified by @a name, which matches the
+ * driver name and a suffix (option) specify the driver-specific
+ * bank number. The suffix consists of the '.' and the driver-specific
+ * bank number: when two str9x banks are defined, then 'str9x.1' refers
+ * to the second.
+ */
+struct flash_bank *get_flash_bank_by_name_noprobe(const char *name);
+/**
+ * Returns the flash bank like get_flash_bank_by_name(), without probing.
* @param num The flash bank number.
* @param bank returned bank if fn returns ERROR_OK
* @returns ERROR_OK if successful
}
/* check the flash bank name is unique */
- if (get_flash_bank_by_name(bank_name) != NULL)
+ if (get_flash_bank_by_name_noprobe(bank_name) != NULL)
{
/* flash bank name already exists */
LOG_ERROR("flash bank name '%s' already exists", bank_name);