The command flinfo (short: fli)
can be used to get information about the available flash memory. The
number of flash banks is printed with information about the size and
organization into flash "sectors" or erase units.
For all sectors the start addresses are printed; write-protected sectors
are marked as read-only (RO).
Some configurations of U-Boot also mark empty sectors with an (E).

The erase command (short: era)
is used to erase the contents of one or more sectors of the flash
memory. It is one of the more complex commands; the
help output shows this.

Probably the most frequent usage of this command is to pass the
start and end addresses of the area to be erased:

=> era 0xFF900000 0xFF95FFFF
... done
Erased 3 sectors
=>

Note that both the start and end addresses for this command
must point exactly at the start resp. end addresses of flash sectors.
Otherwise the command will not be executed.

Another way to select certain areas of the flash memory for the erase
command uses the notation of flash banks and sectors:

Technically speaking, a bank is an area of
memory implemented by one or more memory chips that are connected to
the same chip select signal of the CPU, and a
flash sector or erase unit
is the smallest area that can be erased in one operation.

For practical purposes it is sufficient to remember that with flash
memory a bank is something that eventually may be erased as a whole
in a single operation. This may be more efficient (faster) than
erasing the same area sector by sector.

[It depends on the actual type of flash chips used on the board if
such a fast bank erase algorithm exists, and on the implementation of
the flash device driver if is actually used.]

In U-Boot, flash banks are numbered starting with
1, while flash sectors start with
0.

To erase the same flash area as specified using start and end
addresses in the example above you could also type:

=> era 1:455-456
Erase Flash Sectors 455-456 in Bank # 1
.. done
=>

To erase a whole bank of flash memory you can use a command like this one:

The protect command is another complex one. It is used to set
certain parts of the flash memory to read-only mode or to make them
writable again. Flash memory that is "protected" (= read-only)
cannot be written (with the cp command) or erased (with the
erase command). Protected areas are marked as (RO) (for "read-only") in
the output of the flinfo command:

The actual level of protection depends on the flash chips used on
your hardware, and on the implementation of the flash device driver
for this board. In most cases U-Boot provides just a simple
software-protection, i. e. it prevents you from erasing or overwriting
important stuff by accident (like the U-Boot code itself or U-Boot's
environment variables), but it cannot prevent you from circumventing
these restrictions - a nasty user who is loading and running his own
flash driver code cannot and will not be stopped by this
mechanism. Also, in most cases this protection is only effective while
running U-Boot, i. e. any operating system will not know about
"protected" flash areas and will happily erase these if requested to
do so.