1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de> *
3 * Copyright (C) 2007,2008 Øyvind Harboe <oyvind.harboe@zylin.com> *
4 * Copyright (C) 2008 by Spencer Oliver <spen@spen-soft.co.uk> *
5 * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
26 #include <helper/time_support.h>
27 #include <target/image.h>
31 * Implements Tcl commands used to access NOR flash facilities.
34 COMMAND_HELPER(flash_command_get_bank
, unsigned name_index
,
35 struct flash_bank
**bank
)
37 const char *name
= CMD_ARGV
[name_index
];
38 int retval
= get_flash_bank_by_name(name
, bank
);
39 if (retval
!= ERROR_OK
)
45 COMMAND_PARSE_NUMBER(uint
, name
, bank_num
);
47 return get_flash_bank_by_num(bank_num
, bank
);
51 COMMAND_HANDLER(handle_flash_info_command
)
58 return ERROR_COMMAND_SYNTAX_ERROR
;
60 retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
61 if (retval
!= ERROR_OK
)
68 /* attempt auto probe */
69 if ((retval
= p
->driver
->auto_probe(p
)) != ERROR_OK
)
72 /* We must query the hardware to avoid printing stale information! */
73 retval
= p
->driver
->protect_check(p
);
74 if (retval
!= ERROR_OK
)
77 command_print(CMD_CTX
,
78 "#%" PRIu32
" : %s at 0x%8.8" PRIx32
", size 0x%8.8" PRIx32
", buswidth %i, chipwidth %i",
85 for (j
= 0; j
< p
->num_sectors
; j
++)
89 if (p
->sectors
[j
].is_protected
== 0)
90 protect_state
= "not protected";
91 else if (p
->sectors
[j
].is_protected
== 1)
92 protect_state
= "protected";
94 protect_state
= "protection state unknown";
96 command_print(CMD_CTX
,
97 "\t#%3i: 0x%8.8" PRIx32
" (0x%" PRIx32
" %" PRIi32
"kB) %s",
101 p
->sectors
[j
].size
>> 10,
105 *buf
= '\0'; /* initialize buffer, otherwise it migh contain garbage if driver function fails */
106 retval
= p
->driver
->info(p
, buf
, sizeof(buf
));
107 command_print(CMD_CTX
, "%s", buf
);
108 if (retval
!= ERROR_OK
)
109 LOG_ERROR("error retrieving flash info (%d)", retval
);
115 COMMAND_HANDLER(handle_flash_probe_command
)
117 struct flash_bank
*p
;
122 return ERROR_COMMAND_SYNTAX_ERROR
;
125 retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
126 if (retval
!= ERROR_OK
)
131 if ((retval
= p
->driver
->probe(p
)) == ERROR_OK
)
133 command_print(CMD_CTX
, "flash '%s' found at 0x%8.8" PRIx32
, p
->driver
->name
, p
->base
);
138 command_print(CMD_CTX
, "flash bank '#%s' is out of bounds", CMD_ARGV
[0]);
145 COMMAND_HANDLER(handle_flash_erase_check_command
)
149 return ERROR_COMMAND_SYNTAX_ERROR
;
152 struct flash_bank
*p
;
153 int retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
154 if (ERROR_OK
!= retval
)
158 if ((retval
= p
->driver
->erase_check(p
)) == ERROR_OK
)
160 command_print(CMD_CTX
, "successfully checked erase state");
164 command_print(CMD_CTX
, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32
,
165 CMD_ARGV
[0], p
->base
);
168 for (j
= 0; j
< p
->num_sectors
; j
++)
172 if (p
->sectors
[j
].is_erased
== 0)
173 erase_state
= "not erased";
174 else if (p
->sectors
[j
].is_erased
== 1)
175 erase_state
= "erased";
177 erase_state
= "erase state unknown";
179 command_print(CMD_CTX
,
180 "\t#%3i: 0x%8.8" PRIx32
" (0x%" PRIx32
" %" PRIi32
"kB) %s",
182 p
->sectors
[j
].offset
,
184 p
->sectors
[j
].size
>> 10,
191 COMMAND_HANDLER(handle_flash_erase_address_command
)
193 struct flash_bank
*p
;
194 int retval
= ERROR_OK
;
198 bool do_unlock
= false;
199 struct target
*target
= get_current_target(CMD_CTX
);
201 while (CMD_ARGC
>= 3)
203 /* Optionally pad out the address range to block/sector
204 * boundaries. We can't know if there's data in that part
205 * of the flash; only do padding if we're told to.
207 if (strcmp("pad", CMD_ARGV
[0]) == 0)
210 } else if (strcmp("unlock", CMD_ARGV
[0]) == 0)
215 return ERROR_COMMAND_SYNTAX_ERROR
;
222 return ERROR_COMMAND_SYNTAX_ERROR
;
225 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[0], address
);
226 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[1], length
);
230 command_print(CMD_CTX
, "Length must be >0");
231 return ERROR_COMMAND_SYNTAX_ERROR
;
234 retval
= get_flash_bank_by_addr(target
, address
, true, &p
);
235 if (retval
!= ERROR_OK
)
238 /* We can't know if we did a resume + halt, in which case we no longer know the erased state */
241 struct duration bench
;
242 duration_start(&bench
);
246 retval
= flash_unlock_address_range(target
, address
, length
);
249 if (retval
== ERROR_OK
)
251 retval
= flash_erase_address_range(target
, do_pad
, address
, length
);
254 if ((ERROR_OK
== retval
) && (duration_measure(&bench
) == ERROR_OK
))
256 command_print(CMD_CTX
, "erased address 0x%8.8x (length %i)"
257 " in %fs (%0.3f KiB/s)", address
, length
,
258 duration_elapsed(&bench
), duration_kbps(&bench
, length
));
264 static int flash_check_sector_parameters(struct command_context
*cmd_ctx
,
265 uint32_t first
, uint32_t last
, uint32_t num_sectors
)
267 if (!(first
<= last
)) {
268 command_print(cmd_ctx
, "ERROR: "
269 "first sector must be <= last sector");
273 if (!(last
<= (num_sectors
- 1))) {
274 command_print(cmd_ctx
, "ERROR: last sector must be <= %d",
275 (int) num_sectors
- 1);
282 COMMAND_HANDLER(handle_flash_erase_command
)
285 return ERROR_COMMAND_SYNTAX_ERROR
;
290 struct flash_bank
*p
;
293 retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
294 if (retval
!= ERROR_OK
)
297 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[1], first
);
298 if (strcmp(CMD_ARGV
[2], "last") == 0)
299 last
= p
->num_sectors
- 1;
301 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[2], last
);
303 if ((retval
= flash_check_sector_parameters(CMD_CTX
,
304 first
, last
, p
->num_sectors
)) != ERROR_OK
)
307 struct duration bench
;
308 duration_start(&bench
);
310 retval
= flash_driver_erase(p
, first
, last
);
312 if ((ERROR_OK
== retval
) && (duration_measure(&bench
) == ERROR_OK
))
314 command_print(CMD_CTX
, "erased sectors %" PRIu32
" "
315 "through %" PRIu32
" on flash bank %" PRIu32
" "
316 "in %fs", first
, last
, p
->bank_number
, duration_elapsed(&bench
));
322 COMMAND_HANDLER(handle_flash_protect_command
)
325 return ERROR_COMMAND_SYNTAX_ERROR
;
330 struct flash_bank
*p
;
333 retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
334 if (retval
!= ERROR_OK
)
337 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[1], first
);
338 if (strcmp(CMD_ARGV
[2], "last") == 0)
339 last
= p
->num_sectors
- 1;
341 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[2], last
);
344 COMMAND_PARSE_ON_OFF(CMD_ARGV
[3], set
);
346 if ((retval
= flash_check_sector_parameters(CMD_CTX
,
347 first
, last
, p
->num_sectors
)) != ERROR_OK
)
350 retval
= flash_driver_protect(p
, set
, first
, last
);
351 if (retval
== ERROR_OK
) {
352 command_print(CMD_CTX
, "%s protection for sectors %i "
353 "through %i on flash bank %" PRIu32
"",
354 (set
) ? "set" : "cleared", (int) first
,
355 (int) last
, p
->bank_number
);
361 COMMAND_HANDLER(handle_flash_write_image_command
)
363 struct target
*target
= get_current_target(CMD_CTX
);
372 return ERROR_COMMAND_SYNTAX_ERROR
;
375 /* flash auto-erase is disabled by default*/
377 bool auto_unlock
= false;
381 if (strcmp(CMD_ARGV
[0], "erase") == 0)
386 command_print(CMD_CTX
, "auto erase enabled");
387 } else if (strcmp(CMD_ARGV
[0], "unlock") == 0)
392 command_print(CMD_CTX
, "auto unlock enabled");
401 return ERROR_COMMAND_SYNTAX_ERROR
;
406 LOG_ERROR("no target selected");
410 struct duration bench
;
411 duration_start(&bench
);
415 image
.base_address_set
= 1;
416 COMMAND_PARSE_NUMBER(llong
, CMD_ARGV
[1], image
.base_address
);
420 image
.base_address_set
= 0;
421 image
.base_address
= 0x0;
424 image
.start_address_set
= 0;
426 retval
= image_open(&image
, CMD_ARGV
[0], (CMD_ARGC
== 3) ? CMD_ARGV
[2] : NULL
);
427 if (retval
!= ERROR_OK
)
432 retval
= flash_write_unlock(target
, &image
, &written
, auto_erase
, auto_unlock
);
433 if (retval
!= ERROR_OK
)
439 if ((ERROR_OK
== retval
) && (duration_measure(&bench
) == ERROR_OK
))
441 command_print(CMD_CTX
, "wrote %" PRIu32
" bytes from file %s "
442 "in %fs (%0.3f KiB/s)", written
, CMD_ARGV
[0],
443 duration_elapsed(&bench
), duration_kbps(&bench
, written
));
451 COMMAND_HANDLER(handle_flash_fill_command
)
458 uint32_t cur_size
= 0;
459 uint32_t chunk_count
;
460 struct target
*target
= get_current_target(CMD_CTX
);
463 int retval
= ERROR_OK
;
465 static size_t const chunksize
= 1024;
466 uint8_t *chunk
= malloc(chunksize
);
470 uint8_t *readback
= malloc(chunksize
);
471 if (readback
== NULL
)
480 retval
= ERROR_COMMAND_SYNTAX_ERROR
;
485 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[0], address
);
486 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[1], pattern
);
487 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[2], count
);
504 retval
= ERROR_COMMAND_SYNTAX_ERROR
;
508 chunk_count
= MIN(count
, (chunksize
/ wordsize
));
512 for (i
= 0; i
< chunk_count
; i
++)
514 target_buffer_set_u32(target
, chunk
+ i
* wordsize
, pattern
);
518 for (i
= 0; i
< chunk_count
; i
++)
520 target_buffer_set_u16(target
, chunk
+ i
* wordsize
, pattern
);
524 memset(chunk
, pattern
, chunk_count
);
527 LOG_ERROR("BUG: can't happen");
531 struct duration bench
;
532 duration_start(&bench
);
534 for (wrote
= 0; wrote
< (count
*wordsize
); wrote
+= cur_size
)
536 struct flash_bank
*bank
;
538 retval
= get_flash_bank_by_addr(target
, address
, true, &bank
);
539 if (retval
!= ERROR_OK
)
542 cur_size
= MIN((count
* wordsize
- wrote
), chunksize
);
543 err
= flash_driver_write(bank
, chunk
, address
- bank
->base
+ wrote
, cur_size
);
550 err
= flash_driver_read(bank
, readback
, address
- bank
->base
+ wrote
, cur_size
);
557 for (i
= 0; i
< cur_size
; i
++)
559 if (readback
[i
]!=chunk
[i
])
561 LOG_ERROR("Verification error address 0x%08" PRIx32
", read back 0x%02x, expected 0x%02x",
562 address
+ wrote
+ i
, readback
[i
], chunk
[i
]);
569 if ((retval
== ERROR_OK
) && (duration_measure(&bench
) == ERROR_OK
))
571 command_print(CMD_CTX
, "wrote %" PRIu32
" bytes to 0x%8.8" PRIx32
572 " in %fs (%0.3f KiB/s)", wrote
, address
,
573 duration_elapsed(&bench
), duration_kbps(&bench
, wrote
));
583 COMMAND_HANDLER(handle_flash_write_bank_command
)
587 struct fileio fileio
;
590 return ERROR_COMMAND_SYNTAX_ERROR
;
592 struct duration bench
;
593 duration_start(&bench
);
595 struct flash_bank
*p
;
596 int retval
= CALL_COMMAND_HANDLER(flash_command_get_bank
, 0, &p
);
597 if (ERROR_OK
!= retval
)
600 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[2], offset
);
602 if (fileio_open(&fileio
, CMD_ARGV
[1], FILEIO_READ
, FILEIO_BINARY
) != ERROR_OK
)
608 retval
= fileio_size(&fileio
, &filesize
);
609 if (retval
!= ERROR_OK
)
611 fileio_close(&fileio
);
615 buffer
= malloc(filesize
);
618 fileio_close(&fileio
);
619 LOG_ERROR("Out of memory");
623 if (fileio_read(&fileio
, filesize
, buffer
, &buf_cnt
) != ERROR_OK
)
626 fileio_close(&fileio
);
630 retval
= flash_driver_write(p
, buffer
, offset
, buf_cnt
);
635 if ((ERROR_OK
== retval
) && (duration_measure(&bench
) == ERROR_OK
))
637 command_print(CMD_CTX
, "wrote %ld bytes from file %s to flash bank %u"
638 " at offset 0x%8.8" PRIx32
" in %fs (%0.3f KiB/s)",
639 (long)filesize
, CMD_ARGV
[1], p
->bank_number
, offset
,
640 duration_elapsed(&bench
), duration_kbps(&bench
, filesize
));
643 fileio_close(&fileio
);
648 void flash_set_dirty(void)
650 struct flash_bank
*c
;
653 /* set all flash to require erasing */
654 for (c
= flash_bank_list(); c
; c
= c
->next
)
656 for (i
= 0; i
< c
->num_sectors
; i
++)
658 c
->sectors
[i
].is_erased
= 0;
663 static const struct command_registration flash_exec_command_handlers
[] = {
666 .handler
= handle_flash_probe_command
,
667 .mode
= COMMAND_EXEC
,
669 .help
= "Identify a flash bank.",
673 .handler
= handle_flash_info_command
,
674 .mode
= COMMAND_EXEC
,
676 .help
= "Print information about a flash bank.",
679 .name
= "erase_check",
680 .handler
= handle_flash_erase_check_command
,
681 .mode
= COMMAND_EXEC
,
683 .help
= "Check erase state of all blocks in a "
687 .name
= "erase_sector",
688 .handler
= handle_flash_erase_command
,
689 .mode
= COMMAND_EXEC
,
690 .usage
= "bank_id first_sector_num last_sector_num",
691 .help
= "Erase a range of sectors in a flash bank.",
694 .name
= "erase_address",
695 .handler
= handle_flash_erase_address_command
,
696 .mode
= COMMAND_EXEC
,
697 .usage
= "['pad'] ['unlock'] address length",
698 .help
= "Erase flash sectors starting at address and "
699 "continuing for length bytes. If 'pad' is specified, "
700 "data outside that range may also be erased: the start "
701 "address may be decreased, and length increased, so "
702 "that all of the first and last sectors are erased. "
703 "If 'unlock' is specified, then the flash is unprotected "
709 .handler
= handle_flash_fill_command
,
710 .mode
= COMMAND_EXEC
,
711 .usage
= "address value n",
712 .help
= "Fill n words with 32-bit value, starting at "
713 "word address. (No autoerase.)",
717 .handler
= handle_flash_fill_command
,
718 .mode
= COMMAND_EXEC
,
719 .usage
= "address value n",
720 .help
= "Fill n halfwords with 16-bit value, starting at "
721 "word address. (No autoerase.)",
725 .handler
= handle_flash_fill_command
,
726 .mode
= COMMAND_EXEC
,
727 .usage
= "address value n",
728 .help
= "Fill n bytes with 8-bit value, starting at "
729 "word address. (No autoerase.)",
732 .name
= "write_bank",
733 .handler
= handle_flash_write_bank_command
,
734 .mode
= COMMAND_EXEC
,
735 .usage
= "bank_id filename offset",
736 .help
= "Write binary data from file to flash bank, "
737 "starting at specified byte offset from the "
738 "beginning of the bank.",
741 .name
= "write_image",
742 .handler
= handle_flash_write_image_command
,
743 .mode
= COMMAND_EXEC
,
744 .usage
= "[erase] [unlock] filename [offset [file_type]]",
745 .help
= "Write an image to flash. Optionally first unprotect "
746 "and/or erase the region to be used. Allow optional "
747 "offset from beginning of bank (defaults to zero)",
751 .handler
= handle_flash_protect_command
,
752 .mode
= COMMAND_EXEC
,
753 .usage
= "bank_id first_sector [last_sector|'last'] "
755 .help
= "Turn protection on or off for a range of sectors "
756 "in a given flash bank.",
758 COMMAND_REGISTRATION_DONE
761 static int flash_init_drivers(struct command_context
*cmd_ctx
)
763 if (!flash_bank_list())
766 struct command
*parent
= command_find_in_context(cmd_ctx
, "flash");
767 return register_commands(cmd_ctx
, parent
, flash_exec_command_handlers
);
771 COMMAND_HANDLER(handle_flash_bank_command
)
775 LOG_ERROR("usage: flash bank <name> <driver> "
776 "<base> <size> <chip_width> <bus_width> <target>");
777 return ERROR_COMMAND_SYNTAX_ERROR
;
779 // save bank name and advance arguments for compatibility
780 const char *bank_name
= *CMD_ARGV
++;
783 struct target
*target
;
784 if ((target
= get_target(CMD_ARGV
[5])) == NULL
)
786 LOG_ERROR("target '%s' not defined", CMD_ARGV
[5]);
790 const char *driver_name
= CMD_ARGV
[0];
791 struct flash_driver
*driver
= flash_driver_find_by_name(driver_name
);
794 /* no matching flash driver found */
795 LOG_ERROR("flash driver '%s' not found", driver_name
);
799 /* check the flash bank name is unique */
800 if (get_flash_bank_by_name_noprobe(bank_name
) != NULL
)
802 /* flash bank name already exists */
803 LOG_ERROR("flash bank name '%s' already exists", bank_name
);
807 /* register flash specific commands */
808 if (NULL
!= driver
->commands
)
810 int retval
= register_commands(CMD_CTX
, NULL
,
812 if (ERROR_OK
!= retval
)
814 LOG_ERROR("couldn't register '%s' commands",
820 struct flash_bank
*c
= malloc(sizeof(*c
));
821 c
->name
= strdup(bank_name
);
824 c
->driver_priv
= NULL
;
825 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[1], c
->base
);
826 COMMAND_PARSE_NUMBER(u32
, CMD_ARGV
[2], c
->size
);
827 COMMAND_PARSE_NUMBER(int, CMD_ARGV
[3], c
->chip_width
);
828 COMMAND_PARSE_NUMBER(int, CMD_ARGV
[4], c
->bus_width
);
834 retval
= CALL_COMMAND_HANDLER(driver
->flash_bank_command
, c
);
835 if (ERROR_OK
!= retval
)
837 LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32
,
838 driver_name
, c
->base
);
848 COMMAND_HANDLER(handle_flash_banks_command
)
851 return ERROR_INVALID_ARGUMENTS
;
854 for (struct flash_bank
*p
= flash_bank_list(); p
; p
= p
->next
, n
++)
856 LOG_USER("#%" PRIu32
" : %s at 0x%8.8" PRIx32
", size 0x%8.8" PRIx32
", "
857 "buswidth %u, chipwidth %u", p
->bank_number
,
858 p
->driver
->name
, p
->base
, p
->size
,
859 p
->bus_width
, p
->chip_width
);
864 static int jim_flash_list(Jim_Interp
*interp
, int argc
, Jim_Obj
*const *argv
)
868 Jim_WrongNumArgs(interp
, 1, argv
,
869 "no arguments to 'flash list' command");
873 Jim_Obj
*list
= Jim_NewListObj(interp
, NULL
, 0);
875 for (struct flash_bank
*p
= flash_bank_list(); p
; p
= p
->next
)
877 Jim_Obj
*elem
= Jim_NewListObj(interp
, NULL
, 0);
879 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, "name", -1));
880 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, p
->driver
->name
, -1));
881 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, "base", -1));
882 Jim_ListAppendElement(interp
, elem
, Jim_NewIntObj(interp
, p
->base
));
883 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, "size", -1));
884 Jim_ListAppendElement(interp
, elem
, Jim_NewIntObj(interp
, p
->size
));
885 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, "bus_width", -1));
886 Jim_ListAppendElement(interp
, elem
, Jim_NewIntObj(interp
, p
->bus_width
));
887 Jim_ListAppendElement(interp
, elem
, Jim_NewStringObj(interp
, "chip_width", -1));
888 Jim_ListAppendElement(interp
, elem
, Jim_NewIntObj(interp
, p
->chip_width
));
890 Jim_ListAppendElement(interp
, list
, elem
);
893 Jim_SetResult(interp
, list
);
899 COMMAND_HANDLER(handle_flash_init_command
)
902 return ERROR_COMMAND_SYNTAX_ERROR
;
904 static bool flash_initialized
= false;
905 if (flash_initialized
)
907 LOG_INFO("'flash init' has already been called");
910 flash_initialized
= true;
912 LOG_DEBUG("Initializing flash devices...");
913 return flash_init_drivers(CMD_CTX
);
916 static const struct command_registration flash_config_command_handlers
[] = {
919 .handler
= handle_flash_bank_command
,
920 .mode
= COMMAND_CONFIG
,
921 .usage
= "bank_id driver_name base_address size_bytes "
922 "chip_width_bytes bus_width_bytes target "
923 "[driver_options ...]",
924 .help
= "Define a new bank with the given name, "
925 "using the specified NOR flash driver.",
929 .mode
= COMMAND_CONFIG
,
930 .handler
= handle_flash_init_command
,
931 .help
= "Initialize flash devices.",
936 .handler
= handle_flash_banks_command
,
937 .help
= "Display table with information about flash banks.",
942 .jim_handler
= jim_flash_list
,
943 .help
= "Returns a list of details about the flash banks.",
945 COMMAND_REGISTRATION_DONE
947 static const struct command_registration flash_command_handlers
[] = {
951 .help
= "NOR flash command group",
952 .chain
= flash_config_command_handlers
,
954 COMMAND_REGISTRATION_DONE
957 int flash_register_commands(struct command_context
*cmd_ctx
)
959 return register_commands(cmd_ctx
, NULL
, flash_command_handlers
);