History log of /u-boot/arch/arm/mach-uniphier/board_late_init.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 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>

# 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>

# 055e5ad2 30-Jul-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove unneeded header inclusion from board_late_init.c

<nand.h> is unneeded since commit 9248a78f40d6 ("ARM: UniPhier: remove
Denali NAND controller fixup code").

<linux/io.h> is uneeded since commit 1320fa2e55d2 ("ARM: uniphier:
remove workaround for the NAND write protect").

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

# 6717e154 19-May-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: delete or replace <common.h> includes

<common.h> pulls in a lot of bloat. <common.h> is unneeded in most of
places.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1320fa2e 14-Feb-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove workaround for the NAND write protect

This workaround was previously needed for LD4, Pro4, sLD8, Pro5
SoCs. The boot ROM does not touch this register for PXs2/LD6b or
later.

Now that the reset signal of the Denali NAND controller is always
asserted in board_init() then deasserted in the driver, the
WRITE_PROTECT register gets back to the default value, which means
the write protect is deasserted.

This workaround can go away entirely.

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

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.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>

# 055e5ad2 30-Jul-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove unneeded header inclusion from board_late_init.c

<nand.h> is unneeded since commit 9248a78f40d6 ("ARM: UniPhier: remove
Denali NAND controller fixup code").

<linux/io.h> is uneeded since commit 1320fa2e55d2 ("ARM: uniphier:
remove workaround for the NAND write protect").

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

# 6717e154 19-May-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: delete or replace <common.h> includes

<common.h> pulls in a lot of bloat. <common.h> is unneeded in most of
places.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1320fa2e 14-Feb-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove workaround for the NAND write protect

This workaround was previously needed for LD4, Pro4, sLD8, Pro5
SoCs. The boot ROM does not touch this register for PXs2/LD6b or
later.

Now that the reset signal of the Denali NAND controller is always
asserted in board_init() then deasserted in the driver, the
WRITE_PROTECT register gets back to the default value, which means
the write protect is deasserted.

This workaround can go away entirely.

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

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 055e5ad2 30-Jul-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove unneeded header inclusion from board_late_init.c

<nand.h> is unneeded since commit 9248a78f40d6 ("ARM: UniPhier: remove
Denali NAND controller fixup code").

<linux/io.h> is uneeded since commit 1320fa2e55d2 ("ARM: uniphier:
remove workaround for the NAND write protect").

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

# 6717e154 19-May-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: delete or replace <common.h> includes

<common.h> pulls in a lot of bloat. <common.h> is unneeded in most of
places.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1320fa2e 14-Feb-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove workaround for the NAND write protect

This workaround was previously needed for LD4, Pro4, sLD8, Pro5
SoCs. The boot ROM does not touch this register for PXs2/LD6b or
later.

Now that the reset signal of the Denali NAND controller is always
asserted in board_init() then deasserted in the driver, the
WRITE_PROTECT register gets back to the default value, which means
the write protect is deasserted.

This workaround can go away entirely.

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

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 6717e154 19-May-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: delete or replace <common.h> includes

<common.h> pulls in a lot of bloat. <common.h> is unneeded in most of
places.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 1320fa2e 14-Feb-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove workaround for the NAND write protect

This workaround was previously needed for LD4, Pro4, sLD8, Pro5
SoCs. The boot ROM does not touch this register for PXs2/LD6b or
later.

Now that the reset signal of the Denali NAND controller is always
asserted in board_init() then deasserted in the driver, the
WRITE_PROTECT register gets back to the default value, which means
the write protect is deasserted.

This workaround can go away entirely.

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

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# 1320fa2e 14-Feb-2020 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: remove workaround for the NAND write protect

This workaround was previously needed for LD4, Pro4, sLD8, Pro5
SoCs. The boot ROM does not touch this register for PXs2/LD6b or
later.

Now that the reset signal of the Denali NAND controller is always
asserted in board_init() then deasserted in the driver, the
WRITE_PROTECT register gets back to the default value, which means
the write protect is deasserted.

This workaround can go away entirely.

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

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

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

common: Move some board functions out of common.h

A number of board function belong in init.h with the others. Move them.

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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.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>

# 2ce6b82d 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set {kernel, ramdisk, fdt}_addr_r at boot-time

The base of DRAM will be changed for the next generation SoC.
The addresses needed for booting the kernel should be shifted
according to the DRAM base.

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

# 70956787 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set dram_base environment variable

The base of DRAM will be changed for the next generation SoC.

Set the base address to the 'dram_base' environment variable, which
will be useful for scripting.

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

# 3cc936d8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set loadaddr at boot-time

The base of DRAM will be changed for the next generation SoC.
To support it along with existing SoCs in the single defconfig,
set 'loadaddr' at boot-time by adding the offset to the DRAM base.

CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the
value from environment variable 'loadaddr' should be used.

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

# 72cd83ab 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: turn uniphier_set_fdt_file() into void function

For consistency with a function that will be added.

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

# c3d8f1e8 10-Jul-2019 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: detect SD boot mode

The planned new SoC supports the SD boot mode. Detect and display it.

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

# 6bc50a8f 19-Dec-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not modify bootcmd environment variable at run-time

Some users might want to modify 'bootcmd' at compile-time by editing
include/configs/uniphier.h, but overwriting it at run-time makes it
impossible.

Instead, set 'bootdev' at run-time, which contains the boot device the
system is booting from, then indirectly reference it from 'bootcmd'.

It is up to users whether to override 'bootcmd'.

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

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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

# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>

# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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

# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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

# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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

# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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

# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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

# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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

# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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

# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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

# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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

# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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

# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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

# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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

# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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

# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

# a430fa06 16-Aug-2018 Miquel Raynal <miquel.raynal@bootlin.com>

mtd: move NAND files into a raw/ subdirectory

NAND flavors, like serial and parallel, have a lot in common and would
benefit to share code. Let's move raw (parallel) NAND specific code in a
raw/ subdirectory, to ease the addition of a core file in nand/ and the
introduction of a spi/ subdirectory specific to SPI NANDs.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>


# 7ef5b1e7 20-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

- Remove the environment vairalbes used to load images from raw
block devices.

- Keep the command to download images via tftp. This will be
useful to boot the kernel when no valid kernel image is ready
yet in the file system.

- Use root.cpio.gz instead of root.cpio.uboot because we always know
the file size of the init ramdisk; it is loaded via either a file
system or network.

- Rename fit_addr_r to kernel_addr_r, which the distro command
checks to get the load address of FIT image.

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


# 8c09f1f4 17-May-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rename environment variable fdt_file to fdtfile

For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtfile" environment variable.

Rename "fdt_file" to "fdtfile" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>


# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# dd74b945 13-Oct-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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>


# 382bee57 03-Aug-2017 Simon Glass <sjg@chromium.org>

env: Rename setenv() to env_set()

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

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


# 63754842 20-Apr-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: show STM (SCP) status on boot and pinmon command

The SCP (System Control Processor) or what we call STM (Stand-by
MPU) is integrated in LD4, Pro4, sLD8, LD6b, LD11, and LD20.
For these SoCs, show the information if STM is enabled.

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


# 784548ef 13-Feb-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework spl_boot_device() and related code

The current implementation has ugly switch statements here and there,
and duplicates similar code. Rework it using table lookups for SoC
data and reduce code duplication.

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


# 40749d5a 17-Oct-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: adjust fdt_file environment handling to latest Linux

The environment fdt_file is useful to remember the appropriate DTB
file name. Adjust it to the recent renaming in the upstream kernel.

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


# b02e4044 02-Oct-2016 Simon Glass <sjg@chromium.org>

libfdt: Bring in upstream stringlist functions

These have now landed upstream. The naming is different and in one case the
function signature has changed. Update the code to match.

This applies the following upstream commits by
Thierry Reding <treding@nvidia.com> :

604e61e fdt: Add functions to retrieve strings
8702bd1 fdt: Add a function to get the index of a string
2218387 fdt: Add a function to count strings

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


# 4565a74d 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: do not overwrite fdt_file environment

This code auto-detects the best-match FDT file name, but it should
respect the user's choice if "fdt_file" environment is found in a
saved set of environments.

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


# 80630dad 07-Jun-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: check return code of setenv()

Because setenv() may fail, it is better to check its return code.

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


# 881aa5a7 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: rework uniphier_set_fdt_file()

The current table look-up for the DTB file name turned out bothersome
in terms of maintainability; I ended up adding a new entry every time
a new board is supported.

There is a common pattern between the DT compatible string and the
corresponding file name; drop the vendor prefix "socionext," and
prefix it with "uniphier-" and suffix it with ".dtb".

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


# d90b9745 20-Apr-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: carry on booting for Unknown boot mode

No need to stop booting U-Boot even if boot mode is unknown.
Setting the "bootmode" environment is only useful for booting
Linux Kernel. Anyway, U-Boot has already booted by this point.

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


# 3f231117 12-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: add support for PH1-Pro4 Ace and Sanji boards

Initial commit for PH1-Pro4 Ace and Sanji boards.

Note:
There are two variants for the Ace board in terms of the amount of
DDR memory; 1GB or 2GB.

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


# fec48163 02-Feb-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: support USB boot mode for ProXstream2 / PH1-LD6b SoC

The USB boot code is too fat and complicated to be included in SPL
(at least for now). So, it was implemented as a separate project
(what we call USB-loader).

The expected boot sequence is as follows:

Boot ROM -> USB-loader -> SPL -> U-Boot proper

The USB-loader loads the SPL and U-Boot proper from a USB memory
onto the locked L2 cache. Then, SPL needs to copy the U-Boot proper
to DRAM, so this mode looks like a NOR boot from the view of SPL.
However, we want to distinguish between (genuine) NOR boot and USB
boot in some places.

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


# 8ea4f49a 17-Dec-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: uniphier: set DTB file name to fdt_file environment

When we want to boot Linux with a DTB file downloaded from a TFTP
server or somewhere, we need to know the file name to be downloaded.

Assume the U-Boot configuration is shared among some similar boards.
If they are similar enough, the difference only appears in device
trees. The build procedure would be like this:

- Board A: make foo_common_defconfig && make DEVICE_TREE=foo_board_a
- Board B: make foo_common_defconfig && make DEVICE_TREE=foo_board_b
- Board C: make foo_common_defconfig && make DEVICE_TREE=foo_board_c

In this case, the U-Boot image contains nothing about the DTB file name
it is running with. (CONFIG_DEFAULT_DEVICE_TREE is not helpful for this
purpose because it is painful to change it from "make menuconfig" for
each board.)

This commit allows to lookup the DTB file name based on the compatible
string and set it to "fdt_file" environment. Then "tftpboot $fdt_file"
will download the file we want.

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


# f6e7f07c 29-May-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

ARM: UniPhier: replace <asm/io.h> with <linux/io.h>

In the Linux coding style, it is recommended to include <linux/io.h>
rather than <asm/io.h>. Follow this trend.

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


# 4c425570 26-Feb-2015 Masahiro Yamada <yamada.m@jp.panasonic.com>

ARM: UniPhier: move SoC sources to mach-uniphier

Move
arch/arm/cpu/armv7/uniphier/* -> arch/arm/mach-uniphier/*

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>