History log of /u-boot/cmd/load.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 21a2c129 09-Jan-2024 Tom Rini <trini@konsulko.com>

getchar(): Correct usage

The function getchar() returns an 'int' and not a 'char'. Coverity notes
that "Assigning the return value of getchar to char ... truncates its value."
and so for the most part we can resolve this easily by using 'int' as
intended, and often used throughout the codebase. A few places are not
so simple and would require further re-architecting of the code in order
to change this, so we leave them be.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 338b67f7 25-Jun-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: fix loads, saves on sandbox

The loads and saves commands crash on the sandbox due to illegal memory
access.

For command line arguments the sandbox uses a virtual address space which
does not equal the addresses of the memory allocated with memmap(). Add the
missing address translations for the loads and saves commands.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 989cc40f 05-Sep-2022 This contributor prefers not to receive mails <noreply@example.com>

serial: Call flush() before changing baudrate

Changing baudrate is a sensitive operation. To ensure that U-Boot messages
printed before changing baudrate are not lost, call new U-Boot console
flush() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bfef72e4 11-May-2022 Rui Miguel Silva <rui.silva@linaro.org>

cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c6855195 10-Oct-2021 Marek Vasut <marex@denx.de>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 This contributor prefers not to receive mails <noreply@example.com>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 This contributor prefers not to receive mails <noreply@example.com>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 This contributor prefers not to receive mails <noreply@example.com>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 This contributor prefers not to receive mails <noreply@example.com>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@amd.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <masahiroy@kernel.org>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 338b67f7 25-Jun-2023 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: fix loads, saves on sandbox

The loads and saves commands crash on the sandbox due to illegal memory
access.

For command line arguments the sandbox uses a virtual address space which
does not equal the addresses of the memory allocated with memmap(). Add the
missing address translations for the loads and saves commands.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 989cc40f 05-Sep-2022 Pali Rohár <pali@kernel.org>

serial: Call flush() before changing baudrate

Changing baudrate is a sensitive operation. To ensure that U-Boot messages
printed before changing baudrate are not lost, call new U-Boot console
flush() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bfef72e4 11-May-2022 Rui Miguel Silva <rui.silva@linaro.org>

cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c6855195 10-Oct-2021 Marek Vasut <marex@denx.de>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@amd.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 989cc40f 05-Sep-2022 Pali Rohár <pali@kernel.org>

serial: Call flush() before changing baudrate

Changing baudrate is a sensitive operation. To ensure that U-Boot messages
printed before changing baudrate are not lost, call new U-Boot console
flush() function.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bfef72e4 11-May-2022 Rui Miguel Silva <rui.silva@linaro.org>

cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c6855195 10-Oct-2021 Marek Vasut <marex@denx.de>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@amd.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 17ead040 23-Jul-2022 Tom Rini <trini@konsulko.com>

Audit <flash.h> inclusion

A large number of files include <flash.h> as it used to be how various
SPI flash related functions were found, or for other reasons entirely.
In order to migrate some further CONFIG symbols to Kconfig we need to
not include flash.h in cases where we don't have a NOR flash of some
sort enabled. Furthermore, in cases where we are in common code and it
doesn't make sense to try and further refactor the code itself in to new
files we need to guard this inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>

# bfef72e4 11-May-2022 Rui Miguel Silva <rui.silva@linaro.org>

cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c6855195 10-Oct-2021 Marek Vasut <marex@denx.de>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@amd.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# bfef72e4 11-May-2022 Rui Miguel Silva <rui.silva@linaro.org>

cmd: load: add load command for memory mapped

cp.b is used a lot as a way to load binaries to memory and execute
them, however we may need to integrate this with the efi subsystem to
set it up as a bootdev.

So, introduce a loadm command that will be consistent with the other
loadX commands and will call the efi API's.

ex: loadm $kernel_addr $kernel_addr_r $kernel_size

with this a kernel with CONFIG_EFI_STUB enabled will be loaded and
then subsequently booted with bootefi command.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c6855195 10-Oct-2021 Marek Vasut <marex@denx.de>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@amd.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# c6855195 10-Oct-2021 Marek Vasut <marek.vasut+renesas@gmail.com>

loads: Block writes into LMB reserved areas of U-Boot

The loads srec loading may overwrite piece of U-Boot accidentally.
Prevent that by using LMB to detect whether upcoming write would
overwrite piece of reserved U-Boot code, and if that is the case,
abort the srec loading.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# c97b2557 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 081bd249 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1f26c49e 03-Aug-2021 Pali Rohár <pali@kernel.org>

xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>

# 51538141 06-Aug-2021 Pali Rohár <pali@kernel.org>

loadb: Properly indicate aborted kermit transfer

When k_recv() returns zero it indicates that kermit transfer was aborted.
Function do_load_serial_bin() (caller of load_serial_bin()) interprets
value ~0 as aborted transfer, so properly propagates information about
aborted transfer from k_recv() to do_load_serial_bin().

Signed-off-by: Pali Rohár <pali@kernel.org>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 0b1284eb 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with decimal to dectoul()

It is a pain to have to specify the value 10 in each call. Add a new
dectoul() function and update the code to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 7e5f460e 24-Jul-2021 Simon Glass <sjg@chromium.org>

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 76b0a190 18-Mar-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd/load: support uploading EFI binary via UART

When uploading an EFI binary via the UART we have to call
efi_set_bootdev() or we won't be able to execute it.

Put the includes into alphabetic order.

Fixes: 5f59518a7b1a ("efi_loader: setting boot device")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 401d1c4f 30-Oct-2020 Simon Glass <sjg@chromium.org>

common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed. In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly. Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# b911208f 22-Jan-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

cmd: correct long text loadb, loadx, loady

The first argument is the load address and not an offset.

The second argument cannot be entered without the first one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# e7fcfef4 01-Dec-2020 Michal Simek <michal.simek@xilinx.com>

cmd: load: Fix code indentation

Reported by smatch like:
cmd/load.c:228 read_record() warn: inconsistent indenting

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# c670aeee 07-Oct-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

common: rename getc() to getchar()

The sandbox is built with the SDL2 library with invokes the X11 library
which in turn calls getc(). But getc() in glibc is defined as

int getc(FILE *)

This does not match our definition.

int getc(void)

The sandbox crashes when called with parameter -l.

Rename our library symbol getc() to getchar().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 09140113 10-May-2020 Simon Glass <sjg@chromium.org>

command: Remove the cmd_tbl_t typedef

We should not use typedefs in U-Boot. They cannot be used as forward
declarations which means that header files must include the full header to
access them.

Drop the typedef and rename the struct to remove the _s suffix which is
now not useful.

This requires quite a few header-file additions.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 90526e9f 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop net.h from common header

Move this header out of the common header. Network support is used in
quite a few places but it still does not warrant blanket inclusion.

Note that this net.h header itself has quite a lot in it. It could be
split into the driver-mode support, functions, structures, checksumming,
etc.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 8e8ccfe1 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move the image globals into image.h

These three globals relate to image handling. Move them to the image
header file.

Signed-off-by: Simon Glass <sjg@chromium.org>

# bb872dd9 28-Dec-2019 Simon Glass <sjg@chromium.org>

image: Rename load_addr, save_addr, save_size

These global variables are quite short and generic. In fact the same name
is more often used locally for struct members and function arguments.

Add a image_ prefix to make them easier to distinguish.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 0ee48252 28-Dec-2019 Simon Glass <sjg@chromium.org>

common: Move flash_perror() to flash.h

This function belongs more in flash.h than common.h so move it.

Also remove the space before the bracket in some calls.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 1eb69ae4 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move ARM cache operations out of common.h

These functions are CPU-related and do not use driver model. Move them to
cpu_func.h

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# b03e0510 14-Nov-2019 Simon Glass <sjg@chromium.org>

common: Move serial functions out of common.h

These functions belong in serial.h so move them over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# c7694dd4 01-Aug-2019 Simon Glass <sjg@chromium.org>

env: Move env_set_hex() to env.h

Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>

# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>

# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>

# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 00caae6d 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# 018f5303 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename common functions related to setenv()

We are now using an env_ prefix for environment functions. Rename these
commonly used functions, for consistency. Also add function comments in
common.h.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>


# e856bdcf 11-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

flash: complete CONFIG_SYS_NO_FLASH move with renaming

We repeated partial moves for CONFIG_SYS_NO_FLASH, but this is
not completed. Finish this work by the tool.

During this move, let's rename it to CONFIG_MTD_NOR_FLASH.
Actually, we have more instances of "#ifndef CONFIG_SYS_NO_FLASH"
than those of "#ifdef CONFIG_SYS_NO_FLASH". Flipping the logic will
make the code more readable. Besides, negative meaning symbols do
not fit in obj-$(CONFIG_...) style Makefiles.

This commit was created as follows:

[1] Edit "default n" to "default y" in the config entry in
common/Kconfig.

[2] Run "tools/moveconfig.py -y -r HEAD SYS_NO_FLASH"

[3] Rename the instances in defconfigs by the following:
find . -path './configs/*_defconfig' | xargs sed -i \
-e '/CONFIG_SYS_NO_FLASH=y/d' \
-e 's/# CONFIG_SYS_NO_FLASH is not set/CONFIG_MTD_NOR_FLASH=y/'

[4] Change the conditionals by the following:
find . -name '*.[ch]' | xargs sed -i \
-e 's/ifndef CONFIG_SYS_NO_FLASH/ifdef CONFIG_MTD_NOR_FLASH/' \
-e 's/ifdef CONFIG_SYS_NO_FLASH/ifndef CONFIG_MTD_NOR_FLASH/' \
-e 's/!defined(CONFIG_SYS_NO_FLASH)/defined(CONFIG_MTD_NOR_FLASH)/' \
-e 's/defined(CONFIG_SYS_NO_FLASH)/!defined(CONFIG_MTD_NOR_FLASH)/'

[5] Modify the following manually
- Rename the rest of instances
- Remove the description from README
- Create the new Kconfig entry in drivers/mtd/Kconfig
- Remove the old Kconfig entry from common/Kconfig
- Remove the garbage comments from include/configs/*.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 0a6036da 25-Oct-2016 Chris Packham <judge.packham@gmail.com>

cmd: load: align cache flush

Prevent cache misalignment message by ensuring that a whole cache line
is flushed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>


# b7fbdc60 05-Feb-2016 David Müller (ELSOFT AG) <d.mueller@elsoft.ch>

Remove unused CONFIG_CMD_HWFLOW option and associated dead code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>


# 2e192b24 17-Jan-2016 Simon Glass <sjg@chromium.org>

Remove the cmd_ prefix from command files

Now that they are in their own directory, we can remove this prefix.
This makes it easier to find a file since the prefix does not get in the
way.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>